[KEYCLOAK-4164] - Creating typed resources always result in error
This commit is contained in:
parent
ed75ef900a
commit
72691b2e74
2 changed files with 18 additions and 3 deletions
|
@ -2218,7 +2218,13 @@ public class RepresentationToModel {
|
|||
}
|
||||
}
|
||||
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() {
|
||||
$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 = [];
|
||||
|
||||
for (i = 0; i < $scope.policy.config.applyPolicies.length; i++) {
|
||||
|
@ -920,7 +925,11 @@ module.controller('ResourceServerPolicyResourceDetailCtrl', function($scope, $ro
|
|||
},
|
||||
|
||||
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 = [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue