KEYCLOAK-1470
This commit is contained in:
parent
e8bd7270e9
commit
11d1dd6419
8 changed files with 43 additions and 25 deletions
|
@ -906,32 +906,40 @@ module.controller('ClientScopeMappingCtrl', function($scope, $http, realm, clien
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addRealmRole = function() {
|
$scope.addRealmRole = function() {
|
||||||
|
var roles = $scope.selectedRealmRoles;
|
||||||
|
$scope.selectedRealmRoles = [];
|
||||||
$http.post(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/realm',
|
$http.post(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/realm',
|
||||||
$scope.selectedRealmRoles).success(function() {
|
roles).success(function() {
|
||||||
updateRealmRoles();
|
updateRealmRoles();
|
||||||
Notifications.success("Scope mappings updated.");
|
Notifications.success("Scope mappings updated.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteRealmRole = function() {
|
$scope.deleteRealmRole = function() {
|
||||||
|
var roles = $scope.selectedRealmMappings;
|
||||||
|
$scope.selectedRealmMappings = [];
|
||||||
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/realm',
|
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/realm',
|
||||||
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function () {
|
{data : roles, headers : {"content-type" : "application/json"}}).success(function () {
|
||||||
updateRealmRoles();
|
updateRealmRoles();
|
||||||
Notifications.success("Scope mappings updated.");
|
Notifications.success("Scope mappings updated.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addClientRole = function() {
|
$scope.addClientRole = function() {
|
||||||
|
var roles = $scope.selectedClientRoles;
|
||||||
|
$scope.selectedClientRoles = [];
|
||||||
$http.post(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/clients/' + $scope.targetClient.id,
|
$http.post(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/clients/' + $scope.targetClient.id,
|
||||||
$scope.selectedClientRoles).success(function () {
|
roles).success(function () {
|
||||||
updateClientRoles();
|
updateClientRoles();
|
||||||
Notifications.success("Scope mappings updated.");
|
Notifications.success("Scope mappings updated.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteClientRole = function() {
|
$scope.deleteClientRole = function() {
|
||||||
|
var roles = $scope.selectedClientMappings;
|
||||||
|
$scope.selectedClientMappings = [];
|
||||||
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/clients/' + $scope.targetClient.id,
|
$http.delete(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/clients/' + $scope.targetClient.id,
|
||||||
{data : $scope.selectedClientMappings, headers : {"content-type" : "application/json"}}).success(function () {
|
{data : roles, headers : {"content-type" : "application/json"}}).success(function () {
|
||||||
updateClientRoles();
|
updateClientRoles();
|
||||||
Notifications.success("Scope mappings updated.");
|
Notifications.success("Scope mappings updated.");
|
||||||
});
|
});
|
||||||
|
|
|
@ -480,6 +480,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.selectedRealmRoles = [];
|
||||||
|
|
||||||
// Update/save the realm with new default roles.
|
// Update/save the realm with new default roles.
|
||||||
Realm.update($scope.realm, function () {
|
Realm.update($scope.realm, function () {
|
||||||
Notifications.success("Realm default roles updated.");
|
Notifications.success("Realm default roles updated.");
|
||||||
|
@ -498,6 +500,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.selectedRealmDefRoles = [];
|
||||||
|
|
||||||
// Update/save the realm with new default roles.
|
// Update/save the realm with new default roles.
|
||||||
//var realmCopy = angular.copy($scope.realm);
|
//var realmCopy = angular.copy($scope.realm);
|
||||||
Realm.update($scope.realm, function () {
|
Realm.update($scope.realm, function () {
|
||||||
|
@ -550,6 +554,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.selectedClientRoles = [];
|
||||||
|
|
||||||
// Update/save the selected client with new default roles.
|
// Update/save the selected client with new default roles.
|
||||||
Client.update({
|
Client.update({
|
||||||
realm: $scope.realm.realm,
|
realm: $scope.realm.realm,
|
||||||
|
@ -574,6 +580,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.selectedClientDefRoles = [];
|
||||||
|
|
||||||
// Update/save the selected client with new default roles.
|
// Update/save the selected client with new default roles.
|
||||||
Client.update({
|
Client.update({
|
||||||
realm: $scope.realm.realm,
|
realm: $scope.realm.realm,
|
||||||
|
|
|
@ -19,8 +19,10 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl
|
||||||
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||||
|
|
||||||
$scope.addRealmRole = function() {
|
$scope.addRealmRole = function() {
|
||||||
|
var roles = $scope.selectedRealmRoles;
|
||||||
|
$scope.selectedRealmRoles = [];
|
||||||
$http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.id + '/role-mappings/realm',
|
$http.post(authUrl + '/admin/realms/' + realm.realm + '/users/' + user.id + '/role-mappings/realm',
|
||||||
$scope.selectedRealmRoles).success(function() {
|
roles).success(function() {
|
||||||
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
$scope.realmMappings = RealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||||
$scope.realmRoles = AvailableRealmRoleMapping.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.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
ng-model="selectedRealmRoles"
|
ng-model="selectedRealmRoles"
|
||||||
ng-options="r.name for r in realmRoles">
|
ng-options="r.name for r in realmRoles">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addRealmRole()" tooltip="Associate role" tooltip-placement="right">
|
<button ng-disabled="selectedRealmRoles.length == 0" class="btn btn-default" type="submit" ng-click="addRealmRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
ng-model="selectedRealmMappings"
|
ng-model="selectedRealmMappings"
|
||||||
ng-options="r.name for r in realmMappings">
|
ng-options="r.name for r in realmMappings">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteRealmRole()" tooltip="Disassociate role" tooltip-placement="left">
|
<button ng-disabled="selectedRealmMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteRealmRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
ng-model="selectedClientRoles"
|
ng-model="selectedClientRoles"
|
||||||
ng-options="r.name for r in clientRoles">
|
ng-options="r.name for r in clientRoles">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addClientRole()" tooltip="Associate role" tooltip-placement="right">
|
<button ng-disabled="selectedClientRoles.length == 0" class="btn btn-default" type="submit" ng-click="addClientRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
ng-model="selectedClientMappings"
|
ng-model="selectedClientMappings"
|
||||||
ng-options="r.name for r in clientMappings">
|
ng-options="r.name for r in clientMappings">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteClientRole()" tooltip="Disassociate role" tooltip-placement="left">
|
<button ng-disabled="selectedClientMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteClientRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
ng-model="selectedRealmRoles"
|
ng-model="selectedRealmRoles"
|
||||||
ng-options="r.name for r in realmRoles">
|
ng-options="r.name for r in realmRoles">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addRealmRole()" tooltip="Move right" tooltip-placement="right">
|
<button ng-disabled="selectedRealmRoles.length == 0" class="btn btn-default" type="submit" ng-click="addRealmRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
ng-model="selectedRealmMappings"
|
ng-model="selectedRealmMappings"
|
||||||
ng-options="r.name for r in realmMappings">
|
ng-options="r.name for r in realmMappings">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteRealmRole()" tooltip="Move left" tooltip-placement="left">
|
<button ng-disabled="selectedRealmMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteRealmRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
ng-model="selectedClientRoles"
|
ng-model="selectedClientRoles"
|
||||||
ng-options="r.name for r in clientRoles">
|
ng-options="r.name for r in clientRoles">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addClientRole()" tooltip="Assign role" tooltip-placement="right">
|
<button ng-disabled="selectedClientRoles.length == 0" class="btn btn-default" type="submit" ng-click="addClientRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
ng-model="selectedClientMappings"
|
ng-model="selectedClientMappings"
|
||||||
ng-options="r.name for r in clientMappings">
|
ng-options="r.name for r in clientMappings">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteClientRole()" tooltip="Unassign role" tooltip-placement="left">
|
<button ng-disabled="selectedClientMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteClientRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
ng-model="selectedRealmRoles"
|
ng-model="selectedRealmRoles"
|
||||||
ng-options="r for r in availableRealmRoles | orderBy:'toString()'">
|
ng-options="r for r in availableRealmRoles | orderBy:'toString()'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addRealmDefaultRole()" tooltip="Assign role" tooltip-placement="right">
|
<button ng-disabled="selectedRealmRoles.length == 0" class="btn btn-default" type="submit" ng-click="addRealmDefaultRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
ng-model="selectedRealmDefRoles"
|
ng-model="selectedRealmDefRoles"
|
||||||
ng-options="r for r in realm.defaultRoles | orderBy:'toString()'">
|
ng-options="r for r in realm.defaultRoles | orderBy:'toString()'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteRealmDefaultRole()" tooltip="Unassign role" tooltip-placement="left">
|
<button ng-disabled="selectedRealmDefRoles.length == 0" class="btn btn-default" type="submit" ng-click="deleteRealmDefaultRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
ng-model="selectedClientRoles"
|
ng-model="selectedClientRoles"
|
||||||
ng-options="r for r in availableClientRoles | orderBy:'toString()'">
|
ng-options="r for r in availableClientRoles | orderBy:'toString()'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addClientDefaultRole()" tooltip="Assign role" tooltip-placement="right">
|
<button ng-disabled="selectedClientRoles.length == 0" class="btn btn-default" type="submit" ng-click="addClientDefaultRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
ng-model="selectedClientDefRoles"
|
ng-model="selectedClientDefRoles"
|
||||||
ng-options="r for r in client.defaultRoles | orderBy:'toString()'">
|
ng-options="r for r in client.defaultRoles | orderBy:'toString()'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="rmClientDefaultRole()" tooltip="Unassign role" tooltip-placement="left">
|
<button ng-disabled="selectedClientDefRoles.length == 0" class="btn btn-default" type="submit" ng-click="rmClientDefaultRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
ng-model="selectedRealmRoles"
|
ng-model="selectedRealmRoles"
|
||||||
ng-options="r.name for r in realmRoles | orderBy:'name'">
|
ng-options="r.name for r in realmRoles | orderBy:'name'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addRealmRole()" tooltip="Associate role" tooltip-placement="right">
|
<button ng-disabled="selectedRealmRoles.length == 0" class="btn btn-default" type="submit" ng-click="addRealmRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
ng-model="selectedRealmMappings"
|
ng-model="selectedRealmMappings"
|
||||||
ng-options="r.name for r in realmMappings | orderBy:'name'">
|
ng-options="r.name for r in realmMappings | orderBy:'name'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteRealmRole()" tooltip="Disassociate role" tooltip-placement="left">
|
<button ng-disabled="selectedRealmMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteRealmRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
ng-model="selectedClientRoles"
|
ng-model="selectedClientRoles"
|
||||||
ng-options="r.name for r in clientRoles | orderBy:'name'">
|
ng-options="r.name for r in clientRoles | orderBy:'name'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addClientRole()" tooltip="Associate role" tooltip-placement="right">
|
<button ng-disabled="selectedClientRoles.length == 0" class="btn btn-default" type="submit" ng-click="addClientRole()">
|
||||||
Add selected <i class="fa fa-angle-right"></i>
|
Add selected <i class="fa fa-angle-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
ng-model="selectedClientMappings"
|
ng-model="selectedClientMappings"
|
||||||
ng-options="r.name for r in clientMappings | orderBy:'name'">
|
ng-options="r.name for r in clientMappings | orderBy:'name'">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteClientRole()" tooltip="Disassociate role" tooltip-placement="left">
|
<button ng-disabled="selectedClientMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteClientRole()">
|
||||||
<i class="fa fa-angle-left"></i> Remove selected
|
<i class="fa fa-angle-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
ng-model="selectedRealmRoles"
|
ng-model="selectedRealmRoles"
|
||||||
ng-options="r.name for r in realmRoles">
|
ng-options="r.name for r in realmRoles">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addRealmRole()" tooltip="Assign role" tooltip-placement="right">
|
<button ng-disabled="selectedRealmRoles.length == 0" ng-disabled="c.length == 0" class="btn btn-default" type="submit" ng-click="addRealmRole()">
|
||||||
Add selected <i class="fa fa-angle-right"></i>
|
Add selected <i class="fa fa-angle-right"></i>
|
||||||
</button>
|
</button>
|
||||||
<kc-tooltip>Realm roles that can be assigned to the user.</kc-tooltip>
|
<kc-tooltip>Realm roles that can be assigned to the user.</kc-tooltip>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
ng-model="selectedRealmMappings"
|
ng-model="selectedRealmMappings"
|
||||||
ng-options="r.name for r in realmMappings">
|
ng-options="r.name for r in realmMappings">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteRealmRole()" tooltip="Unassign role" tooltip-placement="left">
|
<button ng-disabled="selectedRealmMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteRealmRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
ng-model="selectedClientRoles"
|
ng-model="selectedClientRoles"
|
||||||
ng-options="r.name for r in clientRoles">
|
ng-options="r.name for r in clientRoles">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="addClientRole()" tooltip="Assign role" tooltip-placement="right">
|
<button ng-disabled="selectedClientRoles.length == 0" class="btn btn-default" type="submit" ng-click="addClientRole()">
|
||||||
Add selected <i class="fa fa-angle-double-right"></i>
|
Add selected <i class="fa fa-angle-double-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
ng-model="selectedClientMappings"
|
ng-model="selectedClientMappings"
|
||||||
ng-options="r.name for r in clientMappings">
|
ng-options="r.name for r in clientMappings">
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-default" type="submit" ng-click="deleteClientRole()" tooltip="Unassign role" tooltip-placement="left">
|
<button ng-disabled="selectedClientMappings.length == 0" class="btn btn-default" type="submit" ng-click="deleteClientRole()">
|
||||||
<i class="fa fa-angle-double-left"></i> Remove selected
|
<i class="fa fa-angle-double-left"></i> Remove selected
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue