42bb0e6abe8055bdc5be40863b2c7b22a3eee5eb
java/com.sap.sse.security/src/com/sap/sse/security/jaxrs/api/OwnershipResource.java
| ... | ... | @@ -9,6 +9,7 @@ import java.util.Set; |
| 9 | 9 | import java.util.UUID; |
| 10 | 10 | |
| 11 | 11 | import javax.ws.rs.Consumes; |
| 12 | +import javax.ws.rs.DELETE; |
|
| 12 | 13 | import javax.ws.rs.GET; |
| 13 | 14 | import javax.ws.rs.PUT; |
| 14 | 15 | import javax.ws.rs.Path; |
| ... | ... | @@ -107,6 +108,18 @@ public class OwnershipResource extends AbstractSecurityResource { |
| 107 | 108 | return getOwnership(objectType, new String[] { typeRelativeObjectId }); |
| 108 | 109 | } |
| 109 | 110 | |
| 111 | + @Path("{objectType}/{typeRelativeObjectId}") |
|
| 112 | + @DELETE |
|
| 113 | + @Produces("application/json;charset=UTF-8") |
|
| 114 | + public Response deleteOwnership(@PathParam("objectType") String objectType, |
|
| 115 | + @PathParam("typeRelativeObjectId") String typeRelativeObjectId) throws OwnershipException { |
|
| 116 | + QualifiedObjectIdentifier identifier = new QualifiedObjectIdentifierImpl(objectType, |
|
| 117 | + new TypeRelativeObjectIdentifier(typeRelativeObjectId)); |
|
| 118 | + SecurityUtils.getSubject().checkPermission(identifier.getStringPermission(DefaultActions.CHANGE_OWNERSHIP)); |
|
| 119 | + getSecurityService().deleteOwnership(identifier); |
|
| 120 | + return Response.ok().build(); |
|
| 121 | + } |
|
| 122 | + |
|
| 110 | 123 | @Path("{objectType}") |
| 111 | 124 | @GET |
| 112 | 125 | @Produces("application/json;charset=UTF-8") |
| ... | ... | @@ -198,4 +211,16 @@ public class OwnershipResource extends AbstractSecurityResource { |
| 198 | 211 | } |
| 199 | 212 | return Response.ok(new GeneralResponse(true, "ACL changed successfully").toString()).build(); |
| 200 | 213 | } |
| 214 | + |
|
| 215 | + @Path("{objectType}/{typeRelativeObjectId}/"+KEY_ACL) |
|
| 216 | + @DELETE |
|
| 217 | + @Produces("application/json;charset=UTF-8") |
|
| 218 | + public Response deleteAccessControlLists(@PathParam("objectType") String objectType, |
|
| 219 | + @PathParam("typeRelativeObjectId") String typeRelativeObjectId) throws OwnershipException { |
|
| 220 | + QualifiedObjectIdentifier identifier = new QualifiedObjectIdentifierImpl(objectType, |
|
| 221 | + new TypeRelativeObjectIdentifier(typeRelativeObjectId)); |
|
| 222 | + SecurityUtils.getSubject().checkPermission(identifier.getStringPermission(DefaultActions.CHANGE_ACL)); |
|
| 223 | + getSecurityService().deleteAccessControlList(identifier); |
|
| 224 | + return Response.ok().build(); |
|
| 225 | + } |
|
| 201 | 226 | } |
java/com.sap.sse.security/webservices/api/ownership.html
| ... | ... | @@ -93,6 +93,22 @@ |
| 93 | 93 | <td><code>curl "http://127.0.0.1:8888/security/api/restsecurity/ownership/TRACKED_RACE?id=Croatia%20Coast%20Cup%202019%20-%20ORC%20with%20Spinnaker&id=Race%201%20-%20ORC%20mit%20Spi"</code><br> |
| 94 | 94 | Will provide a JSON document as explained above.</td> |
| 95 | 95 | </tr> |
| 96 | + <tr> |
|
| 97 | + <td>Request Method:</td> |
|
| 98 | + <td>DELETE /{objectType}/{typeRelativeObjectId}</td> |
|
| 99 | + </tr> |
|
| 100 | + <tr> |
|
| 101 | + <td>Parameter (path)</td> |
|
| 102 | + <td> |
|
| 103 | + <div>objectType</div> Object type represents the type of object to delete the ownership information for |
|
| 104 | + <div>objectId</div> Unique Object id. |
|
| 105 | + </td> |
|
| 106 | + </tr> |
|
| 107 | + <tr> |
|
| 108 | + <td>Example:</td> |
|
| 109 | + <td><code>curl -i -X DELETE "http://admin:admin@127.0.0.1:8888/security/api/restsecurity/ownership/USER_GROUP/82832851-07ac-47ee-9ddf-6f4f9eaa7823"</code><br> |
|
| 110 | + Will delete the ownership information for the group identified. |
|
| 111 | + </tr> |
|
| 96 | 112 | |
| 97 | 113 | <tr> |
| 98 | 114 | <td>Request Method:</td> |
| ... | ... | @@ -102,7 +118,7 @@ |
| 102 | 118 | <td>Output format:</td> |
| 103 | 119 | <td>a JSON document of the following format<br> |
| 104 | 120 | <pre>{"objectType":"USER_GROUP","objectId":"82832851-07ac-47ee-9ddf-6f4f9eaa7823","displayName": null,"acl":[{"groupId":null,"actions":["READ","!DELETE"]},{"groupId":"82832851-07ac-47ee-9ddf-6f4f9eaa7823","actions":["READ","!UPDATE"]}]} |
| 105 | -</pre> |
|
| 121 | + </pre> |
|
| 106 | 122 | </td> |
| 107 | 123 | </tr> |
| 108 | 124 | <tr> |
| ... | ... | @@ -142,6 +158,23 @@ |
| 142 | 158 | <td><code>curl -i -X PUT -H 'Content-Type: application/json' -d '{"objectType":"USER_GROUP","objectId":"82832851-07ac-47ee-9ddf-6f4f9eaa7823","displayName":"The Admin Tenant ACL","acl":[{"groupId":null,"actions":["READ","!UPDATE"]},{"groupId":"82832851-07ac-47ee-9ddf-6f4f9eaa7823","actions":["READ","!DELETE"]}]}' "http://admin:admin@127.0.0.1:8888/security/api/restsecurity/ownership/USER_GROUP/82832851-07ac-47ee-9ddf-6f4f9eaa7823/acl"</code><br> |
| 143 | 159 | Will provide a JSON document as explained above.</td> |
| 144 | 160 | </tr> |
| 161 | + <tr> |
|
| 162 | + <td>Request Method:</td> |
|
| 163 | + <td>DELETE /{objectType}/{typeRelativeObjectId}/acl</td> |
|
| 164 | + </tr> |
|
| 165 | + <tr> |
|
| 166 | + <td>Parameter (path)</td> |
|
| 167 | + <td> |
|
| 168 | + <div>objectType</div> Object type represents the type of object to delete the ACL information for |
|
| 169 | + <div>objectId</div> Unique Object id. |
|
| 170 | + </td> |
|
| 171 | + </tr> |
|
| 172 | + <tr> |
|
| 173 | + <td>Example:</td> |
|
| 174 | + <td><code>curl -i -X DELETE "http://admin:admin@127.0.0.1:8888/security/api/restsecurity/ownership/USER_GROUP/82832851-07ac-47ee-9ddf-6f4f9eaa7823/acl"</code><br> |
|
| 175 | + Will delete the ACL information for the group identified. |
|
| 176 | + </tr> |
|
| 177 | + |
|
| 145 | 178 | |
| 146 | 179 | </table> |
| 147 | 180 | </body> |