Class DefaultPermissionFactory
- java.lang.Object
-
- org.springframework.security.acls.domain.DefaultPermissionFactory
-
- All Implemented Interfaces:
PermissionFactory
public class DefaultPermissionFactory extends java.lang.Object implements PermissionFactory
Default implementation ofPermissionFactory
.Used as a strategy by classes which wish to map integer masks and permission names to Permission instances for use with the ACL implementation.
Maintains a registry of permission names and masks to Permission instances.
- Since:
- 2.0.3
-
-
Constructor Summary
Constructors Constructor Description DefaultPermissionFactory()
Registers the Permission fields from the BasePermission class.DefaultPermissionFactory(java.lang.Class<? extends Permission> permissionClass)
Registers the Permission fields from the supplied class.DefaultPermissionFactory(java.util.Map<java.lang.String,? extends Permission> namedPermissions)
Registers a map of named Permission instances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Permission
buildFromMask(int mask)
Dynamically creates aCumulativePermission
orBasePermission
representing the active bits in the passed mask.Permission
buildFromName(java.lang.String name)
java.util.List<Permission>
buildFromNames(java.util.List<java.lang.String> names)
protected void
registerPermission(Permission perm, java.lang.String permissionName)
protected void
registerPublicPermissions(java.lang.Class<? extends Permission> clazz)
Registers the public static fields of typePermission
for a give class.
-
-
-
Constructor Detail
-
DefaultPermissionFactory
public DefaultPermissionFactory()
Registers the Permission fields from the BasePermission class.
-
DefaultPermissionFactory
public DefaultPermissionFactory(java.lang.Class<? extends Permission> permissionClass)
Registers the Permission fields from the supplied class.
-
DefaultPermissionFactory
public DefaultPermissionFactory(java.util.Map<java.lang.String,? extends Permission> namedPermissions)
Registers a map of named Permission instances.- Parameters:
namedPermissions
- the map of Permissions, keyed by name.
-
-
Method Detail
-
registerPublicPermissions
protected void registerPublicPermissions(java.lang.Class<? extends Permission> clazz)
Registers the public static fields of typePermission
for a give class.These permissions will be registered under the name of the field. See
BasePermission
for an example.- Parameters:
clazz
- aPermission
class with public static fields to register
-
registerPermission
protected void registerPermission(Permission perm, java.lang.String permissionName)
-
buildFromMask
public Permission buildFromMask(int mask)
Description copied from interface:PermissionFactory
Dynamically creates aCumulativePermission
orBasePermission
representing the active bits in the passed mask.- Specified by:
buildFromMask
in interfacePermissionFactory
- Parameters:
mask
- to build- Returns:
- a Permission representing the requested object
-
buildFromName
public Permission buildFromName(java.lang.String name)
- Specified by:
buildFromName
in interfacePermissionFactory
-
buildFromNames
public java.util.List<Permission> buildFromNames(java.util.List<java.lang.String> names)
- Specified by:
buildFromNames
in interfacePermissionFactory
-
-