use of com.runwaysdk.system.Roles in project geoprism-registry by terraframe.
the class ServerGeoObjectTypeConverter method create_RM_GeoObjectTypeRole.
private void create_RM_GeoObjectTypeRole(MdGeoVertexDAO mdGeoVertexDAO, String organizationCode, String geoObjectTypeCode) {
if (organizationCode != null && !organizationCode.trim().equals("")) {
String rmRoleName = RegistryRole.Type.getRM_RoleName(organizationCode, geoObjectTypeCode);
Locale locale = Session.getCurrentLocale();
String defaultDisplayLabel = mdGeoVertexDAO.getLocalValue(MdGeoVertexInfo.DISPLAY_LABEL, locale) + " Registry Maintainer";
Roles rmOrgRole = new Roles();
rmOrgRole.setRoleName(rmRoleName);
rmOrgRole.getDisplayLabel().setDefaultValue(defaultDisplayLabel);
rmOrgRole.apply();
String orgRoleName = RegistryRole.Type.getRootOrgRoleName(organizationCode);
Roles orgRole = Roles.findRoleByName(orgRoleName);
RoleDAO orgRoleDAO = (RoleDAO) BusinessFacade.getEntityDAO(orgRole);
RoleDAO rmOrgRoleDAO = (RoleDAO) BusinessFacade.getEntityDAO(rmOrgRole);
orgRoleDAO.addInheritance(rmOrgRoleDAO);
// Inherit the permissions from the root RM role
RoleDAO rootRM_DAO = (RoleDAO) BusinessFacade.getEntityDAO(Roles.findRoleByName(RegistryConstants.REGISTRY_MAINTAINER_ROLE));
rootRM_DAO.addInheritance(rmOrgRoleDAO);
}
}
use of com.runwaysdk.system.Roles in project geoprism-registry by terraframe.
the class ServerGeoObjectTypeConverter method assign_RM_GeoObjectTypeRole.
private void assign_RM_GeoObjectTypeRole(MdGeoVertexDAO mdGeoVertexDAO, MdBusiness mdBusiness, String organizationCode, String geoObjectTypeCode) {
if (organizationCode != null && !organizationCode.trim().equals("")) {
String rmRoleName = RegistryRole.Type.getRM_RoleName(organizationCode, geoObjectTypeCode);
Roles rmRole = Roles.findRoleByName(rmRoleName);
this.assignAllPermissions(mdBusiness, rmRole);
this.assignAllPermissions(mdGeoVertexDAO, rmRole);
}
}
use of com.runwaysdk.system.Roles in project geoprism-registry by terraframe.
the class ServerGeoObjectTypeConverter method assignAll_RA_Permissions.
/**
* Assigns all permissions to the Organization's RA
*
* @param mdGeoVertexDAO
* @param mdBusiness
* @param organizationCode
*/
private void assignAll_RA_Permissions(MdGeoVertexDAO mdGeoVertexDAO, MdBusiness mdBusiness, String organizationCode) {
if (organizationCode != null && !organizationCode.trim().equals("")) {
Organization organization = Organization.getByKey(organizationCode);
Roles raRole = organization.getRegistryAdminiRole();
this.assignAllPermissions(mdBusiness, raRole);
this.assignAllPermissions(mdGeoVertexDAO, raRole);
}
}
use of com.runwaysdk.system.Roles in project geoprism-registry by terraframe.
the class AccountService method addRolesForOrganization.
private void addRolesForOrganization(List<RegistryRole> registryRoleList, Organization organization) {
LocalizedValue orgDisplayLabel = LocalizedValueConverter.convert(organization.getDisplayLabel());
// Add the RA role
Roles adminRole = organization.getRegistryAdminiRole();
RegistryRole adminRegistryRole = new RegistryRoleConverter().build(adminRole);
adminRegistryRole.setOrganizationLabel(orgDisplayLabel);
registryRoleList.add(adminRegistryRole);
Map<String, ServerGeoObjectType> geoObjectTypeInfo = organization.getGeoObjectTypes();
for (String typeCode : geoObjectTypeInfo.keySet()) {
ServerGeoObjectType type = geoObjectTypeInfo.get(typeCode);
// The cannot be assigned directly to the child type.
if (type.getSuperType() == null) {
// Add the RM role
String rmRoleName = RegistryRole.Type.getRM_RoleName(organization.getCode(), typeCode);
Roles rmRole = Roles.findRoleByName(rmRoleName);
RegistryRole rmRegistryRole = new RegistryRoleConverter().build(rmRole);
rmRegistryRole.setOrganizationLabel(orgDisplayLabel);
LocalizedValue label = type.getLabel();
rmRegistryRole.setGeoObjectTypeLabel(label);
registryRoleList.add(rmRegistryRole);
// Add the RC role
String rcRoleName = RegistryRole.Type.getRC_RoleName(organization.getCode(), typeCode);
Roles rcRole = Roles.findRoleByName(rcRoleName);
RegistryRole rcRegistryRole = new RegistryRoleConverter().build(rcRole);
rcRegistryRole.setOrganizationLabel(orgDisplayLabel);
rcRegistryRole.setGeoObjectTypeLabel(label);
registryRoleList.add(rcRegistryRole);
// Add the AC role
String acRoleName = RegistryRole.Type.getAC_RoleName(organization.getCode(), typeCode);
Roles acRole = Roles.findRoleByName(acRoleName);
RegistryRole acRegistryRole = new RegistryRoleConverter().build(acRole);
acRegistryRole.setOrganizationLabel(orgDisplayLabel);
acRegistryRole.setGeoObjectTypeLabel(label);
registryRoleList.add(acRegistryRole);
}
}
}
use of com.runwaysdk.system.Roles in project geoprism-registry by terraframe.
the class AccountService method getRolesForOrganization.
private List<RegistryRole> getRolesForOrganization(String... organizationCodes) {
List<RegistryRole> registryRoleList = new LinkedList<RegistryRole>();
List<String> orgCodesToProcess = new LinkedList<String>();
for (String organizationCode : organizationCodes) {
if (!organizationCode.trim().equals("")) {
orgCodesToProcess.add(organizationCode.trim());
}
}
List<Organization> organizationList;
if (orgCodesToProcess.size() == 0) {
// Add the SRA role
String sraRoleName = RegistryRole.Type.getSRA_RoleName();
Roles sraRole = Roles.findRoleByName(sraRoleName);
registryRoleList.add(new RegistryRoleConverter().build(sraRole));
organizationList = Organization.getOrganizationsFromCache();
} else {
organizationList = new LinkedList<Organization>();
for (String organizationCode : organizationCodes) {
organizationList.add(Organization.getByCode(organizationCode));
}
}
for (Organization organization : organizationList) {
this.addRolesForOrganization(registryRoleList, organization);
}
return registryRoleList;
}
Aggregations