• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TablePermission类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.accumulo.core.security.TablePermission的典型用法代码示例。如果您正苦于以下问题:Java TablePermission类的具体用法?Java TablePermission怎么用?Java TablePermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TablePermission类属于org.apache.accumulo.core.security包,在下文中一共展示了TablePermission类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    connector = new MockInstance(instance).getConnector(user, pwd.getBytes());
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
    SecurityOperations secOps = connector.securityOperations();
    secOps.createUser(user, pwd.getBytes(), auths);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX, TablePermission.READ);

    conf = new AccumuloRdfConfiguration();
    ryaDAO = new AccumuloRyaDAO();
    ryaDAO.setConnector(connector);
    conf.setTablePrefix(tablePrefix);
    ryaDAO.setConf(conf);
    ryaDAO.init();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:23,代码来源:SameAsTest.java


示例2: setUp

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    connector = new MockInstance(instance).getConnector(user, new PasswordToken(pwd));
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_EVAL_SUFFIX);
    SecurityOperations secOps = connector.securityOperations();
    secOps.createLocalUser(user, new PasswordToken(pwd));
    secOps.changeUserAuthorizations(user, auths);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_EVAL_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_EVAL_SUFFIX, TablePermission.WRITE);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:20,代码来源:RdfFileInputToolTest.java


示例3: setUp

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    connector = new MockInstance(instance).getConnector(user, pwd.getBytes());
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
    connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_EVAL_SUFFIX);
    SecurityOperations secOps = connector.securityOperations();
    secOps.createUser(user, pwd.getBytes(), auths);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_EVAL_SUFFIX, TablePermission.READ);
    secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_EVAL_SUFFIX, TablePermission.WRITE);

    dao = new AccumuloRyaDAO();
    dao.setConnector(connector);
    conf.setTablePrefix(tablePrefix);
    dao.setConf(conf);
    dao.init();
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:24,代码来源:AccumuloRdfCountToolTest.java


示例4: createTableIfNeeded

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
/**
 * Creates the child table if it doesn't already exist.
 * @param childTableName the name of the child table.
 * @throws IOException
 */
public void createTableIfNeeded(final String childTableName) throws IOException {
    try {
        final Configuration childConfig = MergeToolMapper.getChildConfig(conf);
        final AccumuloRdfConfiguration childAccumuloRdfConfiguration = new AccumuloRdfConfiguration(childConfig);
        childAccumuloRdfConfiguration.setTablePrefix(childTablePrefix);
        final Connector childConnector = AccumuloRyaUtils.setupConnector(childAccumuloRdfConfiguration);
        if (!childConnector.tableOperations().exists(childTableName)) {
            log.info("Creating table: " + childTableName);
            childConnector.tableOperations().create(childTableName);
            log.info("Created table: " + childTableName);
            log.info("Granting authorizations to table: " + childTableName);
            childConnector.securityOperations().grantTablePermission(childUserName, childTableName, TablePermission.WRITE);
            log.info("Granted authorizations to table: " + childTableName);
        }
    } catch (TableExistsException | AccumuloException | AccumuloSecurityException e) {
        throw new IOException(e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:24,代码来源:CopyTool.java


示例5: createTable

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
/**
 * Creates a table and gives all users read-write access to that table.
 *
 * @param tableName
 *          name of the table.
 */
public static synchronized void createTable(String tableName) throws AccumuloException, AccumuloSecurityException, TableExistsException {
  Connector connector = getConnector();
  TableOperations tableOps = connector.tableOperations();
  tableOps.create(tableName);

  SecurityOperations secOps = connector.securityOperations();
  for (User user : User.getUsers().values()) {
    secOps.grantTablePermission(user.id, tableName, TablePermission.READ);
    secOps.grantTablePermission(user.id, tableName, TablePermission.WRITE);
    secOps.grantTablePermission(user.id, tableName, TablePermission.BULK_IMPORT);
  }
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:19,代码来源:AccumuloInstance.java


示例6: setUp

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
    super.setUp();
    connector = new MockInstance(instance).getConnector(user, new PasswordToken(pwd.getBytes()));
    connector.tableOperations().create(table);
    SecurityOperations secOps = connector.securityOperations();
    secOps.createLocalUser(user, new PasswordToken(pwd.getBytes()));
    secOps.grantTablePermission(user, table, TablePermission.READ);
    secOps.grantTablePermission(user, table, TablePermission.WRITE);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:AccumuloStorageTest.java


示例7: setupTestUsers

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
private void setupTestUsers(final Connector accumuloConn, final String ryaInstanceName, final String pcjId) throws AccumuloException, AccumuloSecurityException {
    final PasswordToken pass = new PasswordToken("password");
    final SecurityOperations secOps = accumuloConn.securityOperations();

    // We need the table name so that we can update security for the users.
    final String pcjTableName = new PcjTableNameFactory().makeTableName(ryaInstanceName, pcjId);

    // Give the 'roor' user authorizations to see everything.
    secOps.changeUserAuthorizations("root", new Authorizations("A", "B", "C", "D", "E"));

    // Create a user that can see things with A and B.
    secOps.createLocalUser("abUser", pass);
    secOps.changeUserAuthorizations("abUser", new Authorizations("A", "B"));
    secOps.grantTablePermission("abUser", pcjTableName, TablePermission.READ);

    // Create a user that can see things with A, B, and C.
    secOps.createLocalUser("abcUser", pass);
    secOps.changeUserAuthorizations("abcUser", new Authorizations("A", "B", "C"));
    secOps.grantTablePermission("abcUser", pcjTableName, TablePermission.READ);

    // Create a user that can see things with A, D, and E.
    secOps.createLocalUser("adeUser", pass);
    secOps.changeUserAuthorizations("adeUser", new Authorizations("A", "D", "E"));
    secOps.grantTablePermission("adeUser", pcjTableName, TablePermission.READ);

    // Create a user that can't see anything.
    secOps.createLocalUser("noAuth", pass);
    secOps.changeUserAuthorizations("noAuth", new Authorizations());
    secOps.grantTablePermission("noAuth", pcjTableName, TablePermission.READ);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:31,代码来源:PcjVisibilityIT.java


示例8: createTempTableIfNeeded

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
/**
 * Creates the temp child table if it doesn't already exist in the parent.
 * @param childTableName the name of the child table.
 * @throws IOException
 */
public void createTempTableIfNeeded(final String childTableName) throws IOException {
    try {
        final AccumuloRdfConfiguration accumuloRdfConfiguration = new AccumuloRdfConfiguration(conf);
        accumuloRdfConfiguration.setTablePrefix(childTablePrefix);
        final Connector connector = AccumuloRyaUtils.setupConnector(accumuloRdfConfiguration);
        if (!connector.tableOperations().exists(childTableName)) {
            log.info("Creating table: " + childTableName);
            connector.tableOperations().create(childTableName);
            log.info("Created table: " + childTableName);
            log.info("Granting authorizations to table: " + childTableName);
            final SecurityOperations secOps = connector.securityOperations();
            secOps.grantTablePermission(userName, childTableName, TablePermission.WRITE);
            log.info("Granted authorizations to table: " + childTableName);

            final Authorizations parentAuths = secOps.getUserAuthorizations(userName);
            // Add child authorizations so the temp parent table can be accessed.
            if (!parentAuths.equals(childAuthorizations)) {
                final List<String> childAuthList = findUniqueAuthsFromChild(parentAuths.toString(), childAuthorizations.toString());
                tempChildAuths = Joiner.on(",").join(childAuthList);
                log.info("Adding the authorization, \"" + tempChildAuths + "\", to the parent user, \"" + userName + "\"");
                final Authorizations newAuths = AccumuloRyaUtils.addUserAuths(userName, secOps, new Authorizations(tempChildAuths));
                secOps.changeUserAuthorizations(userName, newAuths);
            }
        }
    } catch (TableExistsException | AccumuloException | AccumuloSecurityException e) {
        throw new IOException(e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:34,代码来源:MergeTool.java


示例9: createTableIfNeeded

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
private void createTableIfNeeded() throws IOException {
    try {
        if (!childConnector.tableOperations().exists(childTableName)) {
            log.info("Creating table: " + childTableName);
            childConnector.tableOperations().create(childTableName);
            log.info("Created table: " + childTableName);
            log.info("Granting authorizations to table: " + childTableName);
            childConnector.securityOperations().grantTablePermission(childUser, childTableName, TablePermission.WRITE);
            log.info("Granted authorizations to table: " + childTableName);
        }
    } catch (TableExistsException | AccumuloException | AccumuloSecurityException e) {
        throw new IOException(e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:15,代码来源:BaseCopyToolMapper.java


示例10: createTableIfNeeded

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
private void createTableIfNeeded() throws MergerException {
    try {
        if (!doesMetadataTableExist()) {
            log.debug("Creating table: " + mergeParentMetadataTableName);
            connector.tableOperations().create(mergeParentMetadataTableName);
            log.debug("Created table: " + mergeParentMetadataTableName);
            log.debug("Granting authorizations to table: " + mergeParentMetadataTableName);
            final String username = accumuloRyaDao.getConf().get(MRUtils.AC_USERNAME_PROP);
            connector.securityOperations().grantTablePermission(username, mergeParentMetadataTableName, TablePermission.WRITE);
            log.debug("Granted authorizations to table: " + mergeParentMetadataTableName);
        }
    } catch (final TableExistsException | AccumuloException | AccumuloSecurityException e) {
        throw new MergerException("Could not create a new MergeParentMetadata table named: " + mergeParentMetadataTableName, e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:16,代码来源:AccumuloParentMetadataRepository.java


示例11: checkAccess

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
private boolean checkAccess(final Connector connector, final String user, final String table) {
    try {
        if (!connector.securityOperations().hasTablePermission(user, table, TablePermission.READ)
                && !connector.securityOperations().hasNamespacePermission(user, table, NamespacePermission.READ)) {
            return false;
        }
    } catch (final AccumuloException | AccumuloSecurityException e) {
        return false;
    }
    return true;
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:12,代码来源:RFileReaderRDD.java


示例12: hasTablePermission

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
public boolean hasTablePermission(String principal, String table, TablePermission perm) throws AccumuloException, AccumuloSecurityException {
  try {
    return client.hasTablePermission(token, principal, table, ThriftHelper.convertEnum(perm, org.apache.accumulo.proxy.thrift.TablePermission.class));
  } catch (TException e) {
    throw ExceptionFactory.accumuloException(e);
  }
}
 
开发者ID:JHUAPL,项目名称:accumulo-proxy-instance,代码行数:8,代码来源:ProxySecurityOperations.java


示例13: grantTablePermission

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
public void grantTablePermission(String principal, String table, TablePermission permission) throws AccumuloException, AccumuloSecurityException {
  try {
    client.grantTablePermission(token, principal, table, ThriftHelper.convertEnum(permission, org.apache.accumulo.proxy.thrift.TablePermission.class));

  } catch (TException e) {
    throw ExceptionFactory.accumuloException(e);
  }
}
 
开发者ID:JHUAPL,项目名称:accumulo-proxy-instance,代码行数:9,代码来源:ProxySecurityOperations.java


示例14: revokeTablePermission

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
public void revokeTablePermission(String principal, String table, TablePermission permission) throws AccumuloException, AccumuloSecurityException {
  try {
    client.revokeTablePermission(token, principal, table, ThriftHelper.convertEnum(permission, org.apache.accumulo.proxy.thrift.TablePermission.class));

  } catch (TException e) {
    throw ExceptionFactory.accumuloException(e);
  }
}
 
开发者ID:JHUAPL,项目名称:accumulo-proxy-instance,代码行数:9,代码来源:ProxySecurityOperations.java


示例15: hasTablePermission

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
@Override
public boolean hasTablePermission(String principal, String table, TablePermission perm) throws AccumuloException, AccumuloSecurityException {
    return operations.hasTablePermission(principal, NamespaceUtil.getFullTableName(namespace, table), perm);
}
 
开发者ID:ezbake,项目名称:ezbake-common-java,代码行数:5,代码来源:NamespacedSecurityOperations.java


示例16: grantTablePermission

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
@Override
public void grantTablePermission(String principal, String table, TablePermission permission) throws AccumuloException, AccumuloSecurityException {
    operations.grantTablePermission(principal, NamespaceUtil.getFullTableName(namespace, table), permission);
}
 
开发者ID:ezbake,项目名称:ezbake-common-java,代码行数:5,代码来源:NamespacedSecurityOperations.java


示例17: revokeTablePermission

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
@Override
public void revokeTablePermission(String principal, String table, TablePermission permission) throws AccumuloException, AccumuloSecurityException {
    operations.revokeTablePermission(principal, NamespaceUtil.getFullTableName(namespace, table), permission);
}
 
开发者ID:ezbake,项目名称:ezbake-common-java,代码行数:5,代码来源:NamespacedSecurityOperations.java


示例18: grantAllPermissions

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
/**
 * Grants the following Table Permissions for an Accumulo user to an Accumulo table.
 * <ul>
 *   <li>ALTER_TABLE</li>
 *   <li>BULK_IMPORT</li>
 *   <li>DROP_TABLE</li>
 *   <li>GRANT</li>
 *   <li>READ</li>
 *   <li>WRITE</li>
 * </ul>
 *
 * @param user - The user who will be granted the permissions. (not null)
 * @param table - The Accumulo table the permissions are granted to. (not null)
 * @param conn - The connector that is used to access the Accumulo instance
 *   that hosts the the {@code user} and {@code table}. (not null)
 * @throws AccumuloSecurityException If a general error occurs.
 * @throws AccumuloException If the user does not have permission to grant a user permissions.
 */
public void grantAllPermissions(final String user, final String table, final Connector conn) throws AccumuloException, AccumuloSecurityException {
    requireNonNull(user);
    requireNonNull(table);
    requireNonNull(conn);

    final SecurityOperations secOps = conn.securityOperations();
    secOps.grantTablePermission(user, table, TablePermission.ALTER_TABLE);
    secOps.grantTablePermission(user, table, TablePermission.BULK_IMPORT);
    secOps.grantTablePermission(user, table, TablePermission.DROP_TABLE);
    secOps.grantTablePermission(user, table, TablePermission.GRANT);
    secOps.grantTablePermission(user, table, TablePermission.READ);
    secOps.grantTablePermission(user, table, TablePermission.WRITE);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:32,代码来源:TablePermissions.java


示例19: revokeAllPermissions

import org.apache.accumulo.core.security.TablePermission; //导入依赖的package包/类
/**
 * Revokes the following Table Permissions for an Accumulo user from an Accumulo table.
 * <ul>
 *   <li>ALTER_TABLE</li>
 *   <li>BULK_IMPORT</li>
 *   <li>DROP_TABLE</li>
 *   <li>GRANT</li>
 *   <li>READ</li>
 *   <li>WRITE</li>
 * </ul>
 *
 * @param user - The user whose permissions will be revoked. (not null)
 * @param table - The Accumulo table the permissions are revoked from. (not null)
 * @param conn - The connector that is used to access the Accumulo instance
 *   that hosts the the {@code user} and {@code table}. (not null)
 * @throws AccumuloException If a general error occurs.
 * @throws AccumuloSecurityException If the user does not have permission to revoke a user's permissions.
 */
public void revokeAllPermissions(final String user, final String table, final Connector conn) throws AccumuloException, AccumuloSecurityException {
    requireNonNull(user);
    requireNonNull(table);
    requireNonNull(conn);

    final SecurityOperations secOps = conn.securityOperations();
    secOps.revokeTablePermission(user, table, TablePermission.ALTER_TABLE);
    secOps.revokeTablePermission(user, table, TablePermission.BULK_IMPORT);
    secOps.revokeTablePermission(user, table, TablePermission.DROP_TABLE);
    secOps.revokeTablePermission(user, table, TablePermission.GRANT);
    secOps.revokeTablePermission(user, table, TablePermission.READ);
    secOps.revokeTablePermission(user, table, TablePermission.WRITE);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:32,代码来源:TablePermissions.java



注:本文中的org.apache.accumulo.core.security.TablePermission类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CommonUtils类代码示例发布时间:2022-05-23
下一篇:
Java Certificate类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap