use of org.keycloak.representations.idm.ManagementPermissionReference in project keycloak by keycloak.
the class GroupResource method toMgmtRef.
public static ManagementPermissionReference toMgmtRef(GroupModel group, AdminPermissionManagement permissions) {
ManagementPermissionReference ref = new ManagementPermissionReference();
ref.setEnabled(true);
ref.setResource(permissions.groups().resource(group).getId());
ref.setScopePermissions(permissions.groups().getPermissions(group));
return ref;
}
use of org.keycloak.representations.idm.ManagementPermissionReference in project keycloak by keycloak.
the class ClientResource method setManagementPermissionsEnabled.
/**
* Return object stating whether client Authorization permissions have been initialized or not and a reference
*
* @return initialized manage permissions reference
*/
@Path("management/permissions")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@NoCache
public ManagementPermissionReference setManagementPermissionsEnabled(ManagementPermissionReference ref) {
auth.clients().requireManage(client);
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
permissions.clients().setPermissionsEnabled(client, ref.isEnabled());
if (ref.isEnabled()) {
return toMgmtRef(client, permissions);
} else {
return new ManagementPermissionReference();
}
}
Aggregations