Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-17900

Cannot register twice a Right with same description

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 12.6.3, 12.9-rc-1, 11.10.11
    • 12.6, 11.10.10
    • Security
    • None
    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      Apparently it's not possible to register twice a Right with the exact same description, contrarily to what the Javadoc indicates.
      Here's the javadoc about AuthorizationManager#register API:

      /**
           * Register a new custom {@link Right}.
           *
           * @param rightDescription the full description of the new {@link Right}
           * @return the created {@link Right}
           * @throws UnableToRegisterRightException if an error prevent creation of the new right. Registering exactly
           * the same right does not cause an exception and return the existing right.
           */
          Right register(RightDescription rightDescription) throws UnableToRegisterRightException;
      

      Here's the stacktrace I obtained when upgrading a Like extension which implied to register again the right Like:

      Caused by: org.xwiki.security.authorization.UnableToRegisterRightException: Unable to register right [Like].
      	at org.xwiki.security.authorization.DefaultAuthorizationManager.register(DefaultAuthorizationManager.java:209)
      	at org.xwiki.security.authorization.DefaultAuthorizationManager.register(DefaultAuthorizationManager.java:188)
      	at org.xwiki.like.internal.DefaultLikeManager.initialize(DefaultLikeManager.java:112)
      	... 154 common frames omitted
      Caused by: java.lang.IllegalArgumentException: Duplicate name for right [Like]
      	at org.xwiki.security.authorization.Right.checkIllegalArguments(Right.java:301)
      	at org.xwiki.security.authorization.Right.<init>(Right.java:239)
      	at org.xwiki.security.authorization.Right.<init>(Right.java:199)
      	at org.xwiki.security.authorization.DefaultAuthorizationManager.register(DefaultAuthorizationManager.java:200)
      

      Attachments

        Issue Links

          Activity

            People

              surli Simon Urli
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: