Commit 20733876 authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza

New API endpoints for permission editor

parent f3b20e69
......@@ -104,6 +104,44 @@ public class PermissionController {
return lazyLoadForJson(aclService.setPermissions(objectIdentity, sid, sidPermissions));
}
/**
* Update inheriting status
*
* @param inheriting is inheriting value
* @param id the id
* @return updated acl object identity
*/
@Transactional
@JsonView(JsonViews.Minimal.class)
@PostMapping(value = "/update-inheriting/{inheriting}/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public AclObjectIdentityExt updateInheriting(@PathVariable(value = "inheriting") final boolean inheriting,
@PathVariable(name = "id") final long id) {
final AclObjectIdentity objectIdentity = aclService.updateInheriting(id, inheriting);
if (objectIdentity == null) {
throw new NotFoundElement("No such ACL object");
}
return lazyLoadForJson(objectIdentity);
}
/**
* Update parent object
*
* @param id the id
* @param parentId the parentId
* @return updated acl object identity
*/
@Transactional
@JsonView(JsonViews.Minimal.class)
@PostMapping(value = "/update-parent/{id}/{parentId}", produces = MediaType.APPLICATION_JSON_VALUE)
public AclObjectIdentityExt updateParentObject(@PathVariable(name = "id") final long id, @PathVariable(name = "parentId") final long parentId) {
final AclObjectIdentity objectIdentity = aclService.updateParentObject(id, parentId);
if (objectIdentity == null) {
throw new NotFoundElement("No such ACL object");
}
return lazyLoadForJson(objectIdentity);
}
/**
* Return all information related to the AclAwareModel.
*
......
......@@ -25,6 +25,7 @@ import org.genesys.catalog.service.ShortFilterService.FilterInfo;
import org.genesys2.server.api.ApiBaseController;
import org.genesys2.server.api.FilteredPage;
import org.genesys2.server.api.Pagination;
import org.genesys2.server.exception.NotFoundElement;
import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.model.impl.Subset;
import org.genesys2.server.service.InstituteService;
......@@ -78,6 +79,9 @@ public class SubsetController {
@PostMapping(value = "/create", produces = { MediaType.APPLICATION_JSON_VALUE })
public Subset create(@RequestBody final Subset subset) {
FaoInstitute institute = instituteService.findInstitute(subset.getWiewsCode());
if (institute == null) {
throw new NotFoundElement("No such institute.");
}
return subsetService.create(institute, subset);
}
......
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