arturobernalg opened a new pull request, #655:
URL: https://github.com/apache/jspwiki/pull/655
This takes over #484 (JSPWIKI-1210). The first commit is the original work
of Alex O'Ree, rebased on master. The second one reworks it after the three
problems found in the review of #484.
An access rule can now combine roles, groups and users, for example `[{ALLOW
edit Editors AND (Reviewers OR NOT Banned)}]`.
What changed on top of the first commit:
* The advanced rules are kept by the `AclImpl` of the page, next to its
entries, and no longer in a class that replaces the Acl. A page can mix simple
and advanced rules in any order, and the rules of the same action add up, as
the simple ones do. This fixes the lost simple rule and the "Not supported
yet." error when saving a page.
* `DefaultAuthorizationManager` grants a permission to the users that
satisfy any rule that implies it, and denies it when none does. A page with
only `[{ALLOW edit Admin OR Editors}]` is no longer readable by anonymous
users, as with a simple rule.
* A name counts as held only if the user has that role, group or user
principal. The first version added the login name of the session, so an
asserted name (a cookie) satisfied a rule.
* `AND`, `OR` and `NOT` are read only in upper case. A rule is advanced only
when one of them is a word of its own, so names such as ANDY or ORACLE and
lower case words stay names. A comma cannot be mixed with them. A rule that
does not parse is reported as an invalid access rule.
* `DefaultAclManager.printAcl` writes the advanced rules too.
* The `jspwiki.authZManager` property and the protected engine field are
removed, as nothing needs them now.
Cost and limits:
* A simple rule that has a name with spaces and an upper case AND, OR or NOT
inside it (for example a group called `Sales OR Marketing`) is now read as an
advanced rule. I did not find such a rule in the default pages.
* NOT is true for every user that does not hold the name, anonymous users
included. Use `Authenticated AND NOT Banned`, not only `NOT Banned`, to grant
to logged in users. The policy file still has to grant the permission.
* Names with spaces cannot be used in an advanced rule.
Tests: new `AdvancedAclAuthorizationTest` with anonymous, asserted and
authenticated sessions and wiki groups, new cases in `DefaultAclManagerTest`
and a stricter `RuleParserTest`. The whole `jspwiki-main` module passes (1217
tests). I also ran the war in Tomcat 10.1 with registered users and checked an
advanced rule alone, a simple one before an advanced one, an advanced one
before a simple one, and `Authenticated AND NOT`: anonymous users go to the
login page, the allowed users view and edit, the others cannot edit, and the
page text is shown.
--
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]