public final class BlogRoleHelper extends Object
Modifier and Type | Method and Description |
---|---|
static BlogRole |
convertNumericToRole(int numericRole)
Convert a numeric representation of a role into the role object.
|
static int |
convertRoleToNumeric(BlogRole role)
Convert a role into a numeric representation.
|
static Map<BlogRole,String> |
getBlogRoles(Locale locale)
Gets the localized user group roles.
|
static List<String> |
getBlogRolesSortedByAccess() |
static BlogRole |
getUpperRole(BlogRole firstRole,
BlogRole secRole)
Get back the upper role of given roles
|
static boolean |
sufficientAccess(BlogRole actualRole,
BlogRole requiredRole)
Return whether a role represents the same or a higher access right than another role
|
public static BlogRole convertNumericToRole(int numericRole)
numericRole
- the numeric representation of the roleconvertRoleToNumeric(BlogRole)
public static int convertRoleToNumeric(BlogRole role)
role
- the role to convertpublic static Map<BlogRole,String> getBlogRoles(Locale locale)
locale
- the localepublic static List<String> getBlogRolesSortedByAccess()
public static BlogRole getUpperRole(BlogRole firstRole, BlogRole secRole)
firstRole
- BlogRolesecRole
- BolgRolepublic static boolean sufficientAccess(BlogRole actualRole, BlogRole requiredRole)
actualRole
- the role to evaluate. Can be null. In that case the role is interpreted as no
access and thus, false is returned.requiredRole
- the role representing the access right the other role should fulfill. Can be null.
In that case the role is interpreted as no access is required and thus, true is
returned.Copyright © 2019 Communote team. All rights reserved.