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 2f044860a8..62142edd6e 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 @@ -521,6 +521,8 @@ module.factory('errorInterceptor', function($q, $window, $rootScope, $location, console.log('session timeout?'); Auth.loggedIn = false; window.location = '/auth/rest/admin/login?path=' + $location.path(); + } else if (response.status == 403) { + Notifications.error("Forbidden"); } else if (response.status == 404) { Notifications.error("Not found"); } else if (response.status) { @@ -672,20 +674,6 @@ 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) { @@ -791,6 +779,21 @@ module.directive('kcSelect', function ($compile, Notifications) { } }); +module.directive('kcReadOnly', function() { + var d = { + replace : false, + link : function(scope, element, attrs) { + if (scope.$eval(attrs.kcReadOnly)) { + element.find('input').attr('disabled', 'disabled'); + element.find('button').attr('disabled', 'disabled'); + element.find('select').attr('disabled', 'disabled'); + element.find('textarea').attr('disabled', 'disabled'); + } + } + }; + return d; +}); + module.directive('kcNavigation', function ($compile, Notifications) { return { scope: true, 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 eb544641a5..8220e9ca91 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 @@ -22,6 +22,22 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, Current, $location $scope.access = { admin: data.admin, + get viewRealm() { + return getAccess(Current.realm.realm, 'view-realm') || this.viewRealm; + }, + + get viewApplications() { + return getAccess(Current.realm.realm, 'view-applications') || this.manageApplications; + }, + + get viewClients() { + return getAccess(Current.realm.realm, 'view-clients') || this.manageClients; + }, + + get viewUsers() { + return getAccess(Current.realm.realm, 'view-users') || this.manageClients; + }, + get manageRealm() { return getAccess(Current.realm.realm, 'manage-realm'); }, diff --git a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-credentials.html b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-credentials.html index 8716490d91..a839ccf36a 100755 --- a/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-credentials.html +++ b/admin-ui/src/main/resources/META-INF/resources/admin/partials/application-credentials.html @@ -16,7 +16,7 @@