diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js index e9341b329b..335bef3415 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js @@ -79,6 +79,9 @@ module.controller('GlobalCtrl', function($scope, $http, Auth, WhoAmI, Current, $ get manageEvents() { return getAccess('manage-events'); + }, + get impersonation() { + return getAccess('impersonation'); } } diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js index 55f6788ff3..2bb3b29f06 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/users.js @@ -210,7 +210,7 @@ module.controller('UserConsentsCtrl', function($scope, realm, user, userConsents }); -module.controller('UserListCtrl', function($scope, realm, User) { +module.controller('UserListCtrl', function($scope, realm, User, UserImpersonation) { $scope.realm = realm; $scope.page = 0; @@ -220,6 +220,16 @@ module.controller('UserListCtrl', function($scope, realm, User) { first : 0 } + $scope.impersonate = function(userId) { + UserImpersonation.save({realm : realm.realm, user: userId}, function (data) { + if (data.sameRealm) { + window.location = data.redirect; + } else { + window.open(data.redirect, "_blank"); + } + }); + }; + $scope.firstPage = function() { $scope.query.first = 0; $scope.searchQuery(); @@ -251,7 +261,7 @@ module.controller('UserListCtrl', function($scope, realm, User) { -module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFederationInstances, RequiredActions, $location, Dialog, Notifications) { +module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFederationInstances, UserImpersonation, RequiredActions, $location, Dialog, Notifications) { $scope.realm = realm; $scope.create = !user.id; $scope.editUsername = $scope.create || $scope.realm.editUsernameAllowed; @@ -264,7 +274,17 @@ module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFede } convertAttributeValuesToString(user); + $scope.user = angular.copy(user); + $scope.impersonate = function() { + UserImpersonation.save({realm : realm.realm, user: $scope.user.id}, function (data) { + if (data.sameRealm) { + window.location = data.redirect; + } else { + window.open(data.redirect, "_blank"); + } + }); + }; if(user.federationLink) { console.log("federationLink is not null"); UserFederationInstances.get({realm : realm.realm, instance: user.federationLink}, function(link) { diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js index 3f79536fde..0398bfa63c 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js @@ -328,6 +328,13 @@ module.factory('UserConsents', function($resource) { }); }); +module.factory('UserImpersonation', function($resource) { + return $resource(authUrl + '/admin/realms/:realm/users/:user/impersonation', { + realm : '@realm', + user : '@user' + }); +}); + module.factory('UserCredentials', function($resource) { var credentials = {}; diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html index 94bf8996ea..898650b70d 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/role-mappings.html @@ -8,8 +8,8 @@ -
-
+ +
@@ -56,7 +56,7 @@ Client Roles -
+
Select client to view roles for client
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html index 6779d4254b..10a2e720d2 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-detail.html @@ -5,8 +5,8 @@
  • Add User
  • -

    {{user.username|capitalize}}

    +

    {{user.username|capitalize}}

    Add User

    @@ -66,7 +66,7 @@
    - +
    A disabled user cannot login.
    @@ -79,7 +79,7 @@
    - +
    Has the user's email been verified?
    @@ -116,13 +116,14 @@
    -
    - - +
    + + +
    - + diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-list.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-list.html index 9a042e39a3..dc2c4ac7e7 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-list.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-list.html @@ -5,7 +5,7 @@ Table of realm users - +
    @@ -17,7 +17,7 @@
    - @@ -29,6 +29,7 @@ Last Name First Name Email + @@ -49,6 +50,7 @@ {{user.lastName}} {{user.firstName}} {{user.email}} + Please enter a search, or click on view all users diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html index 762dda9243..685549db41 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/user-sessions.html @@ -1,4 +1,4 @@ -
    +