public class ResourceTypeUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static Map<Integer,Class<? extends Enum<? extends Permission>>> |
PERMISSION_ENUMS
A map containing all
Resources as a key and
the respective Permission Enum class for this resource. |
Constructor and Description |
---|
ResourceTypeUtil() |
Modifier and Type | Method and Description |
---|---|
static Permission |
getPermissionByNameAndResourceType(String permissionName,
int resourceType)
Currently used only in the Rest API
Returns a
Permission based on the specified permissionName and resourceType |
static Map<Integer,Class<? extends Enum<? extends Permission>>> |
getPermissionEnums() |
static Permission[] |
getPermissionsByResourceType(int givenResourceType)
Retrieves the
Permission array based on the predifined PERMISSION_ENUMS |
static Resource |
getResourceByType(int resourceType)
|
static boolean |
resourceIsContainedInArray(Integer resourceTypeId,
Resource[] resources) |
protected static final Map<Integer,Class<? extends Enum<? extends Permission>>> PERMISSION_ENUMS
Resources
as a key and
the respective Permission
Enum class for this resource.
NOTE: In case of new Permission
Enum class, please adjust the map accordingly
public static boolean resourceIsContainedInArray(Integer resourceTypeId, Resource[] resources)
true
in case the resource with the provided resourceTypeId is contained by the specified listpublic static Map<Integer,Class<? extends Enum<? extends Permission>>> getPermissionEnums()
PERMISSION_ENUMS
public static Permission[] getPermissionsByResourceType(int givenResourceType)
Permission
array based on the predifined PERMISSION_ENUMS
public static Permission getPermissionByNameAndResourceType(String permissionName, int resourceType)
Permission
based on the specified permissionName
and resourceType
BadUserRequestException
- in case the permission is not valid for the specified resource typepublic static Resource getResourceByType(int resourceType)
Copyright © 2022. All rights reserved.