diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/index.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/index.html
index eca11704ff..459751c066 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/index.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/index.html
@@ -38,7 +38,7 @@
-
+
You will be logged off in seconds due to inactivity.
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js
index e633dcab13..3438d6b923 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js
@@ -1,6 +1,5 @@
'use strict';
-var indexUrl = window.location.href;
var consoleBaseUrl = window.location.href;
consoleBaseUrl = consoleBaseUrl.substring(0, consoleBaseUrl.indexOf("/console"));
consoleBaseUrl = consoleBaseUrl + "/console";
@@ -23,14 +22,12 @@ var loadingTimer = -1;
angular.element(document).ready(function ($http) {
var keycloakAuth = new Keycloak(configUrl);
- auth.loggedIn = false;
keycloakAuth.onAuthLogout = function() {
location.reload();
}
keycloakAuth.init({ onLoad: 'login-required' }).success(function () {
- auth.loggedIn = true;
auth.authz = keycloakAuth;
module.factory('Auth', function() {
return auth;
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js
index a3e61c3b61..d1fdc397c2 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/realm.js
@@ -7,69 +7,69 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, WhoAmI, Current, $
$scope.logout = logout;
$scope.auth = Auth;
- WhoAmI.get(function(data) {
- Auth.user = data;
- Auth.loggedIn = true;
- function getAccess(role) {
- if (!Current.realm) {
- return false;
- }
+ WhoAmI.get(function(user) {
+ Auth.user = user;
+ });
- var realmAccess = Auth.user['realm_access'];
- if (realmAccess) {
- realmAccess = realmAccess[Current.realm.realm];
- if (realmAccess) {
- return realmAccess.indexOf(role) >= 0;
- }
- }
+ function getAccess(role) {
+ if (!Current.realm) {
return false;
}
- $scope.access = {
- createRealm: data.createRealm,
-
- get viewRealm() {
- return getAccess('view-realm') || this.manageRealm;
- },
-
- get viewApplications() {
- return getAccess('view-applications') || this.manageApplications;
- },
-
- get viewClients() {
- return getAccess('view-clients') || this.manageClients;
- },
-
- get viewUsers() {
- return getAccess('view-users') || this.manageClients;
- },
-
- get viewAudit() {
- return getAccess('view-audit') || this.manageClients;
- },
-
- get manageRealm() {
- return getAccess('manage-realm');
- },
-
- get manageApplications() {
- return getAccess('manage-applications');
- },
-
- get manageClients() {
- return getAccess('manage-clients');
- },
-
- get manageUsers() {
- return getAccess('manage-users');
- },
-
- get manageAudit() {
- return getAccess('manage-audit');
+ var realmAccess = Auth.user && Auth.user['realm_access'];
+ if (realmAccess) {
+ realmAccess = realmAccess[Current.realm.realm];
+ if (realmAccess) {
+ return realmAccess.indexOf(role) >= 0;
}
}
- });
+ return false;
+ }
+
+ $scope.access = {
+ createRealm: Auth.user && Auth.user.createRealm,
+
+ get viewRealm() {
+ return getAccess('view-realm') || this.manageRealm;
+ },
+
+ get viewApplications() {
+ return getAccess('view-applications') || this.manageApplications;
+ },
+
+ get viewClients() {
+ return getAccess('view-clients') || this.manageClients;
+ },
+
+ get viewUsers() {
+ return getAccess('view-users') || this.manageClients;
+ },
+
+ get viewAudit() {
+ return getAccess('view-audit') || this.manageClients;
+ },
+
+ get manageRealm() {
+ return getAccess('manage-realm');
+ },
+
+ get manageApplications() {
+ return getAccess('manage-applications');
+ },
+
+ get manageClients() {
+ return getAccess('manage-clients');
+ },
+
+ get manageUsers() {
+ return getAccess('manage-users');
+ },
+
+ get manageAudit() {
+ return getAccess('manage-audit');
+ }
+ }
$scope.$watch(function() {
return $location.path();
@@ -114,7 +114,7 @@ module.controller('RealmDropdownCtrl', function($scope, Realm, Current, Auth, $l
$scope.showNav = function() {
var show = Current.realms.length > 0;
- return Auth.loggedIn && show;
+ return Auth.user && show;
}
$scope.refresh = function() {
Current.refresh();
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/menu.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/menu.html
index 40dc7024a9..03830e9ddc 100755
--- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/menu.html
+++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/menu.html
@@ -12,7 +12,7 @@
-
+
- -
+
-
Add Realm
+ data-ng-show="auth.user">Add Realm