Details
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
- blocks
-
XWIKI-17761 Provide a new API for Ratings to allow create a RatingManager with a dedicated scale
- Closed
- is related to
-
XWIKI-17559 Allow to register a right as an implied right of an already existing right
- Closed