-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #76] Add InstanceUser and ACL interfaces #77
Merged
Merged
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7f9c83f
feat: add service user and acl
318228han 7ad307d
feat: add service user and acl
318228han 865100c
feat: add service user and acl
318228han d20d8a1
feat: add service user and acl
318228han 09691fa
feat: replace serviceuser with instanceuser
318228han 5b74f4e
feat: replace serviceuser with instanceuser #2
318228han 25789f4
feat: commit deletion serviceusermapperTest
318228han 31d120a
feat: 提交 application-test.yml 改回密码password的
318228han fe4cedf
feat: 最终更改
318228han fba6e83
feat: 最终更改-2
318228han 528d6f2
feat: 最终更改-3
318228han 02bacaf
Revert "feat: 最终更改-3"
318228han b14bce6
feat: 最终更改-4
318228han 2a96796
feat: 最终更改-5
318228han File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ bin/ | |
*.iws | ||
*.iml | ||
*.ipr | ||
*.http | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...onsole/src/main/java/org/apache/eventmesh/dashboard/console/controller/AclController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.console.controller; | ||
|
||
import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity; | ||
import org.apache.eventmesh.dashboard.console.service.acl.AclService; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/acl") | ||
public class AclController { | ||
|
||
@Autowired | ||
private AclService aclService; | ||
|
||
@PostMapping("/insertAcl") | ||
public void insertAcl(@RequestBody AclEntity aclEntity) { | ||
this.aclService.insert(aclEntity); | ||
} | ||
|
||
@PostMapping("deleteAcl") | ||
public void deleteAcl(@RequestBody AclEntity aclEntity) { | ||
this.aclService.deleteAclById(aclEntity); | ||
} | ||
|
||
@PostMapping("/updateAcl") | ||
public void updateAcl(@RequestBody AclEntity aclEntity) { | ||
this.aclService.updateResourceTypeById(aclEntity); | ||
} | ||
|
||
@PostMapping("/selectAcl") | ||
public void selectAcl(@RequestBody AclEntity aclEntity) { | ||
this.aclService.selectById(aclEntity); | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
...rc/main/java/org/apache/eventmesh/dashboard/console/controller/ServiceUserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.console.controller; | ||
|
||
import org.apache.eventmesh.dashboard.console.entity.serviceuser.ServiceUserEntity; | ||
import org.apache.eventmesh.dashboard.console.service.serviceuser.ServiceUserService; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/serviceUser") | ||
public class ServiceUserController { | ||
|
||
@Autowired | ||
private ServiceUserService serviceUserService; | ||
|
||
@PostMapping("/insertServiceUser") | ||
public void insertServiceUser(@RequestBody ServiceUserEntity serviceUserEntity) { | ||
this.serviceUserService.insert(serviceUserEntity); | ||
} | ||
|
||
@PostMapping("/deleteServiceUserByCluster") | ||
public void deleteServiceUserByCluster(@RequestBody ServiceUserEntity serviceUserEntity) { | ||
this.serviceUserService.deleteServiceUserByCluster(serviceUserEntity); | ||
} | ||
|
||
@PostMapping("/updateNameById") | ||
public void updateNameById(@RequestBody ServiceUserEntity serviceUserEntity) { | ||
this.serviceUserService.updatePasswordById(serviceUserEntity); | ||
} | ||
|
||
@PostMapping("/selectAll") | ||
public void selectAll() { | ||
|
||
} | ||
|
||
@PostMapping("/selectById") | ||
public void selectById(@RequestBody ServiceUserEntity serviceUserEntity) { | ||
this.serviceUserService.selectById(serviceUserEntity); | ||
} | ||
|
||
@PostMapping("/selectByName") | ||
public void selectByName(@RequestBody ServiceUserEntity serviceUserEntity) { | ||
this.serviceUserService.selectByName(serviceUserEntity); | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...rd-console/src/main/java/org/apache/eventmesh/dashboard/console/entity/acl/AclEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.console.entity.acl; | ||
|
||
import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@EqualsAndHashCode(callSuper = true, exclude = "status") | ||
public class AclEntity extends BaseEntity { | ||
|
||
private static final long serialVersionUID = 6057071983428111947L; | ||
private Long id; | ||
private Long clusterId; | ||
private String pattern; | ||
private Integer operation; | ||
private Integer permissionType; | ||
private String host; | ||
private Integer resourceType; | ||
private String resourceName; | ||
private Integer patternType; | ||
private Integer status; | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...ain/java/org/apache/eventmesh/dashboard/console/entity/serviceuser/ServiceUserEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.console.entity.serviceuser; | ||
|
||
import org.apache.eventmesh.dashboard.console.entity.base.BaseEntity; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
|
||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@EqualsAndHashCode(callSuper = true, exclude = "status") | ||
public class ServiceUserEntity extends BaseEntity { | ||
|
||
private Integer serviceType; | ||
|
||
private String password; | ||
|
||
private Long clusterId; | ||
|
||
private String name; | ||
|
||
private String token; | ||
|
||
private Integer status; | ||
|
||
} |
64 changes: 64 additions & 0 deletions
64
...rd-console/src/main/java/org/apache/eventmesh/dashboard/console/mapper/acl/AclMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.eventmesh.dashboard.console.mapper.acl; | ||
|
||
import org.apache.eventmesh.dashboard.console.entity.acl.AclEntity; | ||
|
||
import org.apache.ibatis.annotations.Insert; | ||
import org.apache.ibatis.annotations.Mapper; | ||
import org.apache.ibatis.annotations.Options; | ||
import org.apache.ibatis.annotations.Select; | ||
import org.apache.ibatis.annotations.Update; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Mybatis Mapper for the table of acl. | ||
*/ | ||
@Mapper | ||
public interface AclMapper { | ||
|
||
@Insert({ | ||
"<script>", | ||
" INSERT INTO acl (cluster_Id, pattern, operation, permission_Type, host, resource_Type, resource_Name, pattern_Type) VALUES ", | ||
" <foreach collection='list' item='c' index='index' separator=','>", | ||
" (#{c.clusterId}, #{c.pattern}, #{c.operation}, #{c.permissionType}, #{c.host}, " | ||
+ | ||
" #{c.resourceType}, #{c.resourceName}, #{c.patternType})", | ||
" </foreach>", | ||
"</script>"}) | ||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") | ||
void batchInsert(List<AclEntity> aclEntities); | ||
|
||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id") | ||
@Insert("INSERT INTO acl (cluster_id, pattern, operation, permission_type, host, resource_type, resource_name, pattern_type)" | ||
+ "VALUE (#{clusterId}, #{pattern}, #{operation}, #{permissionType}, #{host}, #{resourceType}, #{resourceName}, #{patternType})") | ||
void insert(AclEntity aclEntity); | ||
|
||
@Update("UPDATE acl SET status=0 WHERE id=#{id}") | ||
void deleteById(AclEntity aclEntity); | ||
|
||
@Update("UPDATE acl SET resource_type=#{resourceType} WHERE id=#{id}") | ||
void updateResourceTypeById(AclEntity aclEntity); | ||
|
||
@Select("SELECT * FROM acl") | ||
List<AclEntity> selectAll(); | ||
|
||
@Select("SELECT * FROM acl WHERE id=#{id}") | ||
AclEntity selectById(AclEntity aclEntity); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to add these indents?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will delete them.