Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="PermissionUtil") public interface PermissionUtil
An instance of the Sitevision class implementing this interface can be obtained via Utils.getPermissionUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
Modifier and Type | Interface and Description |
---|---|
static class |
PermissionUtil.Permission
The named permission demarcation, used by
PermissionUtil . |
Modifier and Type | Method and Description |
---|---|
boolean |
hasAnonymousReadPermission()
Checks if a non-authenticated user has read permission on current page.
|
boolean |
hasAnonymousReadPermission(Node aTreeNode)
Checks if a non-authenticated user has read permission on a certain tree node.
|
boolean |
hasCreateArchivePermission(Node aParentNode,
Node aUserNode)
Checks if a certain user has create archive permission on a certain page tree node.
|
boolean |
hasCreateArticlePermission(Node aParentNode,
Node aUserNode)
Checks if a certain user has create article permission on a certain page tree node.
|
boolean |
hasCreateFolderPermission(Node aParentNode,
Node aUserNode)
Checks if a certain user has create folder permission on a certain tree node.
|
boolean |
hasCreatePagePermission(Node aParentNode,
Node aUserNode)
Checks if a certain user has create page permission on a certain page tree node.
|
boolean |
hasDeletePermission(Node aTreeNode,
Node aUserNode)
Checks if a certain user has delete permission on a certain tree node.
|
boolean |
hasEffectiveDeletePermission(Node aTreeNode,
Node aUserNode)
Checks if a certain user has effective delete permission on a certain tree node.
|
boolean |
hasEffectivePublishPermission(Node aPageNode,
Node aUserNode)
Checks if a certain user has effective publish permission on a certain page tree node.
|
boolean |
hasEffectiveWritePermission(Node aTreeNode,
Node aUserNode)
Checks if a certain user has effective write permission on a certain tree node.
|
boolean |
hasPermission(Node aTreeNode,
Node aUserNode,
PermissionUtil.Permission aPermission)
Checks if a certain user has a certain permission on a certain tree node.
|
boolean |
hasPermission(Node aTreeNode,
PermissionUtil.Permission aPermission)
Checks if current user has certain permission on a certain tree node.
|
boolean |
hasPermission(PermissionUtil.Permission aPermission)
Checks if current user has a certain permission on current page.
|
boolean |
hasPermissions(Node aTreeNode,
Node aUserNode,
PermissionUtil.Permission... aPermissions)
Checks if a certain user has certain permissions on a certain tree node.
|
boolean |
hasPermissions(Node aTreeNode,
PermissionUtil.Permission... aPermissions)
Checks if current user has certain permissions on a certain tree node.
|
boolean |
hasPermissions(PermissionUtil.Permission... aPermissions)
Checks if current user has certain permissions on current page.
|
boolean |
hasPublishPermission(Node aPageNode,
Node aUserNode)
Checks if a certain user has publish permission on a certain page tree node.
|
boolean |
hasReadPermission()
Checks if current user has read permission on current page.
|
boolean |
hasReadPermission(Node aTreeNode,
Node aUserNode)
Checks if a certain user has read permission on a certain tree node.
|
boolean |
hasWritePermission()
Checks if current user has write permission on current page.
|
boolean |
hasWritePermission(Node aTreeNode,
Node aUserNode)
Checks if a certain user has write permission on a certain tree node.
|
boolean |
hasWriteSubscriptionPermission(Node aTreeNode,
Node aUserNode)
Checks if a certain user has write subscription permission on a certain page tree node.
|
boolean hasAnonymousReadPermission()
This is a convenience method for hasAnonymousReadPermission(Node)
that uses PortletContextUtil to get
current page
.
Note! RESTApps has no "current page" concept whatsoever.
A RESTApp should therefore typically never use any convenience method that relies on "current page".
This method uses the site page
as "current page" for best effort when invoked from a RESTApp. Beware of unexpected results and also note
that RESTApps has its own complementary restrictions (e.g. only some users can call certain http methods,
incoming http requests can be completely blocked etc).
true
if an anonymous user has read permission on current page (e.g. "page is public"),
false
if not or if indeterminable (i.e. current page can not be determined)hasAnonymousReadPermission(Node)
boolean hasAnonymousReadPermission(Node aTreeNode)
aTreeNode
- a node in the page/template/file/image treehasAnonymousReadPermission()
boolean hasReadPermission()
This is a convenience method for hasReadPermission(Node, Node)
that uses PortletContextUtil to get
current page
and
current user
.
Note! RESTApps has no "current page" concept whatsoever.
A RESTApp should therefore typically never use any convenience method that relies on "current page".
This method uses the site page
as "current page" for best effort when invoked from a RESTApp. Beware of unexpected results and also note
that RESTApps has its own complementary restrictions (e.g. only some users can call certain http methods,
incoming http requests can be completely blocked etc).
hasReadPermission(Node, Node)
boolean hasReadPermission(Node aTreeNode, Node aUserNode)
aTreeNode
- a node in the page/template/file/image treeaUserNode
- a user node (or a user identity node)hasReadPermission()
boolean hasWritePermission()
This is a convenience method for hasWritePermission(Node, Node)
that uses PortletContextUtil to get
current page
and
current user
.
Note! RESTApps has no "current page" concept whatsoever.
A RESTApp should therefore typically never use any convenience method that relies on "current page".
This method uses the site page
as "current page" for best effort when invoked from a RESTApp. Beware of unexpected results and also note
that RESTApps has its own complementary restrictions (e.g. only some users can call certain http methods,
incoming http requests can be completely blocked etc).
hasWritePermission(Node, Node)
boolean hasWritePermission(Node aTreeNode, Node aUserNode)
aTreeNode
- a node in the page/template/file/image treeaUserNode
- a user node (or a user identity node)hasEffectiveWritePermission(Node, Node)
boolean hasEffectiveWritePermission(Node aTreeNode, Node aUserNode)
This is a extended version of hasWritePermission(Node, Node)
that delivers a more accurate runtime result.
Even though a User strict formally has PermissionUtil.Permission.WRITE
permission on a Node, some additional state might
in practice prohibit actual write operations anyway. This method also checks such cases. For example:
PermissionUtil.Permission.MANAGE_PUBLISHING_PROJECT
Note! This method is more reliable than its static "hasWritePermission" sibling, but in a runtime environment anything can happen at any given time! Hence, even if this method returns true - there are absolutely no guarantee that the true state will remain when an actual mutating operation is performed shortly after.
aTreeNode
- a node in the page/template/file/image treeaUserNode
- a user node (or a user identity node)hasWritePermission(Node, Node)
boolean hasPublishPermission(Node aPageNode, Node aUserNode)
aPageNode
- a publishable node in the page treeaUserNode
- a user node (or a user identity node)hasEffectivePublishPermission(Node, Node)
boolean hasEffectivePublishPermission(Node aPageNode, Node aUserNode)
This is a extended version of hasPublishPermission(Node, Node)
that delivers a more accurate runtime result.
Even though a User strict formally has PermissionUtil.Permission.PUBLISH
permission on a Node, some additional state might
in practice prohibit actual publish operations anyway. This method also checks such cases. For example:
Note! This method is more reliable than its static "hasPublishPermission" sibling, but in a runtime environment anything can happen at any given time! Hence, even if this method returns true - there are absolutely no guarantee that the true state will remain when an actual publish operation is performed shortly after.
aPageNode
- a publishable node in the page/template/decorations treeaUserNode
- a user node (or a user identity node)hasPublishPermission(Node, Node)
boolean hasWriteSubscriptionPermission(Node aTreeNode, Node aUserNode)
aTreeNode
- a subscriptionable node in the page treeaUserNode
- a user node (or a user identity node)boolean hasDeletePermission(Node aTreeNode, Node aUserNode)
aTreeNode
- a node in the page/template/file/image treeaUserNode
- a user node (or a user identity node)hasEffectiveDeletePermission(Node, Node)
boolean hasEffectiveDeletePermission(Node aTreeNode, Node aUserNode)
This is a extended version of hasDeletePermission(Node, Node)
that delivers a more accurate runtime result.
Even though a User strict formally has PermissionUtil.Permission.DELETE
and PermissionUtil.Permission.WRITE
permission on a Node, some additional
state might in practice prohibit actual delete operations anyway. This method also checks such cases. For example:
PermissionUtil.Permission.MANAGE_PUBLISHING_PROJECT
Note! This method is more reliable than its static "hasDeletePermission" sibling, but in a runtime environment anything can happen at any given time! Hence, even if this method returns true - there are absolutely no guarantee that the true state will remain when an actual delete operation is performed shortly after.
aTreeNode
- a node in the page/template/file/image treeaUserNode
- a user node (or a user identity node)hasDeletePermission(Node, Node)
boolean hasCreatePagePermission(Node aParentNode, Node aUserNode)
aParentNode
- a parent node (the parent of the page that should be created)aUserNode
- a user node (or a user identity node)boolean hasCreateArticlePermission(Node aParentNode, Node aUserNode)
aParentNode
- a parent node (the parent of the article that should be created)aUserNode
- a user node (or a user identity node)boolean hasCreateArchivePermission(Node aParentNode, Node aUserNode)
aParentNode
- a parent node (the parent of the archive that should be created)aUserNode
- a user node (or a user identity node)boolean hasCreateFolderPermission(Node aParentNode, Node aUserNode)
aParentNode
- a parent node (the parent of the folder that should be created)aUserNode
- a user node (or a user identity node)boolean hasPermission(PermissionUtil.Permission aPermission)
This is a convenience method for hasPermission(Node, Node, Permission)
that uses PortletContextUtil to get
current page
and
current user
.
Note! RESTApps has no "current page" concept whatsoever.
A RESTApp should therefore typically never use any convenience method that relies on "current page".
This method uses the site page
as "current page" for best effort when invoked from a RESTApp. Beware of unexpected results and also note
that RESTApps has its own complementary restrictions (e.g. only some users can call certain http methods,
incoming http requests can be completely blocked etc).
aPermission
- the permission to checkhasPermission(Node, Permission)
,
hasPermission(Node, Node, Permission)
boolean hasPermissions(PermissionUtil.Permission... aPermissions)
This is a convenience method for hasPermissions(Node, Node, Permission...)
that uses PortletContextUtil to get
current page
and
current user
.
Note! RESTApps has no "current page" concept whatsoever.
A RESTApp should therefore typically never use any convenience method that relies on "current page".
This method uses the site page
as "current page" for best effort when invoked from a RESTApp. Beware of unexpected results and also note
that RESTApps has its own complementary restrictions (e.g. only some users can call certain http methods,
incoming http requests can be completely blocked etc).
aPermissions
- the permissions to checkhasPermissions(Node, Permission...)
,
hasPermissions(Node, Node, Permission...)
boolean hasPermission(Node aTreeNode, PermissionUtil.Permission aPermission)
aTreeNode
- a node in the page/template/file/image treeaPermission
- the permission to checkhasPermission(Permission)
,
hasPermission(Node, Node, Permission)
boolean hasPermissions(Node aTreeNode, PermissionUtil.Permission... aPermissions)
aTreeNode
- a node in the page/template/file/image treeaPermissions
- the permissions to checkhasPermissions(Permission...)
,
hasPermissions(Node, Node, Permission...)
boolean hasPermission(Node aTreeNode, Node aUserNode, PermissionUtil.Permission aPermission)
aTreeNode
- a node in the page/template/file/image treeaUserNode
- a user node (or a user identity node)aPermission
- the permission to checkhasPermission(Permission)
,
hasPermission(Node, Permission)
boolean hasPermissions(Node aTreeNode, Node aUserNode, PermissionUtil.Permission... aPermissions)
aTreeNode
- a node in the page/template/file/image treeaUserNode
- a user node (or a user identity node)aPermissions
- the permissions to checkhasPermissions(Permission...)
,
hasPermissions(Node, Permission...)
Sitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.