Class DefaultPermissionFactory
java.lang.Object
org.springframework.security.acls.domain.DefaultPermissionFactory
- All Implemented Interfaces:
PermissionFactory
Default implementation of
PermissionFactory.
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
ConstructorsConstructorDescriptionRegisters the Permission fields from the BasePermission class.DefaultPermissionFactory(Class<? extends Permission> permissionClass) Registers the Permission fields from the supplied class.DefaultPermissionFactory(Map<String, ? extends Permission> namedPermissions) Registers a map of named Permission instances. -
Method Summary
Modifier and TypeMethodDescriptionbuildFromMask(int mask) Dynamically creates aCumulativePermissionorBasePermissionrepresenting the active bits in the passed mask.buildFromName(String name) buildFromNames(List<String> names) protected voidregisterPermission(Permission perm, String permissionName) protected voidregisterPublicPermissions(Class<? extends Permission> clazz) Registers the public static fields of typePermissionfor a give class.
-
Constructor Details
-
DefaultPermissionFactory
public DefaultPermissionFactory()Registers the Permission fields from the BasePermission class. -
DefaultPermissionFactory
Registers the Permission fields from the supplied class. -
DefaultPermissionFactory
Registers a map of named Permission instances.- Parameters:
namedPermissions- the map of Permissions, keyed by name.
-
-
Method Details
-
registerPublicPermissions
Registers the public static fields of typePermissionfor a give class.These permissions will be registered under the name of the field. See
BasePermissionfor an example.- Parameters:
clazz- aPermissionclass with public static fields to register
-
registerPermission
-
buildFromMask
Description copied from interface:PermissionFactoryDynamically creates aCumulativePermissionorBasePermissionrepresenting the active bits in the passed mask.- Specified by:
buildFromMaskin interfacePermissionFactory- Parameters:
mask- to build- Returns:
- a Permission representing the requested object
-
buildFromName
- Specified by:
buildFromNamein interfacePermissionFactory
-
buildFromNames
- Specified by:
buildFromNamesin interfacePermissionFactory
-