KEYCLOAK-1470

This commit is contained in:
Stian Thorgersen 2015-07-17 11:46:02 +02:00
parent e8bd7270e9
commit 11d1dd6419
8 changed files with 43 additions and 25 deletions

View file

@ -906,32 +906,40 @@ module.controller('ClientScopeMappingCtrl', function($scope, $http, realm, clien
};
$scope.addRealmRole = function() {
var roles = $scope.selectedRealmRoles;
$scope.selectedRealmRoles = [];
$http.post(authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/scope-mappings/realm',
$scope.selectedRealmRoles).success(function() {
roles).success(function() {
updateRealmRoles();
Notifications.success("Scope mappings updated.");
});
};
$scope.deleteRealmRole = function() {
var roles = $scope.selectedRealmMappings;
$scope.selectedRealmMappings = [];
$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();
Notifications.success("Scope mappings updated.");
});
};
$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,
$scope.selectedClientRoles).success(function () {
roles).success(function () {
updateClientRoles();
Notifications.success("Scope mappings updated.");
});
};
$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,
{data : $scope.selectedClientMappings, headers : {"content-type" : "application/json"}}).success(function () {
{data : roles, headers : {"content-type" : "application/json"}}).success(function () {
updateClientRoles();
Notifications.success("Scope mappings updated.");
});

View file

@ -480,6 +480,8 @@ module.controller('RealmDefaultRolesCtrl', function ($scope, Realm, realm, clien
}
}
$scope.selectedRealmRoles = [];
// Update/save the realm with new default roles.
Realm.update($scope.realm, function () {
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.
//var realmCopy = angular.copy($scope.realm);
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.
Client.update({
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.
Client.update({
realm: $scope.realm.realm,

View file

@ -19,8 +19,10 @@ module.controller('UserRoleMappingCtrl', function($scope, $http, realm, user, cl
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});
$scope.addRealmRole = function() {
var roles = $scope.selectedRealmRoles;
$scope.selectedRealmRoles = [];
$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.realmRoles = AvailableRealmRoleMapping.query({realm : realm.realm, userId : user.id});
$scope.realmComposite = CompositeRealmRoleMapping.query({realm : realm.realm, userId : user.id});

View file

@ -70,7 +70,7 @@
ng-model="selectedRealmRoles"
ng-options="r.name for r in realmRoles">
</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>
</button>
</div>
@ -82,7 +82,7 @@
ng-model="selectedRealmMappings"
ng-options="r.name for r in realmMappings">
</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
</button>
</div>
@ -109,7 +109,7 @@
ng-model="selectedClientRoles"
ng-options="r.name for r in clientRoles">
</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>
</button>
</div>
@ -121,7 +121,7 @@
ng-model="selectedClientMappings"
ng-options="r.name for r in clientMappings">
</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
</button>
</div>

View file

@ -37,7 +37,7 @@
ng-model="selectedRealmRoles"
ng-options="r.name for r in realmRoles">
</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>
</button>
</div>
@ -49,7 +49,7 @@
ng-model="selectedRealmMappings"
ng-options="r.name for r in realmMappings">
</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
</button>
</div>
@ -85,7 +85,7 @@
ng-model="selectedClientRoles"
ng-options="r.name for r in clientRoles">
</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>
</button>
</div>
@ -97,7 +97,7 @@
ng-model="selectedClientMappings"
ng-options="r.name for r in clientMappings">
</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
</button>
</div>

View file

@ -19,7 +19,7 @@
ng-model="selectedRealmRoles"
ng-options="r for r in availableRealmRoles | orderBy:'toString()'">
</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>
</button>
</div>
@ -31,7 +31,7 @@
ng-model="selectedRealmDefRoles"
ng-options="r for r in realm.defaultRoles | orderBy:'toString()'">
</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
</button>
</div>
@ -57,7 +57,7 @@
ng-model="selectedClientRoles"
ng-options="r for r in availableClientRoles | orderBy:'toString()'">
</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>
</button>
</div>
@ -69,7 +69,7 @@
ng-model="selectedClientDefRoles"
ng-options="r for r in client.defaultRoles | orderBy:'toString()'">
</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
</button>
</div>

View file

@ -66,7 +66,7 @@
ng-model="selectedRealmRoles"
ng-options="r.name for r in realmRoles | orderBy:'name'">
</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>
</button>
</div>
@ -78,7 +78,7 @@
ng-model="selectedRealmMappings"
ng-options="r.name for r in realmMappings | orderBy:'name'">
</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
</button>
</div>
@ -105,7 +105,7 @@
ng-model="selectedClientRoles"
ng-options="r.name for r in clientRoles | orderBy:'name'">
</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>
</button>
</div>
@ -117,7 +117,7 @@
ng-model="selectedClientMappings"
ng-options="r.name for r in clientMappings | orderBy:'name'">
</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
</button>
</div>

View file

@ -21,7 +21,7 @@
ng-model="selectedRealmRoles"
ng-options="r.name for r in realmRoles">
</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>
</button>
<kc-tooltip>Realm roles that can be assigned to the user.</kc-tooltip>
@ -34,7 +34,7 @@
ng-model="selectedRealmMappings"
ng-options="r.name for r in realmMappings">
</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
</button>
</div>
@ -69,7 +69,7 @@
ng-model="selectedClientRoles"
ng-options="r.name for r in clientRoles">
</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>
</button>
</div>
@ -81,7 +81,7 @@
ng-model="selectedClientMappings"
ng-options="r.name for r in clientMappings">
</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
</button>
</div>