Skip to content

Commit

Permalink
Refactor AAclAuthz.addACLs()
Browse files Browse the repository at this point in the history
The code that adds an already parsed ACL object in
AAclAuthz.addACLs() has been moved into a separate method.
  • Loading branch information
edewata committed May 5, 2023
1 parent 7d6ab78 commit b87ef09
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ public void addACLs(String resACLs) throws EACLsException {
return;
}

addACLs(acl);
}

public void addACLs(ACL acl) throws EACLsException {

ACL curACL = mACLs.get(acl.getName());

if (curACL == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ public synchronized void loadACLs() throws EACLsException {
Enumeration<String> en = aclRes.getStringValues();

while (en.hasMoreElements()) {
String acl = en.nextElement();
logger.info("DirAclAuthz: - " + acl);
String resACLs = en.nextElement();

ACL acl = ACL.parseACL(resACLs);
logger.info("DirAclAuthz: - " + acl.getName());

// call super.addACLs() directly to avoid re-entering loadACLs()
super.addACLs(acl);
Expand All @@ -213,6 +215,12 @@ public void addACLs(String resACLs) throws EACLsException {
super.addACLs(resACLs);
}

@Override
public void addACLs(ACL acl) throws EACLsException {
if (!loaded) loadACLs();
super.addACLs(acl);
}

@Override
public void accessInit(String accessInfo) throws EBaseException {
if (!loaded) loadACLs();
Expand Down

0 comments on commit b87ef09

Please sign in to comment.