[KEYCLOAK-3135] - Fixing cancel button
This commit is contained in:
parent
e0f753bcf5
commit
dfec691de0
6 changed files with 49 additions and 19 deletions
|
@ -73,6 +73,11 @@ public class AggregatePolicyProviderFactory implements PolicyProviderFactory<Pol
|
||||||
verifyCircularReference(policy, new ArrayList<>());
|
verifyCircularReference(policy, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onImport(Policy policy, PolicyRepresentation representation, AuthorizationProvider authorization) {
|
||||||
|
verifyCircularReference(policy, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
private void verifyCircularReference(Policy policy, List<String> ids) {
|
private void verifyCircularReference(Policy policy, List<String> ids) {
|
||||||
if (!policy.getType().equals("aggregate")) {
|
if (!policy.getType().equals("aggregate")) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1340,6 +1340,8 @@ module.controller('ResourceServerPolicyUserDetailCtrl', function($scope, $route,
|
||||||
$scope.$watch('selectedUsers', function() {
|
$scope.$watch('selectedUsers', function() {
|
||||||
if (!angular.equals($scope.selectedUsers, selectedUsers)) {
|
if (!angular.equals($scope.selectedUsers, selectedUsers)) {
|
||||||
$scope.changed = true;
|
$scope.changed = true;
|
||||||
|
} else {
|
||||||
|
$scope.changed = false;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
},
|
},
|
||||||
|
@ -1413,8 +1415,11 @@ module.controller('ResourceServerPolicyClientDetailCtrl', function($scope, $rout
|
||||||
$scope.selectedClients.push(client);
|
$scope.selectedClients.push(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.removeFromList = function(list, index) {
|
$scope.removeFromList = function(client) {
|
||||||
list.splice(index, 1);
|
var index = $scope.selectedClients.indexOf(client);
|
||||||
|
if (index != -1) {
|
||||||
|
$scope.selectedClients.splice(index, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1435,6 +1440,8 @@ module.controller('ResourceServerPolicyClientDetailCtrl', function($scope, $rout
|
||||||
$scope.$watch('selectedClients', function() {
|
$scope.$watch('selectedClients', function() {
|
||||||
if (!angular.equals($scope.selectedClients, selectedClients)) {
|
if (!angular.equals($scope.selectedClients, selectedClients)) {
|
||||||
$scope.changed = true;
|
$scope.changed = true;
|
||||||
|
} else {
|
||||||
|
$scope.changed = false;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
},
|
},
|
||||||
|
@ -1449,6 +1456,16 @@ module.controller('ResourceServerPolicyClientDetailCtrl', function($scope, $rout
|
||||||
$scope.policy.config.clients = JSON.stringify(clients);
|
$scope.policy.config.clients = JSON.stringify(clients);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onInitCreate : function() {
|
||||||
|
var selectedClients = [];
|
||||||
|
|
||||||
|
$scope.$watch('selectedClients', function() {
|
||||||
|
if (!angular.equals($scope.selectedClients, selectedClients)) {
|
||||||
|
$scope.changed = true;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
},
|
||||||
|
|
||||||
onCreate : function() {
|
onCreate : function() {
|
||||||
var clients = [];
|
var clients = [];
|
||||||
|
|
||||||
|
@ -1572,6 +1589,8 @@ module.controller('ResourceServerPolicyRoleDetailCtrl', function($scope, $route,
|
||||||
$scope.$watch('selectedRoles', function() {
|
$scope.$watch('selectedRoles', function() {
|
||||||
if (!angular.equals($scope.selectedRoles, selectedRoles)) {
|
if (!angular.equals($scope.selectedRoles, selectedRoles)) {
|
||||||
$scope.changed = true;
|
$scope.changed = true;
|
||||||
|
} else {
|
||||||
|
$scope.changed = false;
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
},
|
},
|
||||||
|
@ -1589,6 +1608,7 @@ module.controller('ResourceServerPolicyRoleDetailCtrl', function($scope, $route,
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.policy.roles = roles;
|
$scope.policy.roles = roles;
|
||||||
|
delete $scope.policy.config;
|
||||||
},
|
},
|
||||||
|
|
||||||
onCreate : function() {
|
onCreate : function() {
|
||||||
|
@ -1604,6 +1624,7 @@ module.controller('ResourceServerPolicyRoleDetailCtrl', function($scope, $route,
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.policy.roles = roles;
|
$scope.policy.roles = roles;
|
||||||
|
delete $scope.policy.config;
|
||||||
}
|
}
|
||||||
}, realm, client, $scope);
|
}, realm, client, $scope);
|
||||||
|
|
||||||
|
@ -1774,18 +1795,25 @@ module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $r
|
||||||
client : client.id,
|
client : client.id,
|
||||||
id : policy.id
|
id : policy.id
|
||||||
}, function(policies) {
|
}, function(policies) {
|
||||||
|
$scope.selectedPolicies = [];
|
||||||
for (i = 0; i < policies.length; i++) {
|
for (i = 0; i < policies.length; i++) {
|
||||||
policies[i].text = policies[i].name;
|
policies[i].text = policies[i].name;
|
||||||
$scope.policy.config.applyPolicies.push(policies[i]);
|
$scope.selectedPolicies.push(policies[i]);
|
||||||
}
|
}
|
||||||
|
var copy = angular.copy($scope.selectedPolicies);
|
||||||
|
$scope.$watch('selectedPolicies', function() {
|
||||||
|
if (!angular.equals($scope.selectedPolicies, copy)) {
|
||||||
|
$scope.changed = true;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpdate : function() {
|
onUpdate : function() {
|
||||||
var policies = [];
|
var policies = [];
|
||||||
|
|
||||||
for (i = 0; i < $scope.policy.config.applyPolicies.length; i++) {
|
for (i = 0; i < $scope.selectedPolicies.length; i++) {
|
||||||
policies.push($scope.policy.config.applyPolicies[i].id);
|
policies.push($scope.selectedPolicies[i].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.policy.config.applyPolicies = JSON.stringify(policies);
|
$scope.policy.config.applyPolicies = JSON.stringify(policies);
|
||||||
|
@ -1799,8 +1827,8 @@ module.controller('ResourceServerPolicyAggregateDetailCtrl', function($scope, $r
|
||||||
onCreate : function() {
|
onCreate : function() {
|
||||||
var policies = [];
|
var policies = [];
|
||||||
|
|
||||||
for (i = 0; i < $scope.policy.config.applyPolicies.length; i++) {
|
for (i = 0; i < $scope.selectedPolicies.length; i++) {
|
||||||
policies.push($scope.policy.config.applyPolicies[i].id);
|
policies.push($scope.selectedPolicies[i].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.policy.config.applyPolicies = JSON.stringify(policies);
|
$scope.policy.config.applyPolicies = JSON.stringify(policies);
|
||||||
|
|
|
@ -1111,6 +1111,12 @@ module.controller('ClientDetailCtrl', function($scope, realm, client, templates,
|
||||||
} else if ($scope.clientEdit.bearerOnly) {
|
} else if ($scope.clientEdit.bearerOnly) {
|
||||||
$scope.clientEdit.serviceAccountsEnabled = false;
|
$scope.clientEdit.serviceAccountsEnabled = false;
|
||||||
}
|
}
|
||||||
|
if ($scope.client.authorizationServicesEnabled && !$scope.clientEdit.authorizationServicesEnabled) {
|
||||||
|
Dialog.confirm("Disable Authorization Settings", "Are you sure you want to disable authorization ? Once you save your changes, all authorization settings associated with this client will be removed. This operation can not be reverted.", function () {
|
||||||
|
}, function () {
|
||||||
|
$scope.clientEdit.authorizationServicesEnabled = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.$watch('clientEdit', function() {
|
$scope.$watch('clientEdit', function() {
|
||||||
|
@ -1240,15 +1246,6 @@ module.controller('ClientDetailCtrl', function($scope, realm, client, templates,
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$location.url("/realms/" + realm.realm + "/clients");
|
$location.url("/realms/" + realm.realm + "/clients");
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.onAuthorizationSettingsChange = function () {
|
|
||||||
if ($scope.client.authorizationServicesEnabled && !$scope.clientEdit.authorizationServicesEnabled) {
|
|
||||||
Dialog.confirm("Disable Authorization Settings", "Are you sure you want to disable authorization ? Once you save your changes, all authorization settings associated with this client will be removed. This operation can not be reverted.", function () {
|
|
||||||
}, function () {
|
|
||||||
$scope.clientEdit.authorizationServicesEnabled = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
module.controller('CreateClientCtrl', function($scope, realm, client, templates, $route, serverInfo, Client, ClientDescriptionConverter, $location, $modal, Dialog, Notifications) {
|
module.controller('CreateClientCtrl', function($scope, realm, client, templates, $route, serverInfo, Client, ClientDescriptionConverter, $location, $modal, Dialog, Notifications) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<label class="col-md-2 control-label" for="reqActions">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
<label class="col-md-2 control-label" for="reqActions">{{:: 'authz-policy-apply-policy' | translate}} <span class="required">*</span></label>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="hidden" ui-select2="policiesUiSelect" id="reqActions" data-ng-model="policy.config.applyPolicies" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..." multiple required />
|
<input type="hidden" ui-select2="policiesUiSelect" id="reqActions" data-ng-model="selectedPolicies" data-placeholder="{{:: 'authz-select-a-policy' | translate}}..." multiple required />
|
||||||
</div>
|
</div>
|
||||||
<kc-tooltip>{{:: 'authz-policy-apply-policy.tooltip' | translate}}</kc-tooltip>
|
<kc-tooltip>{{:: 'authz-policy-apply-policy.tooltip' | translate}}</kc-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<tr ng-repeat="client in selectedClients | orderBy:'clientId'">
|
<tr ng-repeat="client in selectedClients | orderBy:'clientId'">
|
||||||
<td>{{client.clientId}}</td>
|
<td>{{client.clientId}}</td>
|
||||||
<td class="kc-action-cell">
|
<td class="kc-action-cell">
|
||||||
<button class="btn btn-default btn-block btn-sm" ng-click="removeFromList(selectedClients, $index);">{{:: 'remove' | translate}}</button>
|
<button class="btn btn-default btn-block btn-sm" ng-click="removeFromList(client);">{{:: 'remove' | translate}}</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-show="!selectedClients.length">
|
<tr data-ng-show="!selectedClients.length">
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
<label class="col-md-2 control-label" for="authorizationServicesEnabled">{{:: 'authz-authorization-services-enabled' | translate}}</label>
|
<label class="col-md-2 control-label" for="authorizationServicesEnabled">{{:: 'authz-authorization-services-enabled' | translate}}</label>
|
||||||
<kc-tooltip>{{:: 'authz-authorization-services-enabled.tooltip' | translate}}</kc-tooltip>
|
<kc-tooltip>{{:: 'authz-authorization-services-enabled.tooltip' | translate}}</kc-tooltip>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input ng-model="clientEdit.authorizationServicesEnabled" ng-click="onAuthorizationSettingsChange()" name="authorizationServicesEnabled" id="authorizationServicesEnabled" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
|
<input ng-model="clientEdit.authorizationServicesEnabled" name="authorizationServicesEnabled" id="authorizationServicesEnabled" onoffswitch on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group clearfix block" data-ng-show="protocol == 'saml'">
|
<div class="form-group clearfix block" data-ng-show="protocol == 'saml'">
|
||||||
|
|
Loading…
Reference in a new issue