public class PermissionUtil extends Object
Utility class for common permission operations.
Constructor and Description |
---|
PermissionUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
addOperation(String operationsCSV,
String operation)
Adds a new
operation to operationsCSV , where the latter is a CSV representing the current
operationsCSV. |
static Set<String> |
asOperationList(String operationsCSV)
Returns a
Set with all operationsCSV from operationsCSV . |
static boolean |
hasAttributes(Permission permission,
Class<?> resourceClass,
Serializable identifier,
String operation)
Check if the given
Permission has the given attributes. |
static boolean |
hasOperation(Permission permission,
String operation)
Checks if the fiven given
operation is granted by the given Permission . |
static String |
removeOperation(String operationsCSV,
String operation)
Removes a new
operation to operationsCSV , where the latter is a CSV representing the current
operationsCSV. |
public static String addOperation(String operationsCSV, String operation)
Adds a new operation
to operationsCSV
, where the latter is a CSV representing the current
operationsCSV.
operationsCSV
- A CSV of operationsCSVoperation
- The operation to addpublic static String removeOperation(String operationsCSV, String operation)
Removes a new operation
to operationsCSV
, where the latter is a CSV representing the current
operationsCSV.
operationsCSV
- A CSV of operationsCSVoperation
- The operation to removepublic static Set<String> asOperationList(String operationsCSV)
Returns a Set
with all operationsCSV from operationsCSV
.
operationsCSV
- The CSV of operationsCSV.public static boolean hasAttributes(Permission permission, Class<?> resourceClass, Serializable identifier, String operation)
Check if the given Permission
has the given attributes.
permission
- The permission to checkresourceClass
- identifier
- operation
- public static boolean hasOperation(Permission permission, String operation)
Checks if the fiven given operation
is granted by the given Permission
.
permission
- operation
- Copyright © 2018 JBoss by Red Hat. All rights reserved.