Examples of AccessURI


Examples of org.apache.sentry.core.AccessURI

    View view = (View)Authorizables.from("vIeW=v1");
    assertEquals("v1", view.getName());
  }
  @Test
  public void testURI() throws Exception {
    AccessURI uri = (AccessURI)Authorizables.from("UrI=hdfs://uri1:8200/blah");
    assertEquals("hdfs://uri1:8200/blah", uri.getName());
  }
View Full Code Here

Examples of org.apache.sentry.core.AccessURI

  @Test
  public void testDuplicateEntries() throws Exception {
    Subject user1 = new Subject("user1");
    Server server1 = new Server("server1");
    AccessURI uri = new AccessURI("file:///path/to/");
    EnumSet<Action> actions = EnumSet.of(Action.ALL, Action.SELECT, Action.INSERT);
    policyFile.addGroupsToUser(user1.getName(), true, "group1", "group1")
      .addRolesToGroup("group1",  true, "role1", "role1")
      .addPermissionsToRole("role1", true, "server=" + server1.getName() + "->uri=" + uri.getName(),
          "server=" + server1.getName() + "->uri=" + uri.getName());
    policyFile.write(iniFile);
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, server1.getName());
    List<Authorizable> authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertTrue(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
View Full Code Here

Examples of org.apache.sentry.core.AccessURI

  }
  @Test
  public void testNonAbolutePath() throws Exception {
    Subject user1 = new Subject("user1");
    Server server1 = new Server("server1");
    AccessURI uri = new AccessURI("file:///path/to/");
    EnumSet<Action> actions = EnumSet.of(Action.ALL, Action.SELECT, Action.INSERT);
    policyFile.addGroupsToUser(user1.getName(), "group1")
      .addRolesToGroup("group1", "role1")
      .addPermissionsToRole("role1", "server=" + server1.getName() + "->uri=" + uri.getName());
    policyFile.write(iniFile);
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, server1.getName());
    // positive test
    List<Authorizable> authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertTrue(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    // negative tests
    // TODO we should support the case of /path/to/./ but let's to that later
    uri = new AccessURI("file:///path/to/./");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    uri = new AccessURI("file:///path/to/../");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    uri = new AccessURI("file:///path/to/../../");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    uri = new AccessURI("file:///path/to/dir/../../");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
  }
View Full Code Here

Examples of org.apache.sentry.core.AccessURI

    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
  }
  @Test(expected=IllegalArgumentException.class)
  public void testInvalidPath() throws Exception {
    new AccessURI(":invaliduri");
  }
View Full Code Here

Examples of org.apache.sentry.core.model.db.AccessURI

    View view = (View)DBModelAuthorizables.from("vIeW=v1");
    assertEquals("v1", view.getName());
  }
  @Test
  public void testURI() throws Exception {
    AccessURI uri = (AccessURI)DBModelAuthorizables.from("UrI=hdfs://uri1:8200/blah");
    assertEquals("hdfs://uri1:8200/blah", uri.getName());
  }
View Full Code Here

Examples of org.apache.sentry.core.model.db.AccessURI

  @Test
  public void testDuplicateEntries() throws Exception {
    Subject user1 = new Subject("user1");
    Server server1 = new Server("server1");
    AccessURI uri = new AccessURI("file:///path/to/");
    Set<? extends Action> actions = EnumSet.of(DBModelAction.ALL, DBModelAction.SELECT, DBModelAction.INSERT);
    policyFile.addGroupsToUser(user1.getName(), true, "group1", "group1")
      .addRolesToGroup("group1",  true, "role1", "role1")
      .addPermissionsToRole("role1", true, "server=" + server1.getName() + "->uri=" + uri.getName(),
          "server=" + server1.getName() + "->uri=" + uri.getName());
    policyFile.write(iniFile);
    DBPolicyFileBackend policy = new DBPolicyFileBackend(initResource, server1.getName());
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, policy);
    List<? extends Authorizable> authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertTrue(authorizableHierarchy.toString(),
View Full Code Here

Examples of org.apache.sentry.core.model.db.AccessURI

  }
  @Test
  public void testNonAbolutePath() throws Exception {
    Subject user1 = new Subject("user1");
    Server server1 = new Server("server1");
    AccessURI uri = new AccessURI("file:///path/to/");
    Set<? extends Action> actions = EnumSet.of(DBModelAction.ALL, DBModelAction.SELECT, DBModelAction.INSERT);
    policyFile.addGroupsToUser(user1.getName(), "group1")
      .addRolesToGroup("group1", "role1")
      .addPermissionsToRole("role1", "server=" + server1.getName() + "->uri=" + uri.getName());
    policyFile.write(iniFile);
    DBPolicyFileBackend policy = new DBPolicyFileBackend(initResource, server1.getName());
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, policy);
    // positive test
    List<? extends Authorizable> authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertTrue(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    // negative tests
    // TODO we should support the case of /path/to/./ but let's to that later
    uri = new AccessURI("file:///path/to/./");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    uri = new AccessURI("file:///path/to/../");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    uri = new AccessURI("file:///path/to/../../");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
    uri = new AccessURI("file:///path/to/dir/../../");
    authorizableHierarchy = ImmutableList.of(server1, uri);
    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
  }
View Full Code Here

Examples of org.apache.sentry.core.model.db.AccessURI

    Assert.assertFalse(authorizableHierarchy.toString(),
        authzProvider.hasAccess(user1, authorizableHierarchy, actions));
  }
  @Test(expected=IllegalArgumentException.class)
  public void testInvalidPath() throws Exception {
    new AccessURI(":invaliduri");
  }
View Full Code Here

Examples of org.apache.sentry.core.model.db.AccessURI

    case Table:
      return new Table(name);
    case View:
      return new View(name);
    case URI:
      return new AccessURI(name);
    default:
      return null;
    }
  }
View Full Code Here

Examples of org.apache.sentry.core.model.db.AccessURI

   */
  @Test
  public void testValidateCreateFunctionForAdmin() throws Exception {
    inputTabHierarcyList.add(buildObjectHierarchy(SERVER1, null, null));
    inputTabHierarcyList.add(Arrays.asList(new DBModelAuthorizable[] {
        new Server(SERVER1), new AccessURI("file:///some/path/to/a/jar")
    }));
    testAuth.authorize(HiveOperation.CREATEFUNCTION, createFuncPrivileges, ADMIN_SUBJECT,
        inputTabHierarcyList, outputTabHierarcyList);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.