KEYCLOAK-5194

This commit is contained in:
Bill Burke 2017-07-14 18:29:48 -04:00
parent f68754290f
commit a7940c6ffa
4 changed files with 8 additions and 8 deletions

View file

@ -562,9 +562,9 @@ public class ClientResource {
@NoCache @NoCache
public ManagementPermissionReference setManagementPermissionsEnabled(ManagementPermissionReference ref) { public ManagementPermissionReference setManagementPermissionsEnabled(ManagementPermissionReference ref) {
auth.clients().requireManage(client); auth.clients().requireManage(client);
if (ref.isEnabled()) { AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
AdminPermissionManagement permissions = AdminPermissions.management(session, realm); permissions.clients().setPermissionsEnabled(client, ref.isEnabled());
permissions.clients().setPermissionsEnabled(client, ref.isEnabled()); if (ref.isEnabled()) {
return toMgmtRef(client, permissions); return toMgmtRef(client, permissions);
} else { } else {
return new ManagementPermissionReference(); return new ManagementPermissionReference();

View file

@ -263,9 +263,9 @@ public class GroupResource {
@NoCache @NoCache
public ManagementPermissionReference setManagementPermissionsEnabled(ManagementPermissionReference ref) { public ManagementPermissionReference setManagementPermissionsEnabled(ManagementPermissionReference ref) {
auth.groups().requireManage(group); auth.groups().requireManage(group);
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
permissions.groups().setPermissionsEnabled(group, ref.isEnabled());
if (ref.isEnabled()) { if (ref.isEnabled()) {
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
permissions.groups().setPermissionsEnabled(group, ref.isEnabled());
return toMgmtRef(group, permissions); return toMgmtRef(group, permissions);
} else { } else {
return new ManagementPermissionReference(); return new ManagementPermissionReference();

View file

@ -364,9 +364,9 @@ public class RoleContainerResource extends RoleResource {
throw new NotFoundException("Could not find role"); throw new NotFoundException("Could not find role");
} }
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
permissions.roles().setPermissionsEnabled(role, ref.isEnabled());
if (ref.isEnabled()) { if (ref.isEnabled()) {
AdminPermissionManagement permissions = AdminPermissions.management(session, realm);
permissions.roles().setPermissionsEnabled(role, ref.isEnabled());
return RoleByIdResource.toMgmtRef(role, permissions); return RoleByIdResource.toMgmtRef(role, permissions);
} else { } else {
return new ManagementPermissionReference(); return new ManagementPermissionReference();

View file

@ -50,7 +50,7 @@
<ul class="nav nav-pills nav-stacked"> <ul class="nav nav-pills nav-stacked">
<li data-ng-show="access.queryGroups" data-ng-class="(path[2] == 'groups' <li data-ng-show="access.queryGroups" data-ng-class="(path[2] == 'groups'
|| path[2] == 'default-groups') && 'active'"><a href="#/realms/{{realm.realm}}/groups"><span class="pficon pficon-users"></span> {{:: 'groups' | translate}}</a></li> || path[2] == 'default-groups') && 'active'"><a href="#/realms/{{realm.realm}}/groups"><span class="pficon pficon-users"></span> {{:: 'groups' | translate}}</a></li>
<li data-ng-show="access.queryUsers" data-ng-class="(path[2] == 'users') && 'active'"><a href="#/realms/{{realm.realm}}/users"><span class="pficon pficon-user"></span> {{:: 'users' | translate}}</a></li> <li data-ng-show="access.queryUsers" data-ng-class="(path[2] == 'users' || path[2] == 'users-permissions') && 'active'"><a href="#/realms/{{realm.realm}}/users"><span class="pficon pficon-user"></span> {{:: 'users' | translate}}</a></li>
<li data-ng-show="access.viewRealm" data-ng-class="(path[2] == 'sessions') && 'active'"><a href="#/realms/{{realm.realm}}/sessions/realm"><i class="fa fa-clock-o"></i> {{:: 'sessions' | translate}}</a></li> <li data-ng-show="access.viewRealm" data-ng-class="(path[2] == 'sessions') && 'active'"><a href="#/realms/{{realm.realm}}/sessions/realm"><i class="fa fa-clock-o"></i> {{:: 'sessions' | translate}}</a></li>
<li data-ng-show="access.viewEvents" data-ng-class="(path[2] == 'events' <li data-ng-show="access.viewEvents" data-ng-class="(path[2] == 'events'
|| path[2] == 'events-settings' || path[2] == 'events-settings'