Class WikiUserPermissions
java.lang.Object
fr.paris.lutece.plugins.wiki.service.security.WikiUserPermissions
Snapshot of everything that grants a user access to wiki items: the roles carried by the
session, the permissions granted to the user individually or to a population they belong to,
and the RBAC permissions granted to the roles the user carries.
The roles come from the session, so building a snapshot costs nothing. The reads gathering the
granted permissions are issued on the first item check and never again, so a single build
serves any number of checks, and a role-only check costs no query at all.
-
Method Summary
Modifier and TypeMethodDescriptionstatic WikiUserPermissionsforUser(fr.paris.lutece.portal.service.security.LuteceUser user) Builds the snapshot of a user, reading their roles from the session.booleanTells whether the user carries the given role.booleanTells whether the user is allowed to edit the item, either individually or through a role.booleanTells whether the user is allowed to view the item, either individually or through a role.
-
Method Details
-
forUser
Builds the snapshot of a user, reading their roles from the session.- Parameters:
user- the Lutece user, may be null for an anonymous visitor- Returns:
- the permissions of that user
-
hasRole
Tells whether the user carries the given role.- Parameters:
strRole- the role key- Returns:
- true when the user carries it
-
isAllowedToView
Tells whether the user is allowed to view the item, either individually or through a role.- Parameters:
item- the wiki item- Returns:
- true when allowed
-
isAllowedToEdit
Tells whether the user is allowed to edit the item, either individually or through a role.- Parameters:
item- the wiki item- Returns:
- true when allowed
-