diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js index 9e5bc0b3f9..2f044860a8 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/app.js @@ -672,6 +672,20 @@ module.directive('kcInput', function() { return d; }); +module.directive('kcDisableForm', function() { + var d = { + scope : true, + replace : false, + link : function(scope, element, attrs) { + var form = element.children('form'); + console.debug(form); + var input = element.children('input'); + input.attr('disabled', 'true'); + } + }; + return d; +}); + module.directive('kcEnter', function() { return function(scope, element, attrs) { element.bind("keydown keypress", function(event) { @@ -779,11 +793,7 @@ module.directive('kcSelect', function ($compile, Notifications) { module.directive('kcNavigation', function ($compile, Notifications) { return { - scope: { - kcCurrent: '@', - kcRealm: '=', - kcSocial: '=' - }, + scope: true, restrict: 'E', replace: true, templateUrl: 'templates/kc-navigation.html', diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js index 782069a7ca..eb544641a5 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js +++ b/admin-ui/src/main/resources/META-INF/resources/admin/js/controllers/realm.js @@ -8,7 +8,7 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, Current, $location Auth.user = data; Auth.loggedIn = true; - Auth.hasAccess = function(realm, role) { + function getAccess(realm, role) { var realmAccess = Auth.user['realm_access']; if (realmAccess) { realmAccess = realmAccess[realm]; @@ -18,6 +18,26 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, Current, $location } return false; } + + $scope.access = { + admin: data.admin, + + get manageRealm() { + return getAccess(Current.realm.realm, 'manage-realm'); + }, + + get manageApplications() { + return getAccess(Current.realm.realm, 'manage-applications'); + }, + + get manageClients() { + return getAccess(Current.realm.realm, 'manage-clients'); + }, + + get manageUsers() { + return getAccess(Current.realm.realm, 'manage-users'); + } + } }) .error(function(data, status) { Auth.loggedIn = false; diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html index 275cdaed89..f42f25f913 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/menu.html @@ -33,7 +33,7 @@ -
* Required fields
@@ -102,7 +102,7 @@