role and Users finished UI work

This commit is contained in:
Bill Burke 2017-05-10 15:25:04 -04:00
parent 46ec12c41c
commit bfb4395b28
7 changed files with 25 additions and 19 deletions

View file

@ -220,7 +220,7 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest {
} }
//@Test @Test
public void testUI() throws Exception { public void testUI() throws Exception {
testingClient.server().run(FineGrainAdminUnitTest::setupPolices); testingClient.server().run(FineGrainAdminUnitTest::setupPolices);
testingClient.server().run(FineGrainAdminUnitTest::setupUsers); testingClient.server().run(FineGrainAdminUnitTest::setupUsers);

View file

@ -1297,11 +1297,12 @@ create-ldap-mapper=Create LDAP mapper
map-role-mgmt-scope-description=Policies that decide if an admin can map this role to a user or group map-role-mgmt-scope-description=Policies that decide if an admin can map this role to a user or group
manage-mgmt-scope-description=Policies that decide if an admin can manage this resource or resources manage-mgmt-scope-description=Policies that decide if an admin can manage this resource or resources
permissions-enabled-role=Permissions Enabled permissions-enabled-role=Permissions Enabled
permissions-enabled-role.tooltip=Whether or not to enable fine grain permissions for this role. Disabling will delete all current permissions that have been set up. permissions-enabled-role.tooltip=Whether or not to enable fine grain permissions for managing this role. Disabling will delete all current permissions that have been set up.
manage-permissions-role.tooltip=Fine grain permissions for managing roles. For example, you can define different policies for who is allowed to map a role. manage-permissions-role.tooltip=Fine grain permissions for managing roles. For example, you can define different policies for who is allowed to map a role.
lookup=Lookup lookup=Lookup
manage-permissions-users.tooltip=Fine grain permssions for managing all users in realm. You can define different policies for who is allowed to manage users in the realm. manage-permissions-users.tooltip=Fine grain permssions for managing all users in realm. You can define different policies for who is allowed to manage users in the realm.
permissions-enabled-users=Permissions Enabled
permissions-enabled-users.tooltip=Whether or not to enable fine grain permissions for managing users. Disabling will delete all current permissions that have been set up.

View file

@ -2376,6 +2376,15 @@ module.directive('kcTabsUser', function () {
} }
}); });
module.directive('kcTabsUsers', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-users.html'
}
});
module.directive('kcTabsGroup', function () { module.directive('kcTabsGroup', function () {
return { return {
scope: true, scope: true,

View file

@ -2367,9 +2367,7 @@ module.controller('RealmRolePermissionsCtrl', function($scope, $http, $route, $l
}); });
$scope.setEnabled = function() { $scope.setEnabled = function() {
var param = { enabled: $scope.permissions.enabled}; var param = { enabled: $scope.permissions.enabled};
RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param, function(data) { $scope.permissions= RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param);
$scope.permissions = data;
})
}; };
@ -2384,9 +2382,7 @@ module.controller('ClientRolePermissionsCtrl', function($scope, $http, $route, $
}); });
$scope.setEnabled = function() { $scope.setEnabled = function() {
var param = { enabled: $scope.permissions.enabled}; var param = { enabled: $scope.permissions.enabled};
RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param, function(data) { $scope.permissions = RoleManagementPermissions.update({realm: realm.realm, role:role.id}, param);
$scope.permissions = data;
})
}; };
@ -2395,17 +2391,16 @@ module.controller('ClientRolePermissionsCtrl', function($scope, $http, $route, $
module.controller('UsersPermissionsCtrl', function($scope, $http, $route, $location, realm, UsersManagementPermissions, Client, Notifications) { module.controller('UsersPermissionsCtrl', function($scope, $http, $route, $location, realm, UsersManagementPermissions, Client, Notifications) {
console.log('UsersPermissionsCtrl'); console.log('UsersPermissionsCtrl');
$scope.realm = realm; $scope.realm = realm;
UsersManagementPermissions.get({realm: realm.realm, role: role.id}, function(data) { UsersManagementPermissions.get({realm: realm.realm}, function(data) {
$scope.permissions = data; $scope.permissions = data;
}); });
Client.query({realm: realm.realm, clientId: 'realm-management'}, function(data) { Client.query({realm: realm.realm, clientId: 'realm-management'}, function(data) {
$scope.realmManagementClientId = data[0].id; $scope.realmManagementClientId = data[0].id;
}); });
$scope.setEnabled = function() { $scope.changeIt = function() {
console.log('before permissions.enabled=' + $scope.permissions.enabled);
var param = { enabled: $scope.permissions.enabled}; var param = { enabled: $scope.permissions.enabled};
UsersManagementPermissions.update({realm: realm.realm, role:role.id}, param, function(data) { $scope.permissions = UsersManagementPermissions.update({realm: realm.realm}, param);
$scope.permissions = data;
})
}; };

View file

@ -1387,6 +1387,7 @@ module.controller('ClientScopeMappingCtrl', function($scope, $http, realm, clien
} }
$scope.changeFlag = function() { $scope.changeFlag = function() {
console.log('changeFlag');
Client.update({ Client.update({
realm : realm.realm, realm : realm.realm,
client : client.id client : client.id

View file

@ -9,11 +9,11 @@
<form class=form-horizontal" name="enableForm" novalidate kc-read-only="!access.manageAuthorization"> <form class=form-horizontal" name="enableForm" novalidate kc-read-only="!access.manageAuthorization">
<fieldset class="border-top"> <fieldset class="border-top">
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label" for="permissionsEnabled">{{:: 'permissions-enabled' | translate}}</label> <label class="col-md-2 control-label" for="permissionsEnabled">{{:: 'permissions-enabled-role' | translate}}</label>
<div class="col-md-6"> <div class="col-md-6">
<input ng-model="permissions.enabled" ng-click="setEnabled()" name="permissionsEnabled" id="permissionsEnabled" ng-disabled="!access.manageAuthorization" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/> <input ng-model="permissions.enabled" ng-click="setEnabled()" name="permissionsEnabled" id="permissionsEnabled" ng-disabled="!access.manageAuthorization" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
</div> </div>
<kc-tooltip>{{:: 'permissions-enabled.tooltip' | translate}}</kc-tooltip> <kc-tooltip>{{:: 'permissions-enabled-role.tooltip' | translate}}</kc-tooltip>
</div> </div>
</fieldset> </fieldset>
</form> </form>

View file

@ -5,11 +5,11 @@
<form class=form-horizontal" name="enableForm" novalidate kc-read-only="!access.manageAuthorization"> <form class=form-horizontal" name="enableForm" novalidate kc-read-only="!access.manageAuthorization">
<fieldset class="border-top"> <fieldset class="border-top">
<div class="form-group"> <div class="form-group">
<label class="col-md-2 control-label" for="permissionsEnabled">{{:: 'permissions-enabled' | translate}}</label> <label class="col-md-2 control-label" for="permissionsEnabled">{{:: 'permissions-enabled-users' | translate}}</label>
<div class="col-md-6"> <div class="col-md-6">
<input ng-model="permissions.enabled" ng-click="setEnabled()" name="permissionsEnabled" id="permissionsEnabled" ng-disabled="!access.manageAuthorization" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/> <input ng-model="permissions.enabled" ng-click="changeIt()" name="permissionsEnabled" id="permissionsEnabled" ng-disabled="!access.manageAuthorization" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
</div> </div>
<kc-tooltip>{{:: 'permissions-enabled.tooltip' | translate}}</kc-tooltip> <kc-tooltip>{{:: 'permissions-enabled-users.tooltip' | translate}}</kc-tooltip>
</div> </div>
</fieldset> </fieldset>
</form> </form>