use of com.runwaysdk.business.rbac.RoleDAO in project geoprism-registry by terraframe.
the class ServerGeoObjectTypeConverter method create_RC_GeoObjectTypeRole.
private void create_RC_GeoObjectTypeRole(MdGeoVertexDAO mdGeoVertexDAO, String organizationCode, String geoObjectTypeCode) {
if (organizationCode != null && !organizationCode.trim().equals("")) {
String rcRoleName = RegistryRole.Type.getRC_RoleName(organizationCode, geoObjectTypeCode);
Locale locale = Session.getCurrentLocale();
String defaultDisplayLabel = mdGeoVertexDAO.getLocalValue(MdGeoVertexInfo.DISPLAY_LABEL, locale) + " Registry Contributor";
Roles rcOrgRole = new Roles();
rcOrgRole.setRoleName(rcRoleName);
rcOrgRole.getDisplayLabel().setDefaultValue(defaultDisplayLabel);
rcOrgRole.apply();
String orgRoleName = RegistryRole.Type.getRootOrgRoleName(organizationCode);
Roles orgRole = Roles.findRoleByName(orgRoleName);
RoleDAO orgRoleDAO = (RoleDAO) BusinessFacade.getEntityDAO(orgRole);
RoleDAO rcOrgRoleDAO = (RoleDAO) BusinessFacade.getEntityDAO(rcOrgRole);
orgRoleDAO.addInheritance(rcOrgRoleDAO);
// Inherit the permissions from the root RC role
RoleDAO rootRC_DAO = (RoleDAO) BusinessFacade.getEntityDAO(Roles.findRoleByName(RegistryConstants.REGISTRY_CONTRIBUTOR_ROLE));
rootRC_DAO.addInheritance(rcOrgRoleDAO);
}
}
use of com.runwaysdk.business.rbac.RoleDAO in project geoprism-registry by terraframe.
the class ServerGeoObjectTypeConverter method assign_AC_GeoObjectTypeRole.
private void assign_AC_GeoObjectTypeRole(MdGeoVertexDAO mdGeoVertexDAO, MdBusiness mdBusiness, String organizationCode, String geoObjectTypeCode) {
if (organizationCode != null && !organizationCode.trim().equals("")) {
String rmRoleName = RegistryRole.Type.getAC_RoleName(organizationCode, geoObjectTypeCode);
RoleDAO rmRole = RoleDAO.findRole(rmRoleName).getBusinessDAO();
rmRole.grantPermission(Operation.READ, mdGeoVertexDAO.getOid());
rmRole.grantPermission(Operation.READ_ALL, mdGeoVertexDAO.getOid());
rmRole.grantPermission(Operation.READ, mdBusiness.getOid());
rmRole.grantPermission(Operation.READ_ALL, mdBusiness.getOid());
}
}
use of com.runwaysdk.business.rbac.RoleDAO in project geoprism-registry by terraframe.
the class ServerGeoObjectTypeConverter method create_AC_GeoObjectTypeRole.
private void create_AC_GeoObjectTypeRole(MdGeoVertexDAO mdGeoVertexDAO, String organizationCode, String geoObjectTypeCode) {
if (organizationCode != null && !organizationCode.trim().equals("")) {
String acRoleName = RegistryRole.Type.getAC_RoleName(organizationCode, geoObjectTypeCode);
Locale locale = Session.getCurrentLocale();
String defaultDisplayLabel = mdGeoVertexDAO.getLocalValue(MdGeoVertexInfo.DISPLAY_LABEL, locale) + " API Consumer";
Roles acOrgRole = new Roles();
acOrgRole.setRoleName(acRoleName);
acOrgRole.getDisplayLabel().setDefaultValue(defaultDisplayLabel);
acOrgRole.apply();
String orgRoleName = RegistryRole.Type.getRootOrgRoleName(organizationCode);
Roles orgRole = Roles.findRoleByName(orgRoleName);
RoleDAO orgRoleDAO = (RoleDAO) BusinessFacade.getEntityDAO(orgRole);
RoleDAO acOrgRoleDAO = (RoleDAO) BusinessFacade.getEntityDAO(acOrgRole);
orgRoleDAO.addInheritance(acOrgRoleDAO);
// Inherit the permissions from the root RC role
RoleDAO rootAC_DAO = (RoleDAO) BusinessFacade.getEntityDAO(Roles.findRoleByName(RegistryConstants.API_CONSUMER_ROLE));
rootAC_DAO.addInheritance(acOrgRoleDAO);
}
}
use of com.runwaysdk.business.rbac.RoleDAO in project geoprism-registry by terraframe.
the class ServerHierarchyTypeBuilder method grantWritePermissionsOnMdTermRel.
public void grantWritePermissionsOnMdTermRel(ComponentIF mdTermRelationship) {
RoleDAO adminRole = RoleDAO.findRole(DefaultConfiguration.ADMIN).getBusinessDAO();
grantWritePermissionsOnMdTermRel(adminRole, mdTermRelationship);
}
use of com.runwaysdk.business.rbac.RoleDAO in project geoprism-registry by terraframe.
the class SearchService method assignAllPermissions.
private void assignAllPermissions(Roles role, ComponentIF... components) {
RoleDAO roleDAO = (RoleDAO) BusinessFacade.getEntityDAO(role);
for (ComponentIF component : components) {
roleDAO.grantPermission(Operation.CREATE, component.getOid());
roleDAO.grantPermission(Operation.DELETE, component.getOid());
roleDAO.grantPermission(Operation.WRITE, component.getOid());
roleDAO.grantPermission(Operation.WRITE_ALL, component.getOid());
roleDAO.grantPermission(Operation.READ, component.getOid());
roleDAO.grantPermission(Operation.READ_ALL, component.getOid());
}
}
Aggregations