Package ch.ivyteam.ivy.security
Interface IRole
- All Superinterfaces:
ISecurityMember
A security Role. The roles are organized hierarchically.
The only top level role 'Everybody' is provided by the system (see
If a user owns directly or indirectly a member role it owns also this role. (See
The only top level role 'Everybody' is provided by the system (see
ivy.security.roles().topLevel()). If a user owns directly or indirectly a member role it owns also this role. (See
getRoleMembers(), addRoleMember(IRole),
removeRoleMember(IRole)).
Example: -Everybody (top level Role) -Role1 (RoleMembers: [RoleA, Role2]) owned by User1 -RoleA (RoleMembers: []) owned by UserA -Role2 (RoleMembers: []) owned by User2getUsers(): Role1.getUsers() = [User1] Role2.getUsers() = [User2] RoleA.getUsers() = [UserA]getAllUsers(): Role1.getAllUsers() = [User1, User2, UserA] Role2.getAllUsers() = [User2] RoleA.getAllUsers() = [UserA]IUser.getRoles(): User1.getRoles() = [Role1] User2.getRoles() = [Role2] UserA.getRoles() = [RoleA]IUser.getAllRoles(): User1.getAllRoles() = [Role1] User2.getAllRoles() = [Role2, Role1] UserA.getAllRoles() = [RoleA, Role1]
- Since:
- 17.05.2006
- See Also:
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddRoleMember(IRole role) Adds the given role as role member of this role.findChildRole(String roleName) Finds the child role with it's nameGets all property names of the roleDeprecated.Returns the child rolesGets the description of the roledefault StringDeprecated, for removal: This API element is subject to removal in a future version.usegetDescription()default StringDeprecated, for removal: This API element is subject to removal in a future version.usegetDescription()Gets the display name of this roledefault StringDeprecated, for removal: This API element is subject to removal in a future version.usegetDisplayName()Gets the full qualified name of the role in the external security systemdefault StringDeprecated.usegetExternalName()insteadReturns the parent rolegetProperty(String name) Gets a property of the roleGets all direct role members of this role.getRoles()Gets the directly owned roles.getUsers()Deprecated.useusers().assignedPaged()
Migration Example:ivy.session().getSecurityContext().findRole("ivy").getUsers()==>ivy.security.roles().find("ivy").users().assignedPaged().page(1)booleanReturns if this role is dynamic or not.
Roles created during deployment are never dynamic.booleanChecks whether this or any parent role is equal with the role givenremoveProperty(String name) Removes a property from the rolevoidremoveRoleMember(IRole role) Removes the given member role from this role.voidsetDescription(String description) Sets the description of the roledefault voidsetDisplayDescriptionTemplate(String displayDescriptionTemplate) Deprecated, for removal: This API element is subject to removal in a future version.voidsetDisplayName(String displayName) Sets the display name template of this roledefault voidsetDisplayNameTemplate(String displayNameTemplate) Deprecated, for removal: This API element is subject to removal in a future version.voidsetExternalName(String externalName) Sets the full qualified external name of the this role.default voidsetExternalSecurityName(String externalName) Deprecated.usesetExternalName(String)insteadvoidSets the name of the role.voidsetProperty(String name, String value) Sets a property to the roleusers()Gets users that own this roleMethods inherited from interface ch.ivyteam.ivy.security.ISecurityMember
disable, enable, getId, getMemberName, getName, getSecurityContext, isEnabled, isMember, isUser
-
Method Details
-
getDisplayDescription
Deprecated, for removal: This API element is subject to removal in a future version.usegetDescription()Gets the description of the role- Returns:
- description
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
getDescription
String getDescription()Gets the description of the role- Returns:
- description
- Since:
- 12.0.3
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleReadDisplayDescription PERMISSION OR OWNS RoleReadDisplayDescription@SYSTEM PERMISSION
-
setDescription
Sets the description of the role- Parameters:
description- description- Since:
- 12.0.3
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleSetDisplayDescription PERMISSION OR OWNS RoleSetDisplayDescription@SYSTEM PERMISSION
-
setDisplayDescriptionTemplate
@Deprecated(since="12.0.3", forRemoval=true) default void setDisplayDescriptionTemplate(String displayDescriptionTemplate) Deprecated, for removal: This API element is subject to removal in a future version.Set the description of the role- Parameters:
displayDescriptionTemplate- Description of the role- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
getDisplayDescriptionTemplate
Deprecated, for removal: This API element is subject to removal in a future version.usegetDescription()Get the display description template of the role- Returns:
- display description template
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
getParent
IRole getParent()Returns the parent role- Returns:
- parent role
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleTreeNavigation PERMISSION OR OWNS RoleTreeNavigation@SYSTEM PERMISSION
-
getChildRoles
Returns the child roles- Returns:
- child roles
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleTreeNavigation PERMISSION OR OWNS RoleTreeNavigation@SYSTEM PERMISSION
-
findChildRole
Finds the child role with it's name- Parameters:
roleName- Name of the child role- Returns:
- role or null if no child role with that name exists.
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleTreeNavigation PERMISSION OR OWNS RoleTreeNavigation@SYSTEM PERMISSION
-
setExternalSecurityName
Deprecated.usesetExternalName(String)insteadSets the full qualified external name of the this role. This external name is used to lookup the role in the external security system.- Parameters:
externalName- The external name of the role- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
setExternalName
Sets the full qualified external name of the this role. This external name is used to lookup the role in the external security system.- Parameters:
externalName- The external name of the role- Throws:
PersistencyException- if persistency access fails- Since:
- 9.1
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleSetExternalSecurityName PERMISSION OR OWNS RoleSetExternalSecurityName@SYSTEM PERMISSION
-
getExternalSecurityName
Deprecated.usegetExternalName()insteadGets the full qualified name of the role in the external security system- Returns:
- external name
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
getExternalName
String getExternalName()Gets the full qualified name of the role in the external security system- Returns:
- external name
- Throws:
PersistencyException- if persistency access fails- Since:
- 9.1
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleReadExternalSecurityName PERMISSION OR OWNS RoleReadExternalSecurityName@SYSTEM PERMISSION
-
getAllUsers
Deprecated.useusers().allPaged()WARNING: This methods loads the resulting users into memory.
This can cause out of memory exceptions and bad performance depending on the number of users in your application.- Returns:
- list with the users
- Throws:
PersistencyException- if persistency access fails- See Also:
- API:
- This public API is available in Java.
-
users
IRoleUsers users()Gets users that own this role- Returns:
- users
- Since:
- 8.0.3
- API:
- This public API is available in Java.
-
getUsers
Deprecated.useusers().assignedPaged()
Migration Example:ivy.session().getSecurityContext().findRole("ivy").getUsers()==>ivy.security.roles().find("ivy").users().assignedPaged().page(1)WARNING: This methods loads the resulting users into memory.
This can cause out of memory exceptions and bad performance depending on the number of users in your application.- Returns:
- list with the users
- Throws:
PersistencyException- if persistency access fails- See Also:
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleReadUsers PERMISSION OR OWNS RoleReadUsers@SYSTEM PERMISSION
-
isRole
Checks whether this or any parent role is equal with the role given- Parameters:
role- The role to check- Returns:
- true If the role is equal to this or to any parent role, else false
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
getDisplayName
String getDisplayName()Gets the display name of this role- Specified by:
getDisplayNamein interfaceISecurityMember- Returns:
- the display name
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleReadDisplayName PERMISSION OR OWNS RoleReadDisplayName@SYSTEM PERMISSION
-
getDisplayNameTemplate
Deprecated, for removal: This API element is subject to removal in a future version.usegetDisplayName()Gets the display name template of this role- Returns:
- the display name template
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
setDisplayNameTemplate
@Deprecated(since="12.0.3", forRemoval=true) default void setDisplayNameTemplate(String displayNameTemplate) Deprecated, for removal: This API element is subject to removal in a future version.Sets the display name template of this role- Parameters:
displayNameTemplate- the display name template- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
setDisplayName
Sets the display name template of this role- Parameters:
displayName- the display name template- Throws:
PersistencyException- if persistency access fails- Since:
- 12.0.3
- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RoleSetDisplayName PERMISSION OR OWNS RoleSetDisplayName@SYSTEM PERMISSION
-
setProperty
Sets a property to the role- Parameters:
name- Name of the property to set (maximum 255 characters)value- Value of the property to set- Throws:
IllegalArgumentException- If the property name has more than 255 charactersPersistencyException- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RolePropertyWrite PERMISSION OR OWNS RolePropertyWrite@SYSTEM PERMISSION
-
getProperty
Gets a property of the role- Parameters:
name- Name of the property- Returns:
- property value or null if no such property exists
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RolePropertyRead PERMISSION OR OWNS RolePropertyRead@SYSTEM PERMISSION
-
removeProperty
Removes a property from the role- Parameters:
name- Name of the property to remove- Returns:
- property value or null if no such property exists
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RolePropertyWrite PERMISSION OR OWNS RolePropertyWrite@SYSTEM PERMISSION
-
getAllPropertyNames
Gets all property names of the role- Returns:
- Enumeration with the property names
- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
- Security:
- SESSION OWNS RolePropertyRead PERMISSION OR OWNS RolePropertyRead@SYSTEM PERMISSION
-
addRoleMember
Adds the given role as role member of this role.
If a user owns directly or indirectly a member role it owns also this role.- Parameters:
role- member to add- Throws:
PersistencyException- if persistency access failsIllegalArgumentException- if the member is the role iself- API:
- This public API is available in Java.
-
getRoleMembers
Gets all direct role members of this role.
If a user owns directly or indirectly a member role it owns also this role.- Returns:
- all direct role members of this role
- Throws:
PersistencyException- API:
- This public API is available in Java.
-
removeRoleMember
Removes the given member role from this role.
If a user owns directly or indirectly a member role it owns also this role.- Parameters:
role- to remove- Throws:
PersistencyException- if persistency access fails- API:
- This public API is available in Java.
-
getRoles
Gets the directly owned roles. The parent role and all roles where this role is a direct role member.
This list never contains this role itself.- Returns:
- list of the parent and all roles this role is a direct member
- Throws:
PersistencyException- if persistency access fails- See Also:
- API:
- This public API is available in Java.
-
isDynamic
boolean isDynamic()Returns if this role is dynamic or not.
Roles created during deployment are never dynamic.- Returns:
- if this role is dynamic
- API:
- This public API is available in Java.
-
setName
Sets the name of the role.Attention: This is a critical and dangerous operation, at least for non-dynamic roles. This role may be referenced in processes with its old name. All references in all processes in all deployed projects (PMVs) must first be manually adjusted to the new name. Otherwise, the processes will fail in the future.
- Parameters:
name- role name- API:
- This public API is available in Java.
-
users().allPaged()