Commit 3ce0035c authored by Jörg Richter's avatar Jörg Richter

Revise REST API, pt.3 (/accesscontrol) (#341)

BREAKING CHANGES

Change all accesscontrol requests
```
/accesscontrol...
->
/access-control...
```

As long as plugin/script authors make use of the dmx-api JS library no adaptions will be required.
parent 5573a1eb
Pipeline #10632 passed with stages
in 8 minutes and 38 seconds
......@@ -79,7 +79,7 @@ import java.util.logging.Logger;
@Path("/accesscontrol")
@Path("/access-control")
@Consumes("application/json")
@Produces("application/json")
public class AccessControlPlugin extends PluginActivator implements AccessControlService, ConfigCustomizer,
......@@ -333,10 +333,10 @@ public class AccessControlPlugin extends PluginActivator implements AccessContro
// === Workspaces / Memberships ===
@GET
@Path("/workspace/{workspace_id}/owner")
@Path("/workspace/{workspaceId}/owner")
@Produces("text/plain")
@Override
public String getWorkspaceOwner(@PathParam("workspace_id") long workspaceId) {
public String getWorkspaceOwner(@PathParam("workspaceId") long workspaceId) {
// ### TODO: delegate to Core's PrivilegedAccess.getOwner()?
return dmx.hasProperty(workspaceId, PROP_OWNER) ? (String) dmx.getProperty(workspaceId, PROP_OWNER) : null;
}
......@@ -354,10 +354,10 @@ public class AccessControlPlugin extends PluginActivator implements AccessContro
// ---
@POST
@Path("/user/{username}/workspace/{workspace_id}")
@Path("/user/{username}/workspace/{workspaceId}")
@Transactional
@Override
public void createMembership(@PathParam("username") String username, @PathParam("workspace_id") long workspaceId) {
public void createMembership(@PathParam("username") String username, @PathParam("workspaceId") long workspaceId) {
try {
dmx.createAssoc(mf.newAssocModel(MEMBERSHIP,
mf.newTopicPlayerModel(getUsernameTopicOrThrow(username).getId(), DEFAULT),
......
......@@ -55,10 +55,10 @@ public class ConfigPlugin extends PluginActivator implements ConfigService, Post
// ConfigService
@GET
@Path("/{config_type_uri}/topic/{topic_id}")
@Path("/{configTypeUri}/topic/{topicId}")
@Override
public RelatedTopic getConfigTopic(@PathParam("config_type_uri") String configTypeUri,
@PathParam("topic_id") long topicId) {
public RelatedTopic getConfigTopic(@PathParam("configTypeUri") String configTypeUri,
@PathParam("topicId") long topicId) {
return _getConfigTopic(configTypeUri, topicId);
}
......
......@@ -159,11 +159,11 @@ public class TopicmapsPlugin extends PluginActivator implements TopicmapsService
}
@POST
@Path("/{id}/topic/{topic_id}")
@Path("/{id}/topic/{topicId}")
@Transactional
@Override
public void addTopicToTopicmap(@PathParam("id") final long topicmapId,
@PathParam("topic_id") final long topicId, final ViewProps viewProps) {
@PathParam("topicId") final long topicId, final ViewProps viewProps) {
try {
// Note: a Mapcontext association must have no workspace assignment as it is "system" owned
dmx.getPrivilegedAccess().runWithoutWorkspaceAssignment(new Callable<Void>() { // throws Exception
......@@ -183,11 +183,11 @@ public class TopicmapsPlugin extends PluginActivator implements TopicmapsService
}
@POST
@Path("/{id}/assoc/{assoc_id}")
@Path("/{id}/assoc/{assocId}")
@Transactional
@Override
public void addAssocToTopicmap(@PathParam("id") final long topicmapId,
@PathParam("assoc_id") final long assocId, final ViewProps viewProps) {
@PathParam("assocId") final long assocId, final ViewProps viewProps) {
try {
// Note: a Mapcontext association must have no workspace assignment as it is "system" owned
dmx.getPrivilegedAccess().runWithoutWorkspaceAssignment(new Callable<Void>() { // throws Exception
......@@ -207,12 +207,12 @@ public class TopicmapsPlugin extends PluginActivator implements TopicmapsService
}
@POST
@Path("/{id}/topic/{topic_id}/assoc/{assoc_id}")
@Path("/{id}/topic/{topicId}/assoc/{assocId}")
@Transactional
@Override
public void addRelatedTopicToTopicmap(@PathParam("id") final long topicmapId,
@PathParam("topic_id") final long topicId,
@PathParam("assoc_id") final long assocId, final ViewProps viewProps) {
@PathParam("topicId") final long topicId,
@PathParam("assocId") final long assocId, final ViewProps viewProps) {
try {
// Note: a Mapcontext association must have no workspace assignment as it is "system" owned
dmx.getPrivilegedAccess().runWithoutWorkspaceAssignment(new Callable<Void>() { // throws Exception
......@@ -244,28 +244,28 @@ public class TopicmapsPlugin extends PluginActivator implements TopicmapsService
// ---
@PUT
@Path("/{id}/topic/{topic_id}")
@Path("/{id}/topic/{topicId}")
@Transactional
@Override
public void setTopicViewProps(@PathParam("id") long topicmapId, @PathParam("topic_id") long topicId,
public void setTopicViewProps(@PathParam("id") long topicmapId, @PathParam("topicId") long topicId,
ViewProps viewProps) {
storeTopicViewProps(topicmapId, topicId, viewProps);
}
@PUT
@Path("/{id}/assoc/{assoc_id}")
@Path("/{id}/assoc/{assocId}")
@Transactional
@Override
public void setAssocViewProps(@PathParam("id") long topicmapId, @PathParam("assoc_id") long assocId,
public void setAssocViewProps(@PathParam("id") long topicmapId, @PathParam("assocId") long assocId,
ViewProps viewProps) {
storeAssocViewProps(topicmapId, assocId, viewProps);
}
@PUT
@Path("/{id}/topic/{topic_id}/x/{x}/y/{y}")
@Path("/{id}/topic/{topicId}/x/{x}/y/{y}")
@Transactional
@Override
public void setTopicPosition(@PathParam("id") long topicmapId, @PathParam("topic_id") long topicId,
public void setTopicPosition(@PathParam("id") long topicmapId, @PathParam("topicId") long topicId,
@PathParam("x") int x, @PathParam("y") int y) {
try {
storeTopicViewProps(topicmapId, topicId, mf.newViewProps(x, y));
......@@ -287,10 +287,10 @@ public class TopicmapsPlugin extends PluginActivator implements TopicmapsService
}
@PUT
@Path("/{id}/topic/{topic_id}/visibility/{visibility}")
@Path("/{id}/topic/{topicId}/visibility/{visibility}")
@Transactional
@Override
public void setTopicVisibility(@PathParam("id") long topicmapId, @PathParam("topic_id") long topicId,
public void setTopicVisibility(@PathParam("id") long topicmapId, @PathParam("topicId") long topicId,
@PathParam("visibility") boolean visibility) {
try {
// TODO: idempotence?
......@@ -302,10 +302,10 @@ public class TopicmapsPlugin extends PluginActivator implements TopicmapsService
}
@PUT
@Path("/{id}/assoc/{assoc_id}/visibility/{visibility}")
@Path("/{id}/assoc/{assocId}/visibility/{visibility}")
@Transactional
@Override
public void setAssocVisibility(@PathParam("id") long topicmapId, @PathParam("assoc_id") long assocId,
public void setAssocVisibility(@PathParam("id") long topicmapId, @PathParam("assocId") long assocId,
@PathParam("visibility") boolean visibility) {
try {
Assoc assocMapcontext = getAssocMapcontext(topicmapId, assocId);
......@@ -409,7 +409,7 @@ public class TopicmapsPlugin extends PluginActivator implements TopicmapsService
// Note: not part of topicmaps service
@GET
@Path("/{id}/topic/{topic_id}")
@Path("/{id}/topic/{topicId}")
@Produces("text/html")
public InputStream getTopicmapAndTopicInWebclient() {
// Note: the path parameters are evaluated at client-side
......
......@@ -164,10 +164,10 @@ public class WorkspacesPlugin extends PluginActivator implements WorkspacesServi
// Note: part of REST API, not part of OSGi service
@PUT
@Path("/{workspace_id}/object/{object_id}")
@Path("/{workspaceId}/object/{objectId}")
@Transactional
public DirectivesResponse assignToWorkspace(@PathParam("object_id") long objectId,
@PathParam("workspace_id") long workspaceId) {
public DirectivesResponse assignToWorkspace(@PathParam("objectId") long objectId,
@PathParam("workspaceId") long workspaceId) {
try {
DMXObject object = dmx.getObject(objectId);
checkAssignmentArgs(object, workspaceId);
......
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