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, RealmAuth auth)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addComposites(String id, List<RoleRepresentation> roles)` Make this role a composite role by associating some child roles to it.
    `void` | `deleteComposites(String id, List<RoleRepresentation> roles)` Remove the listed set of roles from this role's composite
    `void` | `deleteRole(String id)` Delete this role
    `Set<RoleRepresentation>` | `getApplicationRoleComposites(String id, String appName)` Return a set of application-level roles for a specific app that are in the role's composite
    `Set<RoleRepresentation>` | `getRealmRoleComposites(String id)` Return a set of realm-level roles that are in the role's composite
    `RoleRepresentation` | `getRole(String id)` Get a specific role's representation
    `Set<RoleRepresentation>` | `getRoleComposites(String id)` If this role is a composite, return a set of its children
    `protected RoleModel` | `getRoleModel(String id)`
    `void` | `updateRole(String id, RoleRepresentation rep)` Update this role

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

      `addComposites, deleteComposites, deleteRole, getApplicationRoleComposites, getRealmRoleComposites, getRole, getRoleComposites, 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,
                          RealmAuth auth)

  - ### 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 this 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 this 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 this role a composite role by associating some child roles to it.
      Parameters:
        `id` -
        `roles` -

    - #### getRoleComposites

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

      If this role is a composite, return a set of its children
      Parameters:
        `id` -
      Returns:

    - #### getRealmRoleComposites

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

      Return a set of realm-level roles that are in the role's composite
      Parameters:
        `id` -
      Returns:

    - #### getApplicationRoleComposites

          @Path(value="{role-id}/composites/applications/{app}")
          @GET
          @Produces(value="application/json")
          public Set<RoleRepresentation> getApplicationRoleComposites(@PathParam(value="role-id")
                                                                               String id,
                                                                               @PathParam(value="app")
                                                                               String appName)

      Return a set of application-level roles for a specific app that are in the role's composite
      Parameters:
        `id` -
        `appName` -
      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 the listed set of roles from this role's composite
      Parameters:
        `id` -
        `roles` -

Copyright © 2014. All Rights Reserved.