Search in sources :

Example 16 with RoleDAO

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);
    }
}
Also used : Locale(java.util.Locale) RoleDAO(com.runwaysdk.business.rbac.RoleDAO) Roles(com.runwaysdk.system.Roles)

Example 17 with RoleDAO

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());
    }
}
Also used : RoleDAO(com.runwaysdk.business.rbac.RoleDAO)

Example 18 with RoleDAO

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);
    }
}
Also used : Locale(java.util.Locale) RoleDAO(com.runwaysdk.business.rbac.RoleDAO) Roles(com.runwaysdk.system.Roles)

Example 19 with RoleDAO

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);
}
Also used : RoleDAO(com.runwaysdk.business.rbac.RoleDAO)

Example 20 with RoleDAO

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());
    }
}
Also used : RoleDAO(com.runwaysdk.business.rbac.RoleDAO) ComponentIF(com.runwaysdk.ComponentIF)

Aggregations

RoleDAO (com.runwaysdk.business.rbac.RoleDAO)20 Roles (com.runwaysdk.system.Roles)6 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)5 DuplicateDataException (com.runwaysdk.dataaccess.DuplicateDataException)3 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)3 MdEdgeDAO (com.runwaysdk.dataaccess.metadata.graph.MdEdgeDAO)3 Locale (java.util.Locale)3 InitializationStrategyIF (com.runwaysdk.business.ontology.InitializationStrategyIF)2 AttributeValueException (com.runwaysdk.dataaccess.attributes.AttributeValueException)2 MdAttributeDateTimeDAO (com.runwaysdk.dataaccess.metadata.MdAttributeDateTimeDAO)2 MdBusinessDAO (com.runwaysdk.dataaccess.metadata.MdBusinessDAO)2 MdTermRelationship (com.runwaysdk.system.metadata.MdTermRelationship)2 ServerHierarchyTypeBuilder (net.geoprism.registry.conversion.ServerHierarchyTypeBuilder)2 ComponentIF (com.runwaysdk.ComponentIF)1 RoleDAOIF (com.runwaysdk.business.rbac.RoleDAOIF)1 UserDAOIF (com.runwaysdk.business.rbac.UserDAOIF)1 MdAttributeCharacterDAO (com.runwaysdk.dataaccess.metadata.MdAttributeCharacterDAO)1 MdAttributeGraphReferenceDAO (com.runwaysdk.dataaccess.metadata.MdAttributeGraphReferenceDAO)1 MdVertexDAO (com.runwaysdk.dataaccess.metadata.graph.MdVertexDAO)1 QueryFactory (com.runwaysdk.query.QueryFactory)1