Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWIKI-22815: Variable $isSuperAdmin is not computed correctly on subwikis #3877

Merged
merged 4 commits into from
Feb 27, 2025

Conversation

manuelleduc
Copy link
Contributor

@manuelleduc manuelleduc commented Feb 6, 2025

Jira URL

https://jira.xwiki.org/browse/XWIKI-22815

Changes

Description

  • generalize the condition for $isSuperAdmin to make it work on sub-wikis.

Duplicated/inconsistent definitions of isSuperAdmin:

  • com.xpn.xwiki.internal.plugin.rightsmanager.UserIterator#isSuperAdmin
  • com.xpn.xwiki.user.api.XWikiRightService#isSuperAdmin
  • com.xpn.xwiki.user.api.XWikiUser#isSuperAdmin (using com.xpn.xwiki.user.api.XWikiRightService#isSuperAdmin)
  • com.xpn.xwiki.user.impl.xwiki.AbstractXWikiAuthService#isSuperAdmin
  • com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl#isSuperAdmin
  • com.xpn.xwiki.internal.template.InternalTemplateManager.FilesystemTemplateContent#isPrivileged
  • com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl#isSuperAdmin
  • com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl#isSuperAdminOrProgramming
  • org.xwiki.test.checker.internal.ProgrammingRightCheckerAuthorizationManager#check(org.xwiki.model.reference.DocumentReference, com.xpn.xwiki.doc.XWikiDocument)
  • org.xwiki.user.internal.document.AbstractUserReferenceResolver#isSuperAdmin
  • org.xwiki.user.internal.document.AbstractUserReferenceResolver#isSuperAdmin

Clarifications

  • the current implementation stays on string comparison. Let me know if using a proper entity reference comparison is preferable (couldn't find an existing script API).

Screenshots & Video

N/A

Executed Tests

  • Build of xwiki-platform-web-templates
  • Manual tests on sub-wikis
  • Also, I found the condition $isAdvancedUser || $isSuperAdmin in at least 16 places, but afaiu $isSuperAdmin implies $isAdvancedUser, making the right hand side of the OR condition superfluous

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • stable-16.4.x
    • stable-16.10.x

@manuelleduc manuelleduc changed the title XWIKI-22815: Variable is not computed correctly on subwikis XWIKI-22815: Variable $isSuperAdmin is not computed correctly on subwikis Feb 27, 2025
@manuelleduc
Copy link
Contributor Author

The current PR is ok for the reported issue, but does not fix the inconsistency/duplication issue (yet)

@manuelleduc
Copy link
Contributor Author

I created https://jira.xwiki.org/browse/XWIKI-22942 for the remaining isSuperAdmin checks

Copy link

💚 All backports created successfully

Status Branch Result
stable-16.4.x
stable-16.10.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

manuelleduc added a commit that referenced this pull request Feb 27, 2025
…ikis (#3877) (#3941)

(cherry picked from commit 51718c8)

Co-authored-by: Manuel Leduc <manuel.leduc@xwiki.com>
manuelleduc added a commit that referenced this pull request Feb 27, 2025
…ikis (#3877) (#3942)

(cherry picked from commit 51718c8)

Co-authored-by: Manuel Leduc <manuel.leduc@xwiki.com>
Sereza7 pushed a commit to Sereza7/xwiki-platform that referenced this pull request Mar 21, 2025
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