xunliu commented on code in PR #5113:
URL: https://github.com/apache/gravitino/pull/5113#discussion_r1806691569
##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationPlugin.java:
##########
@@ -522,36 +657,35 @@ private boolean
doRemoveSecurableObject(RoleChange.RemoveSecurableObject change)
return true;
}
- /**
- * 1. Find the policy base the metadata object. <br>
- * 2. If the policy exists, then user new securable object's privilege to
update. <br>
- * 3. If the policy does not exist, return false. <br>
- */
- private boolean doUpdateSecurableObject(RoleChange.UpdateSecurableObject
change) {
- RangerPolicy policy =
rangerHelper.findManagedPolicy(change.getSecurableObject());
- if (policy == null) {
- LOG.warn(
- "Cannot find the Ranger policy({}) for the Gravitino securable
object({})!",
- change.getRoleName(),
- change.getSecurableObject().fullName());
- // Don't throw exception or return false, because need support immutable
operation.
- return false;
- }
-
- rangerHelper.removePolicyItem(policy, change.getRoleName(),
change.getSecurableObject());
- rangerHelper.addPolicyItem(policy, change.getRoleName(),
change.getNewSecurableObject());
- try {
- if (policy.getId() == null) {
- rangerClient.createPolicy(policy);
- } else {
- rangerClient.updatePolicy(policy.getId(), policy);
- }
- } catch (RangerServiceException e) {
- throw new RuntimeException(e);
- }
- return true;
- }
-
@Override
public void close() throws IOException {}
+
+ public boolean validAuthorizationOperation(List<SecurableObject>
securableObjects) {
Review Comment:
DONE
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]