Skip to content

JSPWIKI-1210 Advanced ACL rules, now supports AND/OR and NOT operator… - #484

Open
spyhunter99 wants to merge 1 commit into
apache:masterfrom
spyhunter99:feature/JSPWIKI-1210-acl-rules
Open

spyhunter99 wants to merge 1 commit into
apache:masterfrom
spyhunter99:feature/JSPWIKI-1210-acl-rules

Conversation

@spyhunter99

Copy link
Copy Markdown
Contributor

…s, as well as parenthesis

@spyhunter99

Copy link
Copy Markdown
Contributor Author

Well, i'll offer up a comment or two.

  • Not sure if we want it to be forced to AND/OR/NOT or also support lower case or mixed cases
  • Should the toggle logic for the advanced acl include a check for parenthesis too?
  • Should we entertain internationalize on the AND/OR/NOT operators? (i think no but...)

@arturobernalg

Copy link
Copy Markdown
Member

I tested this pull request merged into master 3a41a6d (head 7792b69). The ACL tests pass (48 tests), but none of them mixes simple and advanced rules in one page. On a running wiki (war in Tomcat 10.1 in Docker, with an anonymous browser, and master as the control) I found three problems.

  1. A page with only [{ALLOW edit Admin OR Editors}] can be viewed by an anonymous user, who sees its text. On master, and with a simple rule such as [{ALLOW edit Admin}], the anonymous user is sent to the login page, so restricting edit also restricts view. In DefaultAuthorizationManager the advanced branch returns true when the page has no rule for the permission that is asked (the node is null), where the simple ACL denies it.
  2. A simple rule followed by an advanced one loses the simple one. With [{ALLOW view Authenticated}] and then [{ALLOW edit Admin OR Editors}], the anonymous user is not sent to the login page. In DefaultAclManager.parseAcl a new AdvancedAcl replaces the Acl that the page already has. The body of that page came out empty in my run, which I did not explain.
  3. An advanced rule followed by a simple one fails when the page is saved: the error page of JSPWiki shows "Not supported yet.". It is the UnsupportedOperationException of AdvancedAcl.getAclEntry, which parseAcl calls for the simple rule.
    From reading the code, not tested: a line is read as advanced when it contains " AND ", " OR " or " NOT ", so an existing rule with a user or group name that has one of those words would change how it is read. I did not test the NOT operator beyond the existing tests, nor real groups or roles.

@spyhunter99

Copy link
Copy Markdown
Contributor Author

yup it needs work. we can bump to the next next version

@spyhunter99

Copy link
Copy Markdown
Contributor Author

or if you want to take it over, be my guest. i'm tied up with other activities unfortunately

@arturobernalg

Copy link
Copy Markdown
Member

Hi Alex, I took this over, as you offered. The work is now in #655: your commit rebased on master, plus further commits that fix the three problems from my review (anonymous users could view a page with only an advanced rule for edit, a simple rule followed by an advanced one was lost, and an advanced rule followed by a simple one failed on save). Thank you for the original work. If you can, please have a look at #655, and I will close this one once it is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants