org.exoplatform.services.wcm.utils
Class WCMCoreUtils

java.lang.Object
  extended by org.exoplatform.services.wcm.utils.WCMCoreUtils

public class WCMCoreUtils
extends java.lang.Object

Created by The eXo Platform SAS Author : Tran Nguyen Ngoc ngoc.tran@exoplatform.com Sep 8, 2009


Constructor Summary
WCMCoreUtils()
           
 
Method Summary
static
<T> T
getService(java.lang.Class<T> clazz)
          Gets the service.
static org.exoplatform.services.jcr.ext.common.SessionProvider getSessionProvider()
          Gets the system session provider.
static org.exoplatform.services.jcr.ext.common.SessionProvider getUserSessionProvider()
          Gets the session provider.
static boolean hasPermission(java.lang.String userId, java.util.List<java.lang.String> permissions, boolean isNeedFullAccess)
          Check current user has permission to access a node or not - For each permission, compare with user's permissions - If permission has membership type is "*", just check the user's group id only - If permission has other membership types, then check the user's membership type and user's group id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WCMCoreUtils

public WCMCoreUtils()
Method Detail

getService

public static <T> T getService(java.lang.Class<T> clazz)
Gets the service.

Parameters:
clazz - the clazz
Returns:
the service

getSessionProvider

public static org.exoplatform.services.jcr.ext.common.SessionProvider getSessionProvider()
Gets the system session provider.

Returns:
the system session provider

getUserSessionProvider

public static org.exoplatform.services.jcr.ext.common.SessionProvider getUserSessionProvider()
Gets the session provider.

Returns:
the session provider

hasPermission

public static boolean hasPermission(java.lang.String userId,
                                    java.util.List<java.lang.String> permissions,
                                    boolean isNeedFullAccess)
Check current user has permission to access a node or not - For each permission, compare with user's permissions - If permission has membership type is "*", just check the user's group id only - If permission has other membership types, then check the user's membership type and user's group id

Parameters:
userId - the current user's name
permissions - the current node
isNeedFullAccess - if true, count full access (4) then return true, if false, return true if match first permission
Returns:
true is user has permissions, otherwise return false


Copyright © 2011 eXo Platform SAS. All Rights Reserved.