org.keycloak.storage.ldap.mappers.membership.role

## Class RoleLDAPStorageMapper.LDAPRoleMappingsUserDelegate

- java.lang.Object
- - org.keycloak.models.utils.UserModelDelegate
  - - org.keycloak.storage.ldap.mappers.membership.role.RoleLDAPStorageMapper.LDAPRoleMappingsUserDelegate

- All Implemented Interfaces:
    RoleMapperModel, RoleMapperModel.Streams, UserModel, UserModel.Streams
  Enclosing class:
    RoleLDAPStorageMapper

      public class RoleLDAPStorageMapper.LDAPRoleMappingsUserDelegate
      extends UserModelDelegate

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.UserModel

      `UserModel.RequiredAction, UserModel.Streams, UserModel.UserRemovedEvent`

  - ### Field Summary

    - ### Fields inherited from class org.keycloak.models.utils.UserModelDelegate

      `delegate`

    - ### Fields inherited from interface org.keycloak.models.UserModel

      `COMPARE_BY_USERNAME, EMAIL, EMAIL_VERIFIED, ENABLED, EXACT, FIRST_NAME, GROUPS, IDP_ALIAS, IDP_USER_ID, INCLUDE_SERVICE_ACCOUNT, LAST_NAME, LOCALE, SEARCH, USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LDAPRoleMappingsUserDelegate(RealmModel realm, UserModel user, LDAPObject ldapUser)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `deleteRoleMapping(RoleModel role)` Removes the given role mapping from this object.
    `Stream<RoleModel>` | `getClientRoleMappingsStream(ClientModel client)` Returns stream of client roles that are directly set to this object for the given client.
    `protected Stream<RoleModel>` | `getLDAPRoleMappingsConverted()`
    `Stream<RoleModel>` | `getRealmRoleMappingsStream()` Returns stream of realm roles that are directly set to this object.
    `Stream<RoleModel>` | `getRoleMappingsStream()` Returns stream of all role (both realm all client) that are directly set to this object.
    `void` | `grantRole(RoleModel role)` Grants the given role to this object.
    `boolean` | `hasRole(RoleModel role)` Returns `true` if this object is directly or indirectly assigned the given role, `false` otherwise.

    - ### Methods inherited from class org.keycloak.models.utils.UserModelDelegate

      `addRequiredAction, addRequiredAction, equals, getAttributes, getAttributeStream, getCreatedTimestamp, getDelegate, getEmail, getFederationLink, getFirstAttribute, getFirstName, getGroupsStream, getId, getLastName, getRequiredActionsStream, getServiceAccountClientLink, getUsername, hashCode, isEmailVerified, isEnabled, isMemberOf, joinGroup, leaveGroup, removeAttribute, removeRequiredAction, removeRequiredAction, setAttribute, setCreatedTimestamp, setEmail, setEmailVerified, setEnabled, setFederationLink, setFirstName, setLastName, setServiceAccountClientLink, setSingleAttribute, setUsername`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.keycloak.models.UserModel.Streams

      `getAttribute, getGroups, getRequiredActions`

    - ### Methods inherited from interface org.keycloak.models.UserModel

      `getGroups, getGroups, getGroupsCount, getGroupsCountByNameContaining, getGroupsStream`

    - ### Methods inherited from interface org.keycloak.models.RoleMapperModel.Streams

      `getClientRoleMappings, getRealmRoleMappings, getRoleMappings`

- - ### Constructor Detail

    - #### LDAPRoleMappingsUserDelegate

          public LDAPRoleMappingsUserDelegate(RealmModel realm,
                                              UserModel user,
                                              LDAPObject ldapUser)

  - ### Method Detail

    - #### getRealmRoleMappingsStream

          public Stream<RoleModel> getRealmRoleMappingsStream()

      Description copied from interface: `RoleMapperModel`
      Returns stream of realm roles that are directly set to this object.
      Specified by:
        `getRealmRoleMappingsStream` in interface `RoleMapperModel`
      Specified by:
        `getRealmRoleMappingsStream` in interface `RoleMapperModel.Streams`
      Overrides:
        `getRealmRoleMappingsStream` in class `UserModelDelegate`
      Returns:
        stream of `RoleModel`

    - #### getClientRoleMappingsStream

          public Stream<RoleModel> getClientRoleMappingsStream(ClientModel client)

      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 interface `RoleMapperModel`
      Specified by:
        `getClientRoleMappingsStream` in interface `RoleMapperModel.Streams`
      Overrides:
        `getClientRoleMappingsStream` in class `UserModelDelegate`
      Parameters:
        `client` - Client to get the roles for
      Returns:
        stream of `RoleModel`

    - #### hasRole

          public boolean hasRole(RoleModel role)

      Description copied from interface: `RoleMapperModel`
      Returns `true` 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 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 interface `RoleMapperModel`
      Overrides:
        `hasRole` in class `UserModelDelegate`
      Returns:
        see description

    - #### grantRole

          public void grantRole(RoleModel role)

      Description copied from interface: `RoleMapperModel`
      Grants the given role to this object.
      Specified by:
        `grantRole` in interface `RoleMapperModel`
      Overrides:
        `grantRole` in class `UserModelDelegate`

    - #### getRoleMappingsStream

          public Stream<RoleModel> 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 interface `RoleMapperModel`
      Specified by:
        `getRoleMappingsStream` in interface `RoleMapperModel.Streams`
      Overrides:
        `getRoleMappingsStream` in class `UserModelDelegate`
      Returns:
        stream of `RoleModel`

    - #### getLDAPRoleMappingsConverted

          protected Stream<RoleModel> getLDAPRoleMappingsConverted()

    - #### deleteRoleMapping

          public void deleteRoleMapping(RoleModel role)

      Description copied from interface: `RoleMapperModel`
      Removes the given role mapping from this object.
      Specified by:
        `deleteRoleMapping` in interface `RoleMapperModel`
      Overrides:
        `deleteRoleMapping` in class `UserModelDelegate`
      Parameters:
        `role` - Role to remove

Copyright © 2021 JBoss by Red Hat. All rights reserved.