Package org.uberfire.security.impl.authz
Class DotNamedPermissionType
- java.lang.Object
-
- org.uberfire.security.impl.authz.DotNamedPermissionType
-
- All Implemented Interfaces:
PermissionType
public class DotNamedPermissionType extends Object implements PermissionType
-
-
Constructor Summary
Constructors Constructor Description DotNamedPermissionType(String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringbuildPermissionName(org.uberfire.security.ResourceType type, String action, String resourceId)PermissioncreatePermission(String name, boolean granted)Creates a permission instance.PermissioncreatePermission(org.uberfire.security.Resource resource, org.uberfire.security.ResourceAction action, boolean granted)Creates a permission instance representing an action on a given resource..PermissioncreatePermission(org.uberfire.security.ResourceType resourceType, org.uberfire.security.ResourceAction action, boolean granted)Creates a permission instance representing a "global" action that can be applied to any resource instance (for instance, "edit an invoice") or an action that is not related to any specific instance (for instance, "create a new invoice")StringgetType()An string identifier that acts as a unique identifier for the permission type.StringresolveResourceId(Permission permission)Given a permission it tries to determine what is the resource the permission refers to.booleansupportsPermission(String name)Checks if the given permission name is supported by this type.
-
-
-
Constructor Detail
-
DotNamedPermissionType
public DotNamedPermissionType(String type)
-
-
Method Detail
-
getType
public String getType()
Description copied from interface:PermissionTypeAn string identifier that acts as a unique identifier for the permission type.- Specified by:
getTypein interfacePermissionType- Returns:
- The permission type unique identifier
-
supportsPermission
public boolean supportsPermission(String name)
Description copied from interface:PermissionTypeChecks if the given permission name is supported by this type. That means basically that such name does follow a specific nomenclature for the formatting of its permission names.- Specified by:
supportsPermissionin interfacePermissionType- Parameters:
name- The permission name to check- Returns:
- true is such permission is supported or false otherwise.
-
createPermission
public Permission createPermission(String name, boolean granted)
Description copied from interface:PermissionTypeCreates a permission instance.- Specified by:
createPermissionin interfacePermissionType- Parameters:
name- The name of the permission to create.granted- true=granted, false=denied- Returns:
- A permission instance
-
createPermission
public Permission createPermission(org.uberfire.security.ResourceType resourceType, org.uberfire.security.ResourceAction action, boolean granted)
Description copied from interface:PermissionTypeCreates a permission instance representing a "global" action that can be applied to any resource instance (for instance, "edit an invoice") or an action that is not related to any specific instance (for instance, "create a new invoice")- Specified by:
createPermissionin interfacePermissionType- Parameters:
resourceType- The resource typeaction- The action to check. If null then an "access" permission is created. The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.- Returns:
- A permission instance
-
createPermission
public Permission createPermission(org.uberfire.security.Resource resource, org.uberfire.security.ResourceAction action, boolean granted)
Description copied from interface:PermissionTypeCreates a permission instance representing an action on a given resource..- Specified by:
createPermissionin interfacePermissionType- Parameters:
resource- The resource instanceaction- The action to check. If null then an "access" permission is created. The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.- Returns:
- A permission instance
-
resolveResourceId
public String resolveResourceId(Permission permission)
Description copied from interface:PermissionTypeGiven a permission it tries to determine what is the resource the permission refers to.The resolution mechanism works only if the permission instance was created by a previous call to
PermissionType.createPermission(Resource, ResourceAction, boolean). In such case the identifier of theResourceinstance is the value returned.- Specified by:
resolveResourceIdin interfacePermissionType- Parameters:
permission- The permission which resource id. has to be inferred.- Returns:
- A resource id. or null if it can bot be inferred.
-
-