Search in sources :

Example 1 with NamespaceEnvRolesAssignedUsers

use of com.ctrip.framework.apollo.portal.entity.vo.NamespaceEnvRolesAssignedUsers in project apollo by ctripcorp.

the class PermissionController method getNamespaceEnvRoles.

@GetMapping("/apps/{appId}/envs/{env}/namespaces/{namespaceName}/role_users")
public NamespaceEnvRolesAssignedUsers getNamespaceEnvRoles(@PathVariable String appId, @PathVariable String env, @PathVariable String namespaceName) {
    // validate env parameter
    if (Env.UNKNOWN == Env.transformEnv(env)) {
        throw new BadRequestException("env is illegal");
    }
    NamespaceEnvRolesAssignedUsers assignedUsers = new NamespaceEnvRolesAssignedUsers();
    assignedUsers.setNamespaceName(namespaceName);
    assignedUsers.setAppId(appId);
    assignedUsers.setEnv(Env.valueOf(env));
    Set<UserInfo> releaseNamespaceUsers = rolePermissionService.queryUsersWithRole(RoleUtils.buildReleaseNamespaceRoleName(appId, namespaceName, env));
    assignedUsers.setReleaseRoleUsers(releaseNamespaceUsers);
    Set<UserInfo> modifyNamespaceUsers = rolePermissionService.queryUsersWithRole(RoleUtils.buildModifyNamespaceRoleName(appId, namespaceName, env));
    assignedUsers.setModifyRoleUsers(modifyNamespaceUsers);
    return assignedUsers;
}
Also used : NamespaceEnvRolesAssignedUsers(com.ctrip.framework.apollo.portal.entity.vo.NamespaceEnvRolesAssignedUsers) BadRequestException(com.ctrip.framework.apollo.common.exception.BadRequestException) UserInfo(com.ctrip.framework.apollo.portal.entity.bo.UserInfo)

Aggregations

BadRequestException (com.ctrip.framework.apollo.common.exception.BadRequestException)1 UserInfo (com.ctrip.framework.apollo.portal.entity.bo.UserInfo)1 NamespaceEnvRolesAssignedUsers (com.ctrip.framework.apollo.portal.entity.vo.NamespaceEnvRolesAssignedUsers)1