org.keycloak.services.resources.admin

## Class RoleByIdResource

- java.lang.Object
- - org.keycloak.services.resources.admin.RoleResource
  - - org.keycloak.services.resources.admin.RoleByIdResource

-     public class RoleByIdResource
      extends RoleResource

  Sometimes its easier to just interact with roles by their ID instead of container/role-name
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.jboss.logging.Logger` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RoleByIdResource(RealmModel realm, AdminPermissionEvaluator auth, AdminEventBuilder adminEvent)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addComposites(String id, List<RoleRepresentation> roles)` Make the role a composite role by associating some child roles
    `void` | `deleteComposites(String id, List<RoleRepresentation> roles)` Remove a set of roles from the role's composite
    `void` | `deleteRole(String id)` Delete the role
    `Stream<RoleRepresentation>` | `getClientRoleComposites(String id, String clientUuid)` Get client-level roles for the client that are in the role's composite
    `ManagementPermissionReference` | `getManagementPermissions(String id)` Return object stating whether role Authoirzation permissions have been initialized or not and a reference
    `Stream<RoleRepresentation>` | `getRealmRoleComposites(String id)` Get realm-level roles that are in the role's composite
    `RoleRepresentation` | `getRole(String id)` Get a specific role's representation
    `Stream<RoleRepresentation>` | `getRoleComposites(String id)` Get role's children Returns a set of role's children provided the role is a composite.
    `protected RoleModel` | `getRoleModel(String id)`
    `ManagementPermissionReference` | `setManagementPermissionsEnabled(String id, ManagementPermissionReference ref)` Return object stating whether role Authoirzation permissions have been initialized or not and a reference
    `static ManagementPermissionReference` | `toMgmtRef(RoleModel role, AdminPermissionManagement permissions)`
    `void` | `updateRole(String id, RoleRepresentation rep)` Update the role

    - ### Methods inherited from class org.keycloak.services.resources.admin.RoleResource

      `addComposites, deleteComposites, deleteRole, getClientRoleComposites, getRealmRoleComposites, getRole, updateRole`

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

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

- - ### Field Detail

    - #### logger

          protected static final org.jboss.logging.Logger logger

  - ### Constructor Detail

    - #### RoleByIdResource

          public RoleByIdResource(RealmModel realm,
                                  AdminPermissionEvaluator auth,
                                  AdminEventBuilder adminEvent)

  - ### Method Detail

    - #### getRole

          @Path(value="{role-id}")
           @GET
           @Produces(value="application/json")
          public RoleRepresentation getRole(@PathParam(value="role-id")
                                                                                                                String id)

      Get a specific role's representation
      Parameters:
        `id` - id of role
      Returns:

    - #### getRoleModel

          protected RoleModel getRoleModel(String id)

    - #### deleteRole

          @Path(value="{role-id}")
           @DELETE
          public void deleteRole(@PathParam(value="role-id")
                                                                   String id)

      Delete the role
      Parameters:
        `id` - id of role

    - #### updateRole

          @Path(value="{role-id}")
           @PUT
           @Consumes(value="application/json")
          public void updateRole(@PathParam(value="role-id")
                                                                                                     String id,
                                                                                                     RoleRepresentation rep)

      Update the role
      Parameters:
        `id` - id of role
        `rep` -

    - #### addComposites

          @Path(value="{role-id}/composites")
           @POST
           @Consumes(value="application/json")
          public void addComposites(@PathParam(value="role-id")
                                                                                                                    String id,
                                                                                                                    List<RoleRepresentation> roles)

      Make the role a composite role by associating some child roles
      Parameters:
        `id` -
        `roles` -

    - #### getRoleComposites

          @Path(value="{role-id}/composites")
           @GET
           @Produces(value="application/json")
          public Stream<RoleRepresentation> getRoleComposites(@PathParam(value="role-id")
                                                                                                                                             String id)

      Get role's children Returns a set of role's children provided the role is a composite.
      Parameters:
        `id` -
      Returns:

    - #### getRealmRoleComposites

          @Path(value="{role-id}/composites/realm")
           @GET
           @Produces(value="application/json")
          public Stream<RoleRepresentation> getRealmRoleComposites(@PathParam(value="role-id")
                                                                                                                                                        String id)

      Get realm-level roles that are in the role's composite
      Parameters:
        `id` -
      Returns:

    - #### getClientRoleComposites

          @Path(value="{role-id}/composites/clients/{clientUuid}")
           @GET
           @Produces(value="application/json")
          public Stream<RoleRepresentation> getClientRoleComposites(@PathParam(value="role-id")
                                                                                                                                                                        String id,
                                                                                                                                                                        @PathParam(value="clientUuid")
                                                                                                                                                                        String clientUuid)

      Get client-level roles for the client that are in the role's composite
      Parameters:
        `id` -
        `clientUuid` -
      Returns:

    - #### deleteComposites

          @Path(value="{role-id}/composites")
           @DELETE
           @Consumes(value="application/json")
          public void deleteComposites(@PathParam(value="role-id")
                                                                                                                         String id,
                                                                                                                         List<RoleRepresentation> roles)

      Remove a set of roles from the role's composite
      Parameters:
        `id` - Role id
        `roles` - A set of roles to be removed

    - #### getManagementPermissions

          @Path(value="{role-id}/management/permissions")
           @GET
           @Produces(value="application/json")
          public ManagementPermissionReference getManagementPermissions(@PathParam(value="role-id")
                                                                                                                                                                   String id)

      Return object stating whether role Authoirzation permissions have been initialized or not and a reference
      Parameters:
        `id` -
      Returns:

    - #### toMgmtRef

          public static ManagementPermissionReference toMgmtRef(RoleModel role,
                                                                AdminPermissionManagement permissions)

    - #### setManagementPermissionsEnabled

          @Path(value="{role-id}/management/permissions")
           @PUT
           @Produces(value="application/json")
           @Consumes(value="application/json")
          public ManagementPermissionReference setManagementPermissionsEnabled(@PathParam(value="role-id")
                                                                                                                                                                                                               String id,
                                                                                                                                                                                                               ManagementPermissionReference ref)

      Return object stating whether role Authoirzation permissions have been initialized or not and a reference
      Parameters:
        `id` -
      Returns:
        initialized manage permissions reference

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