public class DotNamedPermissionType extends Object implements PermissionType
Constructor and Description |
---|
DotNamedPermissionType(String type) |
Modifier and Type | Method and Description |
---|---|
protected String |
buildPermissionName(ResourceType type,
String action,
String resourceId) |
Permission |
createPermission(Resource resource,
ResourceAction action,
boolean granted)
Creates a permission instance representing an action on a given resource..
|
Permission |
createPermission(ResourceType resourceType,
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")
|
Permission |
createPermission(String name,
boolean granted)
Creates a permission instance.
|
String |
getType()
An string identifier that acts as a unique identifier for the permission type.
|
String |
resolveResourceId(Permission permission)
Given a permission it tries to determine what is the resource the permission refers to.
|
boolean |
supportsPermission(String name)
Checks if the given permission name is supported by this type.
|
public DotNamedPermissionType(String type)
public String getType()
PermissionType
getType
in interface PermissionType
public boolean supportsPermission(String name)
PermissionType
supportsPermission
in interface PermissionType
name
- The permission name to checkpublic Permission createPermission(String name, boolean granted)
PermissionType
createPermission
in interface PermissionType
name
- The name of the permission to create.granted
- true=granted, false=deniedpublic Permission createPermission(ResourceType resourceType, ResourceAction action, boolean granted)
PermissionType
createPermission
in interface PermissionType
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.public Permission createPermission(Resource resource, ResourceAction action, boolean granted)
PermissionType
createPermission
in interface PermissionType
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.public String resolveResourceId(Permission permission)
PermissionType
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 the
Resource
instance is the value returned.
resolveResourceId
in interface PermissionType
permission
- The permission which resource id. has to be inferred.protected String buildPermissionName(ResourceType type, String action, String resourceId)
Copyright © 2012–2018 JBoss by Red Hat. All rights reserved.