mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-31 12:52:13 +00:00
Modify ACL routes (#1025)
This commit is contained in:
parent
8b846ecf96
commit
fb2b478885
@ -351,18 +351,20 @@ public class Dataset extends Controller {
|
||||
return Promise.promise(() -> unauthorized(_EMPTY_RESPONSE));
|
||||
}
|
||||
|
||||
String accessType = request().getQueryString("accessType");
|
||||
String businessJustification = request().getQueryString("businessJustification");
|
||||
Long expireAt = NumberUtils.toLong(request().getQueryString("expireAt"), 0);
|
||||
if (businessJustification == null) {
|
||||
JsonNode record = request().body().asJson();
|
||||
|
||||
String accessType = record.hasNonNull("accessType") ? record.get("accessType").asText() : null;
|
||||
Long expiresAt = record.hasNonNull("expiresAt") ? record.get("expiresAt").asLong() : null;
|
||||
if (!record.hasNonNull("businessJustification")) {
|
||||
return Promise.promise(() -> badRequest(errorResponse("Missing business justification")));
|
||||
}
|
||||
String businessJustification = request().getQueryString("businessJustification");
|
||||
|
||||
try {
|
||||
if (accessType == null) {
|
||||
ACL_DAO.addUserToDatasetAcl(datasetUrn, username, businessJustification);
|
||||
} else {
|
||||
ACL_DAO.addUserToDatasetAcl(datasetUrn, username, accessType, businessJustification, expireAt);
|
||||
ACL_DAO.addUserToDatasetAcl(datasetUrn, username, accessType, businessJustification, expiresAt);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error("Add user to ACL error", e);
|
||||
|
@ -308,9 +308,9 @@ GET /api/v2/datasets/:urn/compliance/suggestion
|
||||
|
||||
GET /api/v2/datasets/:urn/acl controllers.api.v2.Dataset.getDatasetAcls(urn: String)
|
||||
|
||||
POST /api/v2/datasets/:urn/acl/add controllers.api.v2.Dataset.addUserToDatasetAcl(urn: String)
|
||||
PUT /api/v2/datasets/:urn/acl/add controllers.api.v2.Dataset.addUserToDatasetAcl(urn: String)
|
||||
|
||||
PUT /api/v2/datasets/:urn/acl/remove controllers.api.v2.Dataset.removeUserFromDatasetAcl(urn: String)
|
||||
DELETE /api/v2/datasets/:urn/acl/remove controllers.api.v2.Dataset.removeUserFromDatasetAcl(urn: String)
|
||||
|
||||
# Map static resources from the /public folder to the /assets URL path
|
||||
GET /assets/*file controllers.Assets.at(path="/public", file)
|
||||
|
Loading…
x
Reference in New Issue
Block a user