KEYCLOAK-1327 Updated for users
This commit is contained in:
1 parent
e1e65af8ea
commit
5f787028df
6 files changed
+228
-214
No files matched your search
+49
-42
@@ -14,23 +14,23 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl
|
||||
$scope.clientMappings = [];
|
||||
$scope.dummymodel = [];
|
||||
|
||||
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
|
||||
$scope.addRealmRole = function() {
|
||||
$http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/realm',
|
||||
$http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.id + '/role-mappings/realm',
|
||||
$scope.selectedRealmRoles).success(function() {
|
||||
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.selectedRealmMappings = [];
|
||||
$scope.selectRealmRoles = [];
|
||||
if ($scope.client) {
|
||||
console.log('load available');
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.selectedClientRoles = [];
|
||||
$scope.selectedClientMappings = [];
|
||||
}
|
||||
@@ -40,18 +40,18 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl
|
||||
};
|
||||
|
||||
$scope.deleteRealmRole = function() {
|
||||
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/realm',
|
||||
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.id + '/role-mappings/realm',
|
||||
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.username});
|
||||
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||
$scope.selectedRealmMappings = [];
|
||||
$scope.selectRealmRoles = [];
|
||||
if ($scope.client) {
|
||||
console.log('load available');
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.selectedClientRoles = [];
|
||||
$scope.selectedClientMappings = [];
|
||||
}
|
||||
@@ -60,11 +60,11 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl
|
||||
};
|
||||
|
||||
$scope.addClientRole = function() {
|
||||
$http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/clients/' + $scope.client.id,
|
||||
$http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.id + '/role-mappings/clients/' + $scope.client.id,
|
||||
$scope.selectedClientRoles).success(function() {
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.selectedClientRoles = [];
|
||||
$scope.selectedClientMappings = [];
|
||||
Notifications.success("Role mappings updated.");
|
||||
@@ -72,11 +72,11 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl
|
||||
};
|
||||
|
||||
$scope.deleteClientRole = function() {
|
||||
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.username + '/role-mappings/clients/' + $scope.client.id,
|
||||
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.id + '/role-mappings/clients/' + $scope.client.id,
|
||||
{data : $scope.selectedClientMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.selectedClientRoles = [];
|
||||
$scope.selectedClientMappings = [];
|
||||
Notifications.success("Role mappings updated.");
|
||||
@@ -88,9 +88,9 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl
|
||||
console.log('changeClient');
|
||||
if ($scope.client) {
|
||||
console.log('load available');
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.username, client : $scope.client.id});
|
||||
$scope.clientComposite = CompositeClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientRoles = AvailableClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
$scope.clientMappings = ClientRoleMapping.query({realm : realm.realm, userId : user.id, client : $scope.client.id});
|
||||
} else {
|
||||
$scope.clientRoles = null;
|
||||
$scope.clientMappings = null;
|
||||
@@ -110,9 +110,9 @@ module.controller('UserSessionsCtrl', function($scope, realm, user, sessions, Us
|
||||
$scope.sessions = sessions;
|
||||
|
||||
$scope.logoutAll = function() {
|
||||
UserLogout.save({realm : realm.realm, user: user.username}, function () {
|
||||
UserLogout.save({realm : realm.realm, user: user.id}, function () {
|
||||
Notifications.success('Logged out user in all clients');
|
||||
UserSessions.query({realm: realm.realm, user: user.username}, function(updated) {
|
||||
UserSessions.query({realm: realm.realm, user: user.id}, function(updated) {
|
||||
$scope.sessions = updated;
|
||||
})
|
||||
});
|
||||
@@ -121,7 +121,7 @@ module.controller('UserSessionsCtrl', function($scope, realm, user, sessions, Us
|
||||
$scope.logoutSession = function(sessionId) {
|
||||
console.log('here in logoutSession');
|
||||
UserSessionLogout.delete({realm : realm.realm, session: sessionId}, function() {
|
||||
UserSessions.query({realm: realm.realm, user: user.username}, function(updated) {
|
||||
UserSessions.query({realm: realm.realm, user: user.id}, function(updated) {
|
||||
$scope.sessions = updated;
|
||||
Notifications.success('Logged out session');
|
||||
})
|
||||
@@ -141,8 +141,8 @@ module.controller('UserConsentsCtrl', function($scope, realm, user, userConsents
|
||||
$scope.userConsents = userConsents;
|
||||
|
||||
$scope.revokeConsent = function(clientId) {
|
||||
UserConsents.delete({realm : realm.realm, user: user.username, client: clientId }, function () {
|
||||
UserConsents.query({realm: realm.realm, user: user.username}, function(updated) {
|
||||
UserConsents.delete({realm : realm.realm, user: user.id, client: clientId }, function () {
|
||||
UserConsents.query({realm: realm.realm, user: user.id}, function(updated) {
|
||||
$scope.userConsents = updated;
|
||||
})
|
||||
Notifications.success('Consent revoked successfully');
|
||||
@@ -197,7 +197,7 @@ module.controller('UserListCtrl', function($scope, realm, User) {
|
||||
|
||||
module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFederationInstances, $location, Dialog, Notifications) {
|
||||
$scope.realm = realm;
|
||||
$scope.create = !user.username;
|
||||
$scope.create = !user.id;
|
||||
|
||||
if ($scope.create) {
|
||||
$scope.user = { enabled: true, attributes: {} }
|
||||
@@ -237,17 +237,24 @@ module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFede
|
||||
if ($scope.create) {
|
||||
User.save({
|
||||
realm: realm.realm
|
||||
}, $scope.user, function () {
|
||||
}, $scope.user, function (data, headers) {
|
||||
$scope.changed = false;
|
||||
user = angular.copy($scope.user);
|
||||
|
||||
$location.url("/realms/" + realm.realm + "/users/" + $scope.user.username);
|
||||
var l = headers().location;
|
||||
|
||||
console.debug("Location == " + l);
|
||||
|
||||
var id = l.substring(l.lastIndexOf("/") + 1);
|
||||
|
||||
|
||||
$location.url("/realms/" + realm.realm + "/users/" + id);
|
||||
Notifications.success("The user has been created.");
|
||||
});
|
||||
} else {
|
||||
User.update({
|
||||
realm: realm.realm,
|
||||
userId: $scope.user.username
|
||||
userId: $scope.user.id
|
||||
}, $scope.user, function () {
|
||||
$scope.changed = false;
|
||||
user = angular.copy($scope.user);
|
||||
@@ -266,10 +273,10 @@ module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFede
|
||||
};
|
||||
|
||||
$scope.remove = function() {
|
||||
Dialog.confirmDelete($scope.user.username, 'user', function() {
|
||||
Dialog.confirmDelete($scope.user.id, 'user', function() {
|
||||
$scope.user.$remove({
|
||||
realm : realm.realm,
|
||||
userId : $scope.user.username
|
||||
userId : $scope.user.id
|
||||
}, function() {
|
||||
$location.url("/realms/" + realm.realm + "/users");
|
||||
Notifications.success("The user has been deleted.");
|
||||
@@ -304,7 +311,7 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, User, Use
|
||||
var msg = 'Are you sure you want to change the users password?';
|
||||
|
||||
Dialog.confirm(msgTitle, msg, function() {
|
||||
UserCredentials.resetPassword({ realm: realm.realm, userId: user.username }, { type : "password", value : $scope.password, temporary: $scope.temporaryPassword }, function() {
|
||||
UserCredentials.resetPassword({ realm: realm.realm, userId: user.id }, { type : "password", value : $scope.password, temporary: $scope.temporaryPassword }, function() {
|
||||
Notifications.success("The password has been reset");
|
||||
$scope.password = null;
|
||||
$scope.confirmPassword = null;
|
||||
@@ -323,7 +330,7 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, User, Use
|
||||
|
||||
$scope.removeTotp = function() {
|
||||
Dialog.confirm('Remove totp', 'Are you sure you want to remove the users totp configuration?', function() {
|
||||
UserCredentials.removeTotp({ realm: realm.realm, userId: user.username }, { }, function() {
|
||||
UserCredentials.removeTotp({ realm: realm.realm, userId: user.id }, { }, function() {
|
||||
Notifications.success("The users totp configuration has been removed");
|
||||
$scope.user.totp = false;
|
||||
}, function() {
|
||||
@@ -334,7 +341,7 @@ module.controller('UserCredentialsCtrl', function($scope, realm, user, User, Use
|
||||
|
||||
$scope.resetPasswordEmail = function() {
|
||||
Dialog.confirm('Reset password email', 'Are you sure you want to send password reset email to user?', function() {
|
||||
UserCredentials.resetPasswordEmail({ realm: realm.realm, userId: user.username }, { }, function() {
|
||||
UserCredentials.resetPasswordEmail({ realm: realm.realm, userId: user.id }, { }, function() {
|
||||
Notifications.success("Password reset email sent to user");
|
||||
}, function() {
|
||||
Notifications.error("Failed to send password reset mail to user");
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr ng-repeat="user in users">
|
||||
<td><a href="#/realms/{{realm.realm}}/users/{{user.username}}">{{user.username}}</a></td>
|
||||
<td><a href="#/realms/{{realm.realm}}/users/{{user.id}}">{{user.username}}</a></td>
|
||||
<td>{{user.lastName}}</td>
|
||||
<td>{{user.firstName}}</td>
|
||||
<td>{{user.email}}</td>
|
||||
|
||||
+6
-6
@@ -1,8 +1,8 @@
|
||||
<ul class="nav nav-tabs" data-ng-show="!create">
|
||||
<li ng-class="{active: !path[4]}"><a href="#/realms/{{realm.realm}}/users/{{user.username}}">Attributes</a></li>
|
||||
<li ng-class="{active: path[4] == 'user-credentials'}" data-ng-show="access.manageUsers"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/user-credentials">Credentials</a></li>
|
||||
<li ng-class="{active: path[4] == 'role-mappings'}" ><a href="#/realms/{{realm.realm}}/users/{{user.username}}/role-mappings">Role Mappings</a></li>
|
||||
<li ng-class="{active: path[4] == 'consents'}"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/consents">Consents</a></li>
|
||||
<li ng-class="{active: path[4] == 'sessions'}" ><a href="#/realms/{{realm.realm}}/users/{{user.username}}/sessions">Sessions</a></li>
|
||||
<li ng-class="{active: path[4] == 'federated-identity'}" data-ng-show="user.federatedIdentities && user.federatedIdentities.length > 0"><a href="#/realms/{{realm.realm}}/users/{{user.username}}/federated-identity">Identity Provider Links</a></li>
|
||||
<li ng-class="{active: !path[4]}"><a href="#/realms/{{realm.realm}}/users/{{user.id}}">Attributes</a></li>
|
||||
<li ng-class="{active: path[4] == 'user-credentials'}" data-ng-show="access.manageUsers"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/user-credentials">Credentials</a></li>
|
||||
<li ng-class="{active: path[4] == 'role-mappings'}" ><a href="#/realms/{{realm.realm}}/users/{{user.id}}/role-mappings">Role Mappings</a></li>
|
||||
<li ng-class="{active: path[4] == 'consents'}"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/consents">Consents</a></li>
|
||||
<li ng-class="{active: path[4] == 'sessions'}" ><a href="#/realms/{{realm.realm}}/users/{{user.id}}/sessions">Sessions</a></li>
|
||||
<li ng-class="{active: path[4] == 'federated-identity'}" data-ng-show="user.federatedIdentities && user.federatedIdentities.length > 0"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/federated-identity">Identity Provider Links</a></li>
|
||||
</ul>
|
||||
Reference in new issue
Block a user