Class Permissionable
User and
Group classes extend Permissionable.
A permission either allows or denies an action on a product and namespace.
Each permission specifies:
- The set of
productsthat the permission applies to. - The
namespaceof the permission. - The
actionthat is being allowed or denied.
Each product in a product set can be represented by a regular expression. For example,
the regular expression "/FX/.*" would match all FX products.
The regular expression representing the product can also contain the substitution tokens "%u
" and "%U". When the Permissioning Auth Module checks a permission to see if it applies to a
requested product, it replaces the "%u" token with the username of the logged in user, and
the "%U" token with the session name allocated by Liberator for that user session.
Substitution tokens can be placed in a product permission to prevent one user from accessing another
user's data. For example, if the username of the logged in user is "Bob" and the requested product is "
/Private/John/FX", the permissioned product "/Private/%u/FX" will not match the requested
product "/Private/John/FX", and the permission will not apply to this request.
Product requests are always denied unless a matching permission allows the action, and
no other permission denies the action.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyPermission(Set<String> productSet, String nameSpace, String action, Authorization auth) Adds a permission that either allows or denies a singleactionon aproductset andnamespace.voidAdds a permission that denies one or moreactionson aproductset andnamespace.booleanIndicates whether or not another object is "equal to" thisPermissionable.getName()Gets the name of thisPermissionable.inthashCode()Returns a hash code value for thisPermissionable.voidAdds a permission that allows one or moreactionson aproductset andnamespace.voidRemoves every permission for thisPermissionable.voidremovePermission(Set<String> products, String namespace, String... actions) Removes a permission for a singleactionon aproductset andnamespace.
-
Field Details
-
name
-
productPermissionSets
-
parents
-
-
Method Details
-
getName
Gets the name of thisPermissionable.A
Permissionableis named when it is created (see thecreateUser()andcreateGroup()methods of thePermissioningDataSource).- Returns:
- the name of this
Permissionable. - Throws:
IllegalStateException- if thisPermissionablewas removed from thePermissioningDatasource.
-
applyPermission
public void applyPermission(Set<String> productSet, String nameSpace, String action, Authorization auth) throws NoTransactionInProgressException, IllegalStateException Adds a permission that either allows or denies a singleactionon aproductset andnamespace.This permission is added to the permissions already assigned to the
Permissionable, and replaces any other permission thatPermissionablehas for thisaction,productset, andnamespace.- Parameters:
productSet- the set ofproducts that the permission applies to.nameSpace- thenamespaceof the permission. To add the permission to thedefault namespace, set thenamespacetoConstants.DEFAULT_PERMISSION_NAMESPACE.action- theactionthat is being permitted.auth- theAuthorizationthat allows or denies theaction.- Throws:
NoTransactionInProgressException- if this method is called outside the scope of aPermissioningDataSourcetransactionIllegalStateException- if thisPermissionablewas removed from thePermissioningDatasource.
-
permit
public void permit(Set<String> productSet, String nameSpace, String... actions) throws NoTransactionInProgressException, IllegalStateException Adds a permission that allows one or moreactionson aproductset andnamespace.This permission is added to the permissions already assigned to this
Permissionable, and replaces any other permission it has for theseactions,productset, andnamespace.- Parameters:
productSet- the set ofproductsthis this permissions applies tonameSpace- thenamespaceof the permission. To add the permission to thedefault namespace, set thenamespacetoConstants.DEFAULT_PERMISSION_NAMESPACE.actions- theactions that are being permitted. Any number ofactions can be specified as a comma separated sequence ofvarargs- Throws:
NoTransactionInProgressException- if this method is called outside the scope of aPermissioningDataSourcetransactionIllegalStateException- if thisPermissionablewas removed from thePermissioningDatasource.
-
deny
public void deny(Set<String> productSet, String nameSpace, String... actions) throws NoTransactionInProgressException, IllegalStateException Adds a permission that denies one or moreactionson aproductset andnamespace.This permission is added to the permissions already assigned to this
Permissionable, and replaces any other permission it has for theseactions,productset, andnamespace.- Parameters:
productSet- the set ofproductsthis this permissions applies tonameSpace- thenamespaceof the permission. To add the permission to thedefault namespace, set thenamespacetoConstants.DEFAULT_PERMISSION_NAMESPACE.actions- theactions that are being permitted. Any number ofactions can be specified as a comma separated sequence ofvarargs- Throws:
NoTransactionInProgressException- if this method is called outside the scope of aPermissioningDataSourcetransactionIllegalStateException- if thisPermissionablewas removed from thePermissioningDatasource.
-
removePermission
public void removePermission(Set<String> products, String namespace, String... actions) throws NoTransactionInProgressException, IllegalStateException Removes a permission for a singleactionon aproductset andnamespace. No permissions are removed if the permission does not exist.- Parameters:
products- the set ofproducts the permission applies tonamespace- thenamespaceof the permission. If the permission resides in thedefault namespace, use thenamespaceConstants.DEFAULT_PERMISSION_NAMESPACE.actions- theactions that permission to be removed allows or denies. Do not specify any code>action if you want to remove all permissions for a givenproductset andnamespace.- Throws:
NoTransactionInProgressException- if this method is called outside the scope of aPermissioningDataSourcetransactionIllegalStateException- if thisPermissionablewas removed from thePermissioningDatasource.
-
removeAllPermissions
public void removeAllPermissions()Removes every permission for thisPermissionable.- Throws:
NoTransactionInProgressException- if this method is called outside the scope of aPermissioningDataSourcetransactionIllegalStateException- if thisPermissionablewas removed from thePermissioningDatasource.
-
equals
Indicates whether or not another object is "equal to" thisPermissionable. The equality is based on the type and name of the objects. -
hashCode
public int hashCode()Returns a hash code value for thisPermissionable. The hash code is calculated using the type and name of thePermissionable. -
copyPermissions
-