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));
|
return Promise.promise(() -> unauthorized(_EMPTY_RESPONSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
String accessType = request().getQueryString("accessType");
|
JsonNode record = request().body().asJson();
|
||||||
String businessJustification = request().getQueryString("businessJustification");
|
|
||||||
Long expireAt = NumberUtils.toLong(request().getQueryString("expireAt"), 0);
|
String accessType = record.hasNonNull("accessType") ? record.get("accessType").asText() : null;
|
||||||
if (businessJustification == null) {
|
Long expiresAt = record.hasNonNull("expiresAt") ? record.get("expiresAt").asLong() : null;
|
||||||
|
if (!record.hasNonNull("businessJustification")) {
|
||||||
return Promise.promise(() -> badRequest(errorResponse("Missing business justification")));
|
return Promise.promise(() -> badRequest(errorResponse("Missing business justification")));
|
||||||
}
|
}
|
||||||
|
String businessJustification = request().getQueryString("businessJustification");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (accessType == null) {
|
if (accessType == null) {
|
||||||
ACL_DAO.addUserToDatasetAcl(datasetUrn, username, businessJustification);
|
ACL_DAO.addUserToDatasetAcl(datasetUrn, username, businessJustification);
|
||||||
} else {
|
} else {
|
||||||
ACL_DAO.addUserToDatasetAcl(datasetUrn, username, accessType, businessJustification, expireAt);
|
ACL_DAO.addUserToDatasetAcl(datasetUrn, username, accessType, businessJustification, expiresAt);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error("Add user to ACL error", 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)
|
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
|
# Map static resources from the /public folder to the /assets URL path
|
||||||
GET /assets/*file controllers.Assets.at(path="/public", file)
|
GET /assets/*file controllers.Assets.at(path="/public", file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user