info.magnolia.cms.security
Class PermissionUtil

java.lang.Object
  extended by info.magnolia.cms.security.PermissionUtil

public class PermissionUtil
extends Object

Collection of methods for handling permission related processing.

Version:
$Id$

Constructor Summary
PermissionUtil()
           
 
Method Summary
static AccessManager getAccessManager(String workspace, Subject subject)
          Creates instance of AccessManager configured with subject principal permissions for requested workspace/repository.
static boolean isGranted(javax.jcr.Node node, long requiredPermissions)
          Convenience call hiding all ugly details of permission conversions.
static boolean isGranted(javax.jcr.Session jcrSession, String path, long oldPermissions)
          Return whether given session has requested permission on provided path.
static boolean isGranted(javax.jcr.Session jcrSession, String path, String action)
          Return whether given session has requested permission on provided path.
static boolean isGranted(String workspace, String path, String requiredPermissions)
          Convenience call hiding all ugly details of permission conversions.
static void verifyIsGrantedOrThrowException(javax.jcr.Session jcrSession, String path, String action)
          Checks whether given session has requested permission on provided path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PermissionUtil

public PermissionUtil()
Method Detail

getAccessManager

public static AccessManager getAccessManager(String workspace,
                                             Subject subject)
Creates instance of AccessManager configured with subject principal permissions for requested workspace/repository. This method will likely move the AccessManagerProvider in the future version, and while public should not be considered part of the public API.


isGranted

public static boolean isGranted(javax.jcr.Node node,
                                long requiredPermissions)
                         throws javax.jcr.RepositoryException
Convenience call hiding all ugly details of permission conversions.

Throws:
javax.jcr.RepositoryException - in case node or its parent session is invalid.

isGranted

public static boolean isGranted(String workspace,
                                String path,
                                String requiredPermissions)
Convenience call hiding all ugly details of permission conversions.


isGranted

public static boolean isGranted(javax.jcr.Session jcrSession,
                                String path,
                                long oldPermissions)
Return whether given session has requested permission on provided path.


isGranted

public static boolean isGranted(javax.jcr.Session jcrSession,
                                String path,
                                String action)
Return whether given session has requested permission on provided path.

Throws:
IllegalArgumentException - when provided action is empty.

verifyIsGrantedOrThrowException

public static void verifyIsGrantedOrThrowException(javax.jcr.Session jcrSession,
                                                   String path,
                                                   String action)
                                            throws AccessDeniedException
Checks whether given session has requested permission on provided path. Throws an exception if permission is not granted on given path.

Throws:
AccessDeniedException - when permission is not granted.


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.