Package org.jresearch.flexess.core.model.uam

Examples of org.jresearch.flexess.core.model.uam.PObject


    boolean objectFound = false;
    final Class<?> currentClass = checkerFlow.getObjectClass();
    final List<Class<?>> classes = getCandidateClasses(currentClass);
    for (final Class<?> candidatClass : classes) {
      try {
        final PObject po = findPObject(model, candidatClass.getName(), object);
        isPermitted = internalCheck(po, roles, operation, checkerFlow);
        objectFound = true;
        break;
      } catch (final PObjectNotFoundException e) {
        // do nothing
View Full Code Here


  }

  // TODO UAM-749: implement plugable findPObject
  private static PObject findPObject(final SecurityModel model, final String classname, final Object object) throws PObjectNotFoundException {
    PObject po = null;
    if (object != null && classname.equals(String.class.getName())) {
      po = findCustomPObject(model, object.toString());
    }
    if (po == null) {
      po = findPObject(model, classname);
View Full Code Here

   * org.jresearch.flexess.api.IConstraintEvaluator#evaluate(org.eclipse.emf
   * .ecore.EObject)
   */
  @Override
  public boolean evaluate(EObject pObjectInstance, EObject roleInstance, POperation operation) {
    PObject pObject = (PObject) pObjectInstance.eClass();
    Collection<EObject> permissionInstances = findPermission(pObject, roleInstance, operation);
    for (EObject permissionInstance : permissionInstances)
      if (checkPermission(pObjectInstance, permissionInstance))
        return true;
    return false;
View Full Code Here

    permission.setConstraint(constraint);
    constraint.setExpession(expression);
    model.getEClassifiers().add(permission);

    // Create protected object with region attribute
    PObject pObject = uamFactory.createPObject();
    pObject.setName("TestProtectedObject");
    EAttribute pObjectRegionAttr = getRegionAttr();
    pObject.getEStructuralFeatures().add(pObjectRegionAttr);
    pObject.getPermission().add(permission);
    // permission.setPObject(pObject);
    // EMFUtil.addPobject(permission, pObject);
    model.getEClassifiers().add(pObject);

    // create operation
    POperation operation = UamFactory.eINSTANCE.createPOperation();
    operation.setName("TestOperation");
    pObject.getEOperations().add(operation);

    // Create role
    Role role = uamFactory.createRole();
    role.setName("TestRole");
    EReference permissionRef = EMFUtil.addPermission(role, permission);
View Full Code Here

  protected void tearDown() throws Exception {
    setFixture(null);
  }

  public void testCheck() {
    PObject tested = getFixture();
   
    String iId = "testId";   
    tested.setId(iId);
    assertEquals(iId, tested.getId());
   
    Permission[] permissions = new Permission[]{UamFactory.eINSTANCE.createPermission(), UamFactory.eINSTANCE.createPermission()};
   
    permissions[0].setPObject(tested);
    permissions[1].setPObject(tested);
   
    EList list = tested.getPermission();
   
    assertTrue(list.contains(permissions[0]));
    assertTrue(list.contains(permissions[1]));   
  }
View Full Code Here

    String iId = "testId";   
    tested.setId(iId);
    assertEquals(iId, tested.getId());
   
    Constraint iConstraint = UamFactory.eINSTANCE.createConstraint()
    PObject iPObject = UamFactory.eINSTANCE.createPObject();
   
    tested.setConstraint( iConstraint );
    tested.setPObject( iPObject );
   
    assertEquals( iConstraint, tested.getConstraint());
View Full Code Here

      Role role = it.next();
      ElementDescription ed = createElementDescription(role);
      pm.addRole(ed);
    }

    PObject po = permission.getPObject();
    if (permission.getPOperation().isEmpty() && po != null) {
      ElementDescription ed = createElementDescription(po);
      pm.setPObjectDescription(ed);
    }
    return pm;
View Full Code Here

public class PObjectDAO extends EMFDaoSupport implements IPObjectDAO {

  @Override
  public IPObjectMetaInfo findPObject(String modelId, String name) throws ObjectNotFoundException {
    PObject po = getPObjectByName(modelId, name);
    if (po == null) {
      return null;
    }
    return loadPobject(modelId, po);
  }
View Full Code Here

    return loadPobject(modelId, po);
  }

  @Override
  public IPObjectMetaInfo getPObject(String modelId, String id) throws ObjectNotFoundException {
    PObject po = getPObjectById(modelId, id);
    if (po == null) {
      return null;
    }
    return loadPobject(modelId, po);
  }
View Full Code Here

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   */
  public NotificationChain basicSetPObject(PObject newPObject, NotificationChain msgs) {
    PObject oldPObject = pObject;
    pObject = newPObject;
    if (newPObject == null) {
      EMFUtil.removePObject(this);
    } else {
      EMFUtil.addPobject(this, newPObject);
View Full Code Here

TOP

Related Classes of org.jresearch.flexess.core.model.uam.PObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.