There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-faaee302-a96f-4323-a8ad-6c0fc18fc836 XWIKI-24702 Open

Create/check for automated tests for "Deny Edit Rights for an user"

 
View issue   ยท   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-37460bd5-423b-4579-84ce-38c9b8895fa3 Vincent Massol on 14/Aug/26 19:57
 

Checked whether an automated test already existed for this manual test: there was none.

The closest existing test is DefaultAuthorizationManagerIntegrationTest#groupAccess, whose docDenyGroupA / docDenyGroupB documents deny all rights to a group at document level: the edit right is only covered incidentally there, nothing isolates it, and nothing asserts what happens to the users the rule is not targeting. On the functional side, UsersGroupsRightsManagementIT#allowGroupRightsAtPageLevelWhenUserRightDeniedAtWikiLevel denies the edit right to a user at wiki level, not at page level.

Added the test at the authorization-engine level rather than as a functional test, as was done for XWIKI-24701. The expected result of the manual test โ€” "the user is not allowed to edit that page" โ€” is pure authorization semantics, and the engine level lets the three assertions the manual test implies but doesn't state all be covered in a few milliseconds instead of a few minutes of browser time: the edit right is gone on that document, the user's other rights (view, comment) survive, and a user the rule is not targeting keeps the edit right. The rights-editor UI path the manual test describes is already exercised by UsersGroupsRightsManagementIT.

Test added: DefaultAuthorizationManagerIntegrationTest#userDenyEditAtDocumentLevel, with a new testwikis/userDenyEditAtDocumentLevel.xml fixture โ€” a wiki without any rule, and a document carrying a single denyUser type="edit" rule for userA. The contrast with userB, which keeps the edit right on that same document, is what keeps the assertion from being vacuous.

PR: https://github.com/xwiki/xwiki-platform/pull/6168