Class GroupAdapter
java.lang.Object
org.keycloak.models.cache.infinispan.GroupAdapter
- All Implemented Interfaces:
GroupModel
,RoleMapperModel
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.keycloak.models.GroupModel
GroupModel.GroupPathChangeEvent, GroupModel.GroupRemovedEvent
-
Field Summary
Modifier and TypeFieldDescriptionprotected final CachedGroup
protected final RealmCacheSession
protected boolean
protected final KeycloakSession
protected final RealmModel
protected GroupModel
Fields inherited from interface org.keycloak.models.GroupModel
COMPARE_BY_NAME
-
Constructor Summary
ConstructorDescriptionGroupAdapter
(CachedGroup cached, RealmCacheSession cacheSession, KeycloakSession keycloakSession, RealmModel realm) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(GroupModel subGroup) Automatically calls setParent() on the subGroupvoid
deleteRoleMapping
(RoleModel role) Removes the given role mapping from this object.boolean
getAttributeStream
(String name) Returns group attributes that match the given name as a stream.Returns stream of client roles that are directly set to this object for the given client.protected void
getFirstAttribute
(String name) getId()
getName()
Returns stream of realm roles that are directly set to this object.Returns stream of all role (both realm all client) that are directly set to this object.Returns the number of groups contained beneath this group.Returns all sub groups for the parent group as a stream.getSubGroupsStream
(Integer firstResult, Integer maxResults) Returns all sub groups for the parent group as a stream, paginated.getSubGroupsStream
(String search, Boolean exact, Integer firstResult, Integer maxResults) Returns all subgroups for the parent group matching the search as a stream, paginated.getSubGroupsStream
(String search, Integer firstResult, Integer maxResults) Returns all sub groups for the parent group matching the fuzzy search as a stream, paginated.void
Grants the given role to this object.boolean
hasDirectRole
(RoleModel role) Returnstrue
, if this object is directly assigned the given role.int
hashCode()
boolean
Returnstrue
if this object is directly or indirectly assigned the given role,false
otherwise.void
protected boolean
void
removeAttribute
(String name) void
removeChild
(GroupModel subGroup) Automatically calls setParent() on the subGroupvoid
setAttribute
(String name, List<String> values) void
void
setParent
(GroupModel group) You must also call addChild on the parent group, addChild on RealmModel if there is no parent groupvoid
setSingleAttribute
(String name, String value) Set single value of specified attribute.
-
Field Details
-
cached
-
cacheSession
-
keycloakSession
-
realm
-
updated
-
invalidated
protected volatile boolean invalidated
-
-
Constructor Details
-
GroupAdapter
public GroupAdapter(CachedGroup cached, RealmCacheSession cacheSession, KeycloakSession keycloakSession, RealmModel realm)
-
-
Method Details
-
getDelegateForUpdate
protected void getDelegateForUpdate() -
invalidate
public void invalidate() -
isUpdated
protected boolean isUpdated() -
equals
-
hashCode
public int hashCode() -
getId
- Specified by:
getId
in interfaceGroupModel
-
getName
- Specified by:
getName
in interfaceGroupModel
-
setName
- Specified by:
setName
in interfaceGroupModel
-
setSingleAttribute
Description copied from interface:GroupModel
Set single value of specified attribute. Remove all other existing values- Specified by:
setSingleAttribute
in interfaceGroupModel
-
setAttribute
- Specified by:
setAttribute
in interfaceGroupModel
-
removeAttribute
- Specified by:
removeAttribute
in interfaceGroupModel
-
getFirstAttribute
- Specified by:
getFirstAttribute
in interfaceGroupModel
- Returns:
- null if there is not any value of specified attribute or first value otherwise. Don't throw exception if there are more values of the attribute
-
getAttributeStream
Description copied from interface:GroupModel
Returns group attributes that match the given name as a stream.- Specified by:
getAttributeStream
in interfaceGroupModel
- Parameters:
name
-String
Name of the attribute to be used as a filter.- Returns:
- Stream of all attribute values or empty stream if there are not any values. Never return
null
.
-
getAttributes
- Specified by:
getAttributes
in interfaceGroupModel
-
getRealmRoleMappingsStream
Description copied from interface:RoleMapperModel
Returns stream of realm roles that are directly set to this object.- Specified by:
getRealmRoleMappingsStream
in interfaceRoleMapperModel
- Returns:
- Stream of
RoleModel
. Never returnsnull
.
-
getClientRoleMappingsStream
Description copied from interface:RoleMapperModel
Returns stream of client roles that are directly set to this object for the given client.- Specified by:
getClientRoleMappingsStream
in interfaceRoleMapperModel
- Parameters:
app
-ClientModel
Client to get the roles for.- Returns:
- Stream of
RoleModel
. Never returnsnull
.
-
hasDirectRole
Description copied from interface:RoleMapperModel
Returnstrue
, if this object is directly assigned the given role.- Specified by:
hasDirectRole
in interfaceRoleMapperModel
- Parameters:
role
- the role- Returns:
- see description
- See Also:
-
hasRole
Description copied from interface:RoleMapperModel
Returnstrue
if this object is directly or indirectly assigned the given role,false
otherwise.For example,
true
is returned for hasRole(R) if:- R is directly assigned to this object
- R is indirectly assigned to this object via composites
- R is not assigned to this object but this object belongs to a group G which is assigned the role R
- R is not assigned to this object but this object belongs to a group G, and G belongs to group H which is assigned the role R
- Specified by:
hasRole
in interfaceRoleMapperModel
- Returns:
- see description
- See Also:
-
grantRole
Description copied from interface:RoleMapperModel
Grants the given role to this object.- Specified by:
grantRole
in interfaceRoleMapperModel
-
getRoleMappingsStream
Description copied from interface:RoleMapperModel
Returns stream of all role (both realm all client) that are directly set to this object.- Specified by:
getRoleMappingsStream
in interfaceRoleMapperModel
- Returns:
- Stream of
RoleModel
. Never returnsnull
.
-
deleteRoleMapping
Description copied from interface:RoleMapperModel
Removes the given role mapping from this object.- Specified by:
deleteRoleMapping
in interfaceRoleMapperModel
- Parameters:
role
- Role to remove
-
getParent
- Specified by:
getParent
in interfaceGroupModel
-
getParentId
- Specified by:
getParentId
in interfaceGroupModel
-
getSubGroupsStream
Description copied from interface:GroupModel
Returns all sub groups for the parent group as a stream. The stream is sorted by the group name.- Specified by:
getSubGroupsStream
in interfaceGroupModel
- Returns:
- Stream of
GroupModel
. Never returnsnull
.
-
getSubGroupsStream
public Stream<GroupModel> getSubGroupsStream(String search, Integer firstResult, Integer maxResults) Description copied from interface:GroupModel
Returns all sub groups for the parent group matching the fuzzy search as a stream, paginated. Stream is sorted by the group name.- Specified by:
getSubGroupsStream
in interfaceGroupModel
- Parameters:
search
- searched string. If empty ornull
all subgroups are returned.- Returns:
- Stream of
GroupModel
. Never returnsnull
.
-
getSubGroupsStream
Description copied from interface:GroupModel
Returns all sub groups for the parent group as a stream, paginated.- Specified by:
getSubGroupsStream
in interfaceGroupModel
- Parameters:
firstResult
- First result to return. Ignored if negative ornull
.maxResults
- Maximum number of results to return. Ignored if negative ornull
.- Returns:
-
getSubGroupsStream
public Stream<GroupModel> getSubGroupsStream(String search, Boolean exact, Integer firstResult, Integer maxResults) Description copied from interface:GroupModel
Returns all subgroups for the parent group matching the search as a stream, paginated. Stream is sorted by the group name.- Specified by:
getSubGroupsStream
in interfaceGroupModel
- Parameters:
search
- search string. If empty ornull
all subgroups are returned.exact
- toggles fuzzy searchingfirstResult
- First result to return. Ignored if negative ornull
.maxResults
- Maximum number of results to return. Ignored if negative ornull
.- Returns:
- Stream of
GroupModel
. Never returnsnull
.
-
getSubGroupsCount
Description copied from interface:GroupModel
Returns the number of groups contained beneath this group.- Specified by:
getSubGroupsCount
in interfaceGroupModel
- Returns:
- The number of groups beneath this group. Never returns
null
.
-
setParent
Description copied from interface:GroupModel
You must also call addChild on the parent group, addChild on RealmModel if there is no parent group- Specified by:
setParent
in interfaceGroupModel
-
addChild
Description copied from interface:GroupModel
Automatically calls setParent() on the subGroup- Specified by:
addChild
in interfaceGroupModel
-
removeChild
Description copied from interface:GroupModel
Automatically calls setParent() on the subGroup- Specified by:
removeChild
in interfaceGroupModel
-