org.wso2.carbon.registry.core.utils
Class AuthorizationUtils

java.lang.Object
  extended by org.wso2.carbon.registry.core.utils.AuthorizationUtils

public class AuthorizationUtils
extends java.lang.Object

Set of utilities related to authorization functionality.


Constructor Summary
AuthorizationUtils()
           
 
Method Summary
static void addAuthorizeRoleListener(int executionId, java.lang.String path, java.lang.String permission, java.lang.String executeAction)
          Adds listener to intercept authorizeRole and clearRoleActionOnAllResources operations.
static void addAuthorizeRoleListener(int executionId, java.lang.String path, java.lang.String permission, java.lang.String executeAction, java.lang.String[] actions)
          Adds listener to intercept authorizeRole and clearRoleActionOnAllResources operations.
static boolean authorize(java.lang.String resourcePath, java.lang.String action)
          Method to authorize a given resource path for a given action.
static void clearAuthorizations(java.lang.String resourcePath)
          Method to clear authorizations for a given resource path.
static void copyAuthorizations(java.lang.String sourcePath, java.lang.String targetPath)
          Method to copy authorizations from one path to another.
static void denyAnonAuthorization(java.lang.String path, org.wso2.carbon.user.core.UserRealm userRealm)
          Deprecated. 
static java.lang.String getAuthorizationPath(java.lang.String resourcePath)
          Path of a resource given to the Registry interface may contain extensions to refer meta data about resources.
static void populateUserStore(org.wso2.carbon.user.core.UserRealm realm)
          Deprecated. 
static void setAnonAuthorization(java.lang.String path, org.wso2.carbon.user.core.UserRealm userRealm)
          Deprecated. 
static void setRootAuthorizations(java.lang.String rootPath, org.wso2.carbon.user.core.UserRealm userRealm)
          Method to set authorizations to the root path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthorizationUtils

public AuthorizationUtils()
Method Detail

authorize

public static boolean authorize(java.lang.String resourcePath,
                                java.lang.String action)
                         throws RegistryException
Method to authorize a given resource path for a given action.

Parameters:
resourcePath - the resource path.
action - the action.
Returns:
whether the user is authorized or not.
Throws:
RegistryException - if the operation failed.

setAnonAuthorization

@Deprecated
public static void setAnonAuthorization(java.lang.String path,
                                                   org.wso2.carbon.user.core.UserRealm userRealm)
                                 throws RegistryException
Deprecated. 

Method to set authorizations for an anonymous user.

Parameters:
path - the resource path.
userRealm - the user realm
Throws:
RegistryException - if the operation failed.

clearAuthorizations

public static void clearAuthorizations(java.lang.String resourcePath)
                                throws RegistryException
Method to clear authorizations for a given resource path.

Parameters:
resourcePath - the resource path.
Throws:
RegistryException - if the operation failed.

copyAuthorizations

public static void copyAuthorizations(java.lang.String sourcePath,
                                      java.lang.String targetPath)
                               throws RegistryException
Method to copy authorizations from one path to another.

Parameters:
sourcePath - the source path (where to copy from)
targetPath - the target path (where to copy to)
Throws:
RegistryException - if the operation failed.

denyAnonAuthorization

@Deprecated
public static void denyAnonAuthorization(java.lang.String path,
                                                    org.wso2.carbon.user.core.UserRealm userRealm)
                                  throws RegistryException
Deprecated. 

Method to deny anonymous authorizations to the given path.

Parameters:
path - the path.
userRealm - the user realm to use.
Throws:
RegistryException - if the operation failed.

setRootAuthorizations

public static void setRootAuthorizations(java.lang.String rootPath,
                                         org.wso2.carbon.user.core.UserRealm userRealm)
                                  throws RegistryException
Method to set authorizations to the root path.

Parameters:
rootPath - the root path.
userRealm - the user realm to use.
Throws:
RegistryException - if the operation failed.

populateUserStore

@Deprecated
public static void populateUserStore(org.wso2.carbon.user.core.UserRealm realm)
                              throws org.wso2.carbon.user.core.UserStoreException
Deprecated. 

Populates all necessary users, roles and authorizations related user store. Note that the authorizations related to resource store is not populated by this method.

Parameters:
realm - Realm for which data has to be populated
Throws:
org.wso2.carbon.user.core.UserStoreException - if the operation failed.

getAuthorizationPath

public static java.lang.String getAuthorizationPath(java.lang.String resourcePath)
Path of a resource given to the Registry interface may contain extensions to refer meta data about resources. But we always store the authorization for resources against the pure resource path, stored in the ARTIFACTS table. This methods extracts that pure resource path from a given path.

Parameters:
resourcePath - A path string, which may contain extensions
Returns:
pure resource path for the given path

addAuthorizeRoleListener

public static void addAuthorizeRoleListener(int executionId,
                                            java.lang.String path,
                                            java.lang.String permission,
                                            java.lang.String executeAction,
                                            java.lang.String[] actions)
Adds listener to intercept authorizeRole and clearRoleActionOnAllResources operations. This method must only be used inside the registry kernel and its fragments.

Parameters:
executionId - an identifier which determines the order in which this listener is called.
path - the path to which authorizations should be granted on the repository.
permission - the corresponding UI permission
executeAction - the execute action used by the User Management bundle
actions - the actions which we authorize this role for the given path
See Also:
AuthorizationManager.authorizeRole(String, String, String), AuthorizationManager.clearRoleActionOnAllResources(String, String)

addAuthorizeRoleListener

public static void addAuthorizeRoleListener(int executionId,
                                            java.lang.String path,
                                            java.lang.String permission,
                                            java.lang.String executeAction)
Adds listener to intercept authorizeRole and clearRoleActionOnAllResources operations. This method must only be used inside the registry kernel and its fragments.

Parameters:
executionId - an identifier which determines the order in which this listener is called.
path - the path to which authorizations should be granted on the repository.
permission - the corresponding UI permission
executeAction - the execute action used by the User Management bundle
See Also:
AuthorizationManager.authorizeRole(String, String, String), AuthorizationManager.clearRoleActionOnAllResources(String, String)


Copyright © 2011 WSO2 Inc. All Rights Reserved.