Package org.teiid.adminapi.impl.DataPolicyMetadata

Examples of org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData


public class TestAuthorizationValidationVisitor {

    public static final String CONN_ID = "connID"; //$NON-NLS-1$

    PermissionMetaData addResource(PermissionType type, boolean flag, String resource) {
      PermissionMetaData p = new PermissionMetaData();
      p.setResourceName(resource);
      switch(type) {
      case CREATE:
        p.setAllowCreate(flag);
        break;
      case DELETE:
        p.setAllowDelete(flag);
        break;
      case READ:
        p.setAllowRead(flag);
        break;
      case UPDATE:
        p.setAllowUpdate(flag);
        break;
      case ALTER:
        p.setAllowAlter(flag);
        break;
      case EXECUTE:
        p.setAllowExecute(flag);
        break;
      }
      return p;     
    }
View Full Code Here


   
    DataPolicyMetadata roleOne = new DataPolicyMetadata();
    roleOne.setName("roleOne");
    roleOne.setDescription("roleOne described");
   
    PermissionMetaData perm1 = new PermissionMetaData();
    perm1.setResourceName("myTable.T1");
    perm1.setAllowRead(true);
    roleOne.addPermission(perm1);
   
    PermissionMetaData perm2 = new PermissionMetaData();
    perm2.setResourceName("myTable.T2");
    perm2.setAllowRead(false);
    perm2.setAllowDelete(true);
    roleOne.addPermission(perm2);
   
    roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2"))
   
    vdb.addDataPolicy(roleOne);
View Full Code Here

   
    DataPolicyMetadata roleOne = new DataPolicyMetadata();
    roleOne.setName("roleOne"); //$NON-NLS-1$
    roleOne.setDescription("roleOne described"); //$NON-NLS-1$
    roleOne.setAllowCreateTemporaryTables(true);
    PermissionMetaData perm1 = new PermissionMetaData();
    perm1.setResourceName("myTable.T1"); //$NON-NLS-1$
    perm1.setAllowRead(true);
    roleOne.addPermission(perm1);
   
    PermissionMetaData perm2 = new PermissionMetaData();
    perm2.setResourceName("myTable.T2"); //$NON-NLS-1$
    perm2.setAllowRead(false);
    perm2.setAllowDelete(true);
    roleOne.addPermission(perm2);
   
    roleOne.setMappedRoleNames(Arrays.asList("ROLE1", "ROLE2")); //$NON-NLS-1$ //$NON-NLS-2$
   
    vdb.addDataPolicy(roleOne);
View Full Code Here

    policy.setName("readOnly"); //$NON-NLS-1$
    policy.setDescription("Only has read only permissions"); //$NON-NLS-1$
    policy.setMappedRoleNames(Arrays.asList("jack", "susan")); //$NON-NLS-1$ //$NON-NLS-2$
   
   
    PermissionMetaData perm1 = new PermissionMetaData();
    perm1.setResourceName("catalog.schema.Table1"); //$NON-NLS-1$
    perm1.setAllowRead(true);
   
    PermissionMetaData perm2 = new PermissionMetaData();
    perm2.setResourceName("catalog.schema.Table2"); //$NON-NLS-1$
    perm2.setAllowRead(false);
   
    PermissionMetaData perm3 = new PermissionMetaData();
    perm3.setResourceName("catalog.schema.Table3"); //$NON-NLS-1$
    perm3.setAllowRead(true);
   
    PermissionMetaData perm4 = new PermissionMetaData();
    perm4.setResourceName("catalog.schema.Table4"); //$NON-NLS-1$
    perm4.setAllowRead(true);
   
    PermissionMetaData perm5 = new PermissionMetaData();
    perm5.setResourceName("catalog.schema.Table5.column1"); //$NON-NLS-1$
    perm5.setAllowRead(true)
   
    policy.addPermission(perm1, perm2, perm3, perm4, perm5);
   
   
    assertTrue(policy.allows("catalog.schema.Table1", PermissionType.READ)); //$NON-NLS-1$
View Full Code Here

    super(builder);
  }

  @Override
  public void add(int index, PermissionMetaData element) {
    PermissionMetaData previous = this.map.get(builder.getKey(element));
    if (previous != null) {
      if (element.allowCreate != null) {
        previous.setAllowCreate(element.allowCreate);
      }
      if (element.allowRead != null) {
        previous.setAllowRead(element.allowRead);
      }
      if (element.allowUpdate != null) {
        previous.setAllowUpdate(element.allowUpdate);
      }
      if (element.allowDelete != null) {
        previous.setAllowDelete(element.allowDelete);
      }
    }
    else {
      super.add(index, element);
    }
View Full Code Here

TOP

Related Classes of org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData

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.