use of com.enonic.xp.project.ProjectRole in project xp by enonic.
the class CreateProjectRolesCommand method doCreateRoles.
private void doCreateRoles() {
for (ProjectRole projectRole : ProjectRole.values()) {
final PrincipalKey roleKey = ProjectAccessHelper.createRoleKey(projectName, projectRole);
final String roleDisplayName = createRoleDisplayName(projectRole);
securityService.getRole(roleKey).orElseGet(() -> doCreateRole(roleKey, roleDisplayName));
}
}
use of com.enonic.xp.project.ProjectRole in project xp by enonic.
the class UpdateProjectRoleNamesCommand method doUpdateRoles.
private void doUpdateRoles() {
for (ProjectRole projectRole : ProjectRole.values()) {
final PrincipalKey roleKey = ProjectAccessHelper.createRoleKey(projectName, projectRole);
final String newRoleDisplayName = createRoleDisplayName(projectRole);
securityService.getRole(roleKey).filter(role -> !newRoleDisplayName.equals(role.getDisplayName())).ifPresent((roleValue) -> doUpdateRoleDisplayName(roleValue, newRoleDisplayName));
}
}
Aggregations