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.GroupCreatedEvent, GroupModel.GroupEvent, GroupModel.GroupMemberJoinEvent, GroupModel.GroupMemberLeaveEvent, GroupModel.GroupPathChangeEvent, GroupModel.GroupRemovedEvent, GroupModel.GroupUpdatedEvent, GroupModel.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CachedGroupprotected final RealmCacheSessionprotected booleanprotected final KeycloakSessionprotected final RealmModelprotected GroupModelFields inherited from interface org.keycloak.models.GroupModel
COMPARE_BY_NAME -
Constructor Summary
ConstructorsConstructorDescriptionGroupAdapter(CachedGroup cached, RealmCacheSession cacheSession, KeycloakSession keycloakSession, RealmModel realm) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(GroupModel subGroup) Automatically calls setParent() on the subGroupvoiddeleteRoleMapping(RoleModel role) Removes the given role mapping from this object.booleanbooleangetAttributeStream(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 voidgetFirstAttribute(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.getType()voidGrants the given role to this object.booleanhasDirectRole(RoleModel role) Returnstrue, if this object is directly assigned the given role.inthashCode()booleanReturnstrueif this object is directly or indirectly assigned the given role,falseotherwise.voidprotected booleanvoidremoveAttribute(String name) voidremoveChild(GroupModel subGroup) Automatically calls setParent() on the subGroupvoidsetAttribute(String name, List<String> values) voidvoidsetParent(GroupModel group) You must also call addChild on the parent group, addChild on RealmModel if there is no parent groupvoidsetSingleAttribute(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:
getIdin interfaceGroupModel
-
getName
- Specified by:
getNamein interfaceGroupModel
-
setName
- Specified by:
setNamein interfaceGroupModel
-
setSingleAttribute
Description copied from interface:GroupModelSet single value of specified attribute. Remove all other existing values- Specified by:
setSingleAttributein interfaceGroupModel
-
setAttribute
- Specified by:
setAttributein interfaceGroupModel
-
removeAttribute
- Specified by:
removeAttributein interfaceGroupModel
-
getFirstAttribute
- Specified by:
getFirstAttributein 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:GroupModelReturns group attributes that match the given name as a stream.- Specified by:
getAttributeStreamin interfaceGroupModel- Parameters:
name-StringName 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:
getAttributesin interfaceGroupModel
-
getRealmRoleMappingsStream
Description copied from interface:RoleMapperModelReturns stream of realm roles that are directly set to this object.- Specified by:
getRealmRoleMappingsStreamin interfaceRoleMapperModel- Returns:
- Stream of
RoleModel. Never returnsnull.
-
getClientRoleMappingsStream
Description copied from interface:RoleMapperModelReturns stream of client roles that are directly set to this object for the given client.- Specified by:
getClientRoleMappingsStreamin interfaceRoleMapperModel- Parameters:
app-ClientModelClient to get the roles for.- Returns:
- Stream of
RoleModel. Never returnsnull.
-
hasDirectRole
Description copied from interface:RoleMapperModelReturnstrue, if this object is directly assigned the given role.- Specified by:
hasDirectRolein interfaceRoleMapperModel- Parameters:
role- the role- Returns:
- see description
- See Also:
-
hasRole
Description copied from interface:RoleMapperModelReturnstrueif this object is directly or indirectly assigned the given role,falseotherwise.For example,
trueis 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:
hasRolein interfaceRoleMapperModel- Returns:
- see description
- See Also:
-
grantRole
Description copied from interface:RoleMapperModelGrants the given role to this object.- Specified by:
grantRolein interfaceRoleMapperModel
-
getRoleMappingsStream
Description copied from interface:RoleMapperModelReturns stream of all role (both realm all client) that are directly set to this object.- Specified by:
getRoleMappingsStreamin interfaceRoleMapperModel- Returns:
- Stream of
RoleModel. Never returnsnull.
-
deleteRoleMapping
Description copied from interface:RoleMapperModelRemoves the given role mapping from this object.- Specified by:
deleteRoleMappingin interfaceRoleMapperModel- Parameters:
role- Role to remove
-
getParent
- Specified by:
getParentin interfaceGroupModel
-
getParentId
- Specified by:
getParentIdin interfaceGroupModel
-
getSubGroupsStream
Description copied from interface:GroupModelReturns all sub groups for the parent group as a stream. The stream is sorted by the group name.- Specified by:
getSubGroupsStreamin interfaceGroupModel- Returns:
- Stream of
GroupModel. Never returnsnull.
-
getSubGroupsStream
public Stream<GroupModel> getSubGroupsStream(String search, Integer firstResult, Integer maxResults) Description copied from interface:GroupModelReturns all sub groups for the parent group matching the fuzzy search as a stream, paginated. Stream is sorted by the group name.- Specified by:
getSubGroupsStreamin interfaceGroupModel- Parameters:
search- searched string. If empty ornullall subgroups are returned.- Returns:
- Stream of
GroupModel. Never returnsnull.
-
getSubGroupsStream
Description copied from interface:GroupModelReturns all sub groups for the parent group as a stream, paginated.- Specified by:
getSubGroupsStreamin 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:GroupModelReturns all subgroups for the parent group matching the search as a stream, paginated. Stream is sorted by the group name.- Specified by:
getSubGroupsStreamin interfaceGroupModel- Parameters:
search- search string. If empty ornullall 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:GroupModelReturns the number of groups contained beneath this group.- Specified by:
getSubGroupsCountin interfaceGroupModel- Returns:
- The number of groups beneath this group. Never returns
null.
-
setParent
Description copied from interface:GroupModelYou must also call addChild on the parent group, addChild on RealmModel if there is no parent group- Specified by:
setParentin interfaceGroupModel
-
addChild
Description copied from interface:GroupModelAutomatically calls setParent() on the subGroup- Specified by:
addChildin interfaceGroupModel
-
removeChild
Description copied from interface:GroupModelAutomatically calls setParent() on the subGroup- Specified by:
removeChildin interfaceGroupModel
-
escapeSlashesInGroupPath
public boolean escapeSlashesInGroupPath()- Specified by:
escapeSlashesInGroupPathin interfaceGroupModel
-
getType
- Specified by:
getTypein interfaceGroupModel
-