Class RolePermissionsV2
java.lang.Object
org.keycloak.services.resources.admin.permissions.RolePermissionsV2
- All Implemented Interfaces:
RolePermissionEvaluator
,RolePermissionManagement
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AuthorizationProvider
protected final PolicyStore
protected final RealmModel
protected final ResourceStore
protected final org.keycloak.services.resources.admin.permissions.MgmtPermissions
protected final KeycloakSession
Fields inherited from interface org.keycloak.services.resources.admin.permissions.RolePermissionManagement
MAP_ROLE_CLIENT_SCOPE_SCOPE, MAP_ROLE_COMPOSITE_SCOPE, MAP_ROLE_SCOPE
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canList
(RoleContainerModel container) boolean
canManage
(RoleContainerModel container) If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canManageRealm()
returnstrue
.boolean
If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canManageRealm()
returnstrue
.boolean
canManageDefault
(RoleModel role) boolean
canMapClientScope
(RoleModel role) Returnstrue
ifClientPermissions.canManageClientsDefault()
returnstrue
.boolean
canMapComposite
(RoleModel role) Returnstrue
ifRolePermissions.canManageDefault(RoleModel)
andRolePermissions.checkAdminRoles(RoleModel)
returnstrue
.boolean
canMapRole
(RoleModel role) Is admin allowed to map this role?boolean
canView
(RoleContainerModel container) If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canViewRealm()
returnstrue
.boolean
If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canViewRealm()
returnstrue
.getPermissions
(RoleModel role) Returns the IDs of the roles that the current user can view..boolean
manageUsersPolicy
(ResourceServer server) mapRolePermission
(RoleModel role) void
requireList
(RoleContainerModel container) Throws ForbiddenException ifRolePermissionEvaluator.canList(RoleContainerModel)
returnsfalse
.void
requireManage
(RoleContainerModel container) Throws ForbiddenException ifRolePermissionEvaluator.canManage(RoleContainerModel)
returnsfalse
.void
requireManage
(RoleModel role) Throws ForbiddenException ifRolePermissionEvaluator.canManage(RoleModel)
returnsfalse
.void
Throws ForbiddenException ifRolePermissionEvaluator.canMapClientScope(RoleModel)
returnsfalse
.void
requireMapComposite
(RoleModel role) Throws ForbiddenException ifRolePermissionEvaluator.canMapComposite(RoleModel)
returnsfalse
.void
requireMapRole
(RoleModel role) Throws ForbiddenException ifRolePermissionEvaluator.canMapRole(RoleModel)
returnsfalse
.void
requireView
(RoleContainerModel container) Throws ForbiddenException ifRolePermissionEvaluator.canView(RoleContainerModel)
returnsfalse
.void
requireView
(RoleModel role) Throws ForbiddenException ifRolePermissionEvaluator.canView(RoleModel)
returnsfalse
.resourceServer
(RoleModel role) rolePolicy
(ResourceServer server, RoleModel role) void
setPermissionsEnabled
(RoleModel role, boolean enable) viewUsersPolicy
(ResourceServer server)
-
Field Details
-
session
-
realm
-
authz
-
root
protected final org.keycloak.services.resources.admin.permissions.MgmtPermissions root -
resourceStore
-
policyStore
-
-
Method Details
-
canMapClientScope
Description copied from interface:RolePermissionEvaluator
Returnstrue
ifClientPermissions.canManageClientsDefault()
returnstrue
. Or if the role is a client role andClientPermissionEvaluator.canMapClientScopeRoles(ClientModel)
returnstrue
. Or if the caller has permission toRolePermissionManagement.MAP_ROLE_CLIENT_SCOPE_SCOPE
. For V2 only: Also if the caller has a permission toRolePermissionManagement.MAP_ROLE_CLIENT_SCOPE_SCOPE
all roles.- Specified by:
canMapClientScope
in interfaceRolePermissionEvaluator
-
canMapComposite
Description copied from interface:RolePermissionEvaluator
Returnstrue
ifRolePermissions.canManageDefault(RoleModel)
andRolePermissions.checkAdminRoles(RoleModel)
returnstrue
. Or if the role is a client role andClientPermissionEvaluator.canMapCompositeRoles(ClientModel)
returnstrue
. Or if the caller has permission toRolePermissionManagement.MAP_ROLE_COMPOSITE_SCOPE
andRolePermissions.checkAdminRoles(RoleModel)
returnstrue
. For V2 only: Also if the caller has a permission toRolePermissionManagement.MAP_ROLE_COMPOSITE_SCOPE
all roles.- Specified by:
canMapComposite
in interfaceRolePermissionEvaluator
-
canMapRole
Is admin allowed to map this role?- Specified by:
canMapRole
in interfaceRolePermissionEvaluator
-
getRoleIdsWithViewPermission
Description copied from interface:RolePermissionEvaluator
Returns the IDs of the roles that the current user can view..- Specified by:
getRoleIdsWithViewPermission
in interfaceRolePermissionEvaluator
- Returns:
- Stream of IDs of roles with view permission.
-
isPermissionsEnabled
- Specified by:
isPermissionsEnabled
in interfaceRolePermissionManagement
-
setPermissionsEnabled
- Specified by:
setPermissionsEnabled
in interfaceRolePermissionManagement
-
getPermissions
- Specified by:
getPermissions
in interfaceRolePermissionManagement
-
mapRolePermission
- Specified by:
mapRolePermission
in interfaceRolePermissionManagement
-
mapCompositePermission
- Specified by:
mapCompositePermission
in interfaceRolePermissionManagement
-
mapClientScopePermission
- Specified by:
mapClientScopePermission
in interfaceRolePermissionManagement
-
resource
- Specified by:
resource
in interfaceRolePermissionManagement
-
resourceServer
- Specified by:
resourceServer
in interfaceRolePermissionManagement
-
manageUsersPolicy
- Specified by:
manageUsersPolicy
in interfaceRolePermissionManagement
-
viewUsersPolicy
- Specified by:
viewUsersPolicy
in interfaceRolePermissionManagement
-
rolePolicy
- Specified by:
rolePolicy
in interfaceRolePermissionManagement
-
requireMapRole
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canMapRole(RoleModel)
returnsfalse
.- Specified by:
requireMapRole
in interfaceRolePermissionEvaluator
-
canList
Description copied from interface:RolePermissionEvaluator
Returnstrue
ifRolePermissionEvaluator.canView(RoleContainerModel)
returnstrue
. Or if the role is a realm role, then it returnstrue
ifRealmPermissionEvaluator.canViewRealm()
returns true or if the caller has at least one of theAdminRoles.QUERY_USERS
,AdminRoles.QUERY_USERS
,AdminRoles.QUERY_CLIENTS
,AdminRoles.QUERY_REALMS
,AdminRoles.QUERY_GROUPS
roles.- Specified by:
canList
in interfaceRolePermissionEvaluator
-
requireList
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canList(RoleContainerModel)
returnsfalse
.- Specified by:
requireList
in interfaceRolePermissionEvaluator
-
canManage
Description copied from interface:RolePermissionEvaluator
If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canManageRealm()
returnstrue
. If the role is a client role, it returnstrue
ifClientPermissionEvaluator.canConfigure(ClientModel)
returnstrue
.- Specified by:
canManage
in interfaceRolePermissionEvaluator
-
requireManage
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canManage(RoleContainerModel)
returnsfalse
.- Specified by:
requireManage
in interfaceRolePermissionEvaluator
-
canView
Description copied from interface:RolePermissionEvaluator
If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canViewRealm()
returnstrue
. If the role is a client role, it returnstrue
ifClientPermissionEvaluator.canView(ClientModel)
returnstrue
.- Specified by:
canView
in interfaceRolePermissionEvaluator
-
requireView
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canView(RoleContainerModel)
returnsfalse
.- Specified by:
requireView
in interfaceRolePermissionEvaluator
-
requireMapComposite
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canMapComposite(RoleModel)
returnsfalse
.- Specified by:
requireMapComposite
in interfaceRolePermissionEvaluator
-
requireMapClientScope
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canMapClientScope(RoleModel)
returnsfalse
.- Specified by:
requireMapClientScope
in interfaceRolePermissionEvaluator
-
canManage
Description copied from interface:RolePermissionEvaluator
If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canManageRealm()
returnstrue
. If the role is a client role, it returnstrue
ifClientPermissionEvaluator.canConfigure(ClientModel)
returnstrue
.- Specified by:
canManage
in interfaceRolePermissionEvaluator
-
canManageDefault
-
requireManage
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canManage(RoleModel)
returnsfalse
.- Specified by:
requireManage
in interfaceRolePermissionEvaluator
-
canView
Description copied from interface:RolePermissionEvaluator
If the role is a realm role, it returnstrue
ifRealmPermissionEvaluator.canViewRealm()
returnstrue
. If the role is a client role, it returnstrue
ifClientPermissionEvaluator.canView(ClientModel)
returnstrue
.- Specified by:
canView
in interfaceRolePermissionEvaluator
-
requireView
Description copied from interface:RolePermissionEvaluator
Throws ForbiddenException ifRolePermissionEvaluator.canView(RoleModel)
returnsfalse
.- Specified by:
requireView
in interfaceRolePermissionEvaluator
-