Merge pull request #3717 from pedroigor/KEYCLOAK-4164
[KEYCLOAK-4164] - Creating typed resources always result in error
This commit is contained in:
commit
5bc134ea7b
2 changed files with 18 additions and 3 deletions
|
@ -2218,7 +2218,13 @@ public class RepresentationToModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasResource && !"".equals(resourceId)) {
|
if (!hasResource && !"".equals(resourceId)) {
|
||||||
policy.addResource(storeFactory.getResourceStore().findById(resourceId, policy.getResourceServer().getId()));
|
Resource resource = storeFactory.getResourceStore().findById(resourceId, policy.getResourceServer().getId());
|
||||||
|
|
||||||
|
if (resource == null) {
|
||||||
|
throw new RuntimeException("Resource [" + resourceId + "] not found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
policy.addResource(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -890,7 +890,12 @@ module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $ro
|
||||||
},
|
},
|
||||||
|
|
||||||
onUpdate : function() {
|
onUpdate : function() {
|
||||||
$scope.policy.config.resources = JSON.stringify([$scope.policy.config.resources._id]);
|
if ($scope.policy.config.resources && $scope.policy.config.resources._id) {
|
||||||
|
$scope.policy.config.resources = JSON.stringify([$scope.policy.config.resources._id]);
|
||||||
|
} else {
|
||||||
|
delete $scope.policy.config.resources
|
||||||
|
}
|
||||||
|
|
||||||
var policies = [];
|
var policies = [];
|
||||||
|
|
||||||
for (i = 0; i < $scope.policy.config.applyPolicies.length; i++) {
|
for (i = 0; i < $scope.policy.config.applyPolicies.length; i++) {
|
||||||
|
@ -920,7 +925,11 @@ module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $ro
|
||||||
},
|
},
|
||||||
|
|
||||||
onCreate : function() {
|
onCreate : function() {
|
||||||
$scope.policy.config.resources = JSON.stringify([$scope.policy.config.resources._id]);
|
if ($scope.policy.config.resources && $scope.policy.config.resources._id) {
|
||||||
|
$scope.policy.config.resources = JSON.stringify([$scope.policy.config.resources._id]);
|
||||||
|
} else {
|
||||||
|
delete $scope.policy.config.resources
|
||||||
|
}
|
||||||
|
|
||||||
var policies = [];
|
var policies = [];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue