Package org.apache.sentry.provider.file

Examples of org.apache.sentry.provider.file.SimpleFileProviderBackend


import java.io.IOException;
import org.apache.sentry.provider.file.SimpleFileProviderBackend;

public class DBPolicyFileBackend extends SimpleDBPolicyEngine {
  public DBPolicyFileBackend(String resource, String server) throws IOException{
    super(server, new SimpleFileProviderBackend(resource));
  }
View Full Code Here


import java.io.IOException;
import org.apache.sentry.provider.file.SimpleFileProviderBackend;

public class SearchPolicyFileBackend extends SimpleSearchPolicyEngine {
  public SearchPolicyFileBackend(String resource) throws IOException{
    super(new SimpleFileProviderBackend(resource));
  }
View Full Code Here

import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.provider.file.SimpleFileProviderBackend;

public class SearchPolicyFileBackend extends SimpleSearchPolicyEngine {
  public SearchPolicyFileBackend(String resource) throws IOException{
    super(new SimpleFileProviderBackend(new Configuration(), resource));
  }
View Full Code Here

import org.apache.hadoop.conf.Configuration;
import org.apache.sentry.provider.file.SimpleFileProviderBackend;

public class DBPolicyFileBackend extends SimpleDBPolicyEngine {
  public DBPolicyFileBackend(String server, String resource) throws IOException{
    super(server, new SimpleFileProviderBackend(new Configuration(), resource));
  }
View Full Code Here

  private File baseDir;

  public PrivilegeCacheTestImpl() throws FileNotFoundException, IOException {
    baseDir = Files.createTempDir();
    PolicyFiles.copyToDir(baseDir, resourcePath);
    backend = new SimpleFileProviderBackend(new Configuration(), new File(baseDir, resourcePath)
      .toString());
    backend.initialize(new ProviderBackendContext());
  }
View Full Code Here

  }

  // import policy files
  public void importPolicy() throws Exception {
    final String requestorUserName = "hive";
    SimpleFileProviderBackend policyFileBackend;
    SentryPolicyServiceClient client;

    policyFileBackend = new SimpleFileProviderBackend(getAuthzConf(),
        getAuthzConf().get(AuthzConfVars.AUTHZ_PROVIDER_RESOURCE.getVar()));
    ProviderBackendContext context = new ProviderBackendContext();
    context.setAllowPerDatabase(true);
    policyFileBackend.initialize(context);
    client = new SentryPolicyServiceClient(getAuthzConf());
    Set<String> roles = new HashSet<String>();
    for (TSentryRole sentryRole : client.listRoles(requestorUserName)) {
      roles.add(sentryRole.getRoleName());
    }

    Table<String, String, Set<String>> groupRolePrivilegeTable =
        policyFileBackend.getGroupRolePrivilegeTable();
    for(String groupName : groupRolePrivilegeTable.rowKeySet()) {
      for(String roleName : groupRolePrivilegeTable.columnKeySet()) {
        if (!roles.contains(roleName)) {
          client.createRole(requestorUserName, roleName);
          System.out.println(String.format("CREATE ROLE %s;", roleName));
View Full Code Here

TOP

Related Classes of org.apache.sentry.provider.file.SimpleFileProviderBackend

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.