Commit f99620f6 authored by Matija Obreza's avatar Matija Obreza

Fix: Throw NotFoundElement exception in Permissions API v1

parent 1bc8e57e
...@@ -34,6 +34,7 @@ import org.genesys.blocks.security.serialization.AclEntriesToPermissions; ...@@ -34,6 +34,7 @@ import org.genesys.blocks.security.serialization.AclEntriesToPermissions;
import org.genesys.blocks.security.serialization.SidPermissions; import org.genesys.blocks.security.serialization.SidPermissions;
import org.genesys.blocks.security.service.CustomAclService; import org.genesys.blocks.security.service.CustomAclService;
import org.genesys2.server.api.ApiBaseController; import org.genesys2.server.api.ApiBaseController;
import org.genesys2.server.exception.NotFoundElement;
import org.genesys2.server.model.UserRole; import org.genesys2.server.model.UserRole;
import org.genesys2.server.model.impl.User; import org.genesys2.server.model.impl.User;
import org.genesys2.server.service.UserService; import org.genesys2.server.service.UserService;
...@@ -114,6 +115,9 @@ public class PermissionController { ...@@ -114,6 +115,9 @@ public class PermissionController {
@JsonView(JsonViews.Minimal.class) @JsonView(JsonViews.Minimal.class)
public AclObjectIdentityExt permissions(@PathVariable(value = "clazz") final String className, @PathVariable("id") final long id) { public AclObjectIdentityExt permissions(@PathVariable(value = "clazz") final String className, @PathVariable("id") final long id) {
final AclObjectIdentity objectIdentity = aclService.getObjectIdentity(id, className); final AclObjectIdentity objectIdentity = aclService.getObjectIdentity(id, className);
if (objectIdentity == null) {
throw new NotFoundElement("No such ACL object");
}
return lazyLoadForJson(objectIdentity); return lazyLoadForJson(objectIdentity);
} }
...@@ -163,6 +167,10 @@ public class PermissionController { ...@@ -163,6 +167,10 @@ public class PermissionController {
@JsonView(JsonViews.Minimal.class) @JsonView(JsonViews.Minimal.class)
public AclObjectIdentityExt permissions(@PathVariable(value = "aclObjectIdentityId") final long id) { public AclObjectIdentityExt permissions(@PathVariable(value = "aclObjectIdentityId") final long id) {
final AclObjectIdentity objectIdentity = aclService.getObjectIdentity(id); final AclObjectIdentity objectIdentity = aclService.getObjectIdentity(id);
if (objectIdentity == null) {
throw new NotFoundElement("No such ACL object");
}
return lazyLoadForJson(objectIdentity); return lazyLoadForJson(objectIdentity);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment