类 RoleControllerV3
java.lang.Object
com.alibaba.nacos.plugin.auth.impl.controller.v3.RoleControllerV3
Controller for handling HTTP requests related to role operations.
- 作者:
- zhangyukun on:2024/8/16
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明com.alibaba.nacos.api.model.v2.Result<String> createRole(String role, String username) Add a role to a usercom.alibaba.nacos.api.model.v2.Result<String> deleteRole(String role, String username) Delete a role.com.alibaba.nacos.api.model.v2.Result<com.alibaba.nacos.api.model.Page<RoleInfo>> getRoleList(int pageNo, int pageSize, String username, String role, String search) Get roles list with the option for accurate or fuzzy search.getRoleListByRoleName(String role) Fuzzy matching role name .
-
字段详细资料
-
roleService
-
SEARCH_TYPE_BLUR
- 另请参阅:
-
-
构造器详细资料
-
RoleControllerV3
-
-
方法详细资料
-
createRole
@PostMapping public com.alibaba.nacos.api.model.v2.Result<String> createRole(@RequestParam String role, @RequestParam String username) Add a role to a userThis method is used for 2 functions: 1. create a role and bind it to GLOBAL_ADMIN. 2. bind a role to an user.
- 参数:
role- role nameusername- username- 返回:
- Code 200 and message 'add role ok!'
-
deleteRole
@DeleteMapping public com.alibaba.nacos.api.model.v2.Result<String> deleteRole(@RequestParam String role, @RequestParam(name="username",defaultValue="") String username) Delete a role. If no username is specified, all users under this role are deleted.- 参数:
role- roleusername- username- 返回:
- ok if succeed
-
getRoleList
@GetMapping("/list") public com.alibaba.nacos.api.model.v2.Result<com.alibaba.nacos.api.model.Page<RoleInfo>> getRoleList(@RequestParam int pageNo, @RequestParam int pageSize, @RequestParam(name="username",defaultValue="") String username, @RequestParam(name="role",defaultValue="") String role, @RequestParam(name="search",required=false,defaultValue="accurate") String search) Get roles list with the option for accurate or fuzzy search.- 参数:
pageNo- number index of pagepageSize- page sizeusername- optional, username of userrole- optional rolesearch- the type of search: "accurate" for exact match, "blur" for fuzzy match- 返回:
- role list
-
getRoleListByRoleName
@GetMapping("/search") public com.alibaba.nacos.api.model.v2.Result<List<String>> getRoleListByRoleName(@RequestParam String role) Fuzzy matching role name .- 参数:
role- role id- 返回:
- role list
-