Class RoleInheritanceTestUtils
- java.lang.Object
-
- org.openbravo.test.role.inheritance.RoleInheritanceTestUtils
-
public class RoleInheritanceTestUtils extends Object
This class provides some utility methods used to test the Role Inheritance functionality
-
-
Field Summary
Fields Modifier and Type Field Description static List<String>
ACCESS_NAMES
list with the available access typesstatic String
ASTERISK_ORG_ID
zero organization idstatic String
CLIENT_ID
F&B International Group client idstatic String
DUMMY_VIEW_IMPL_NAME
-
Constructor Summary
Constructors Constructor Description RoleInheritanceTestUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addAccess(String type, Role role, String accessName)
Creates a new permission and assigns it to a rolestatic void
addInheritance(Role role, Role template, Long sequenceNumber)
Adds a new inheritance between two rolesstatic void
createDummyView()
Workaround to be able to test role inheritance of view implementations as core only have one view availablestatic Role
createRole(String name, String clientId, String organizationId, String userLevel, boolean isManual, boolean isTemplate)
Creates a new rolestatic void
deleteRole(Role role)
Deletes a rolestatic String[]
getAccessInfo(String type, Role role, String accessName)
Retrieves the information of a permission assigned to a rolestatic String[]
getOrderedAccessNames(String type, Role role)
Retrieves an array with permissions information assigned to a role, ordered by namestatic void
removeAccesses(String type, Role role)
Removes a permission assigned to a rolestatic void
removeDummyView()
Workaround to be able to test role inheritance of view implementations as core only have one view availablestatic void
removeInheritance(Role role, Role template)
Removes an existing inheritancestatic void
updateAccess(String type, Role role, String accessName, boolean editedValue, boolean isActive)
Updates an existing permission assigned to a role
-
-
-
Field Detail
-
CLIENT_ID
public static final String CLIENT_ID
F&B International Group client id- See Also:
- Constant Field Values
-
ASTERISK_ORG_ID
public static final String ASTERISK_ORG_ID
zero organization id- See Also:
- Constant Field Values
-
DUMMY_VIEW_IMPL_NAME
public static final String DUMMY_VIEW_IMPL_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createRole
public static Role createRole(String name, String clientId, String organizationId, String userLevel, boolean isManual, boolean isTemplate)
Creates a new role- Parameters:
name
- the name of the roleclientId
- role client idorganizationId
- role organization iduserLevel
- user level of the role's organizationisManual
- defines if the role is manual (true) or automatic (false)isTemplate
- defines if the role is template (true) or not (false)- Returns:
- the new created role
-
deleteRole
public static void deleteRole(Role role)
Deletes a role- Parameters:
role
- A Role object which will be deleted
-
addInheritance
public static void addInheritance(Role role, Role template, Long sequenceNumber)
Adds a new inheritance between two roles- Parameters:
role
- The role owner of the inheritancetemplate
- The template role whose permissions will be inheritedsequenceNumber
- Sequence number to assign to the inheritance
-
removeInheritance
public static void removeInheritance(Role role, Role template)
Removes an existing inheritance- Parameters:
role
- The role owner of the inheritancetemplate
- The template role whose permissions are being inherited
-
addAccess
public static void addAccess(String type, Role role, String accessName)
Creates a new permission and assigns it to a role- Parameters:
type
- A String which represents the type of the accessrole
- The role to assign the permissionaccessName
- The name of the particular permission to assign
-
removeAccesses
public static void removeAccesses(String type, Role role)
Removes a permission assigned to a role- Parameters:
type
- A String which represents the type of the accessrole
- The role owner of the permission
-
updateAccess
public static void updateAccess(String type, Role role, String accessName, boolean editedValue, boolean isActive)
Updates an existing permission assigned to a role- Parameters:
type
- A String which represents the type of the accessrole
- The role owner of the permissionaccessName
- The name of the particular permission to updateeditedValue
- The edited value to assign to the permissionisActive
- a flag to activate (true) or deactivate (false) the permission
-
getAccessInfo
public static String[] getAccessInfo(String type, Role role, String accessName)
Retrieves the information of a permission assigned to a role- Parameters:
type
- A String which represents the type of the accessrole
- The role owner of the permissionaccessName
- The name of the particular permission to retrieve- Returns:
- An array of Strings with the permission information
-
getOrderedAccessNames
public static String[] getOrderedAccessNames(String type, Role role)
Retrieves an array with permissions information assigned to a role, ordered by name- Parameters:
type
- A String which represents the type of the accessrole
- The role to assign the permission- Returns:
- an array of Strings with the permissions information
-
createDummyView
public static void createDummyView()
Workaround to be able to test role inheritance of view implementations as core only have one view available
-
removeDummyView
public static void removeDummyView()
Workaround to be able to test role inheritance of view implementations as core only have one view available
-
-