gpt4 book ai didi

org.apache.accumulo.server.security.handler.ZKSecurityTool.convertTablePermissions()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:12:03 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.accumulo.server.security.handler.ZKSecurityTool.convertTablePermissions()方法的一些代码示例,展示了ZKSecurityTool.convertTablePermissions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKSecurityTool.convertTablePermissions()方法的具体详情如下:
包路径:org.apache.accumulo.server.security.handler.ZKSecurityTool
类名称:ZKSecurityTool
方法名:convertTablePermissions

ZKSecurityTool.convertTablePermissions介绍

暂无

代码示例

代码示例来源:origin: apache/accumulo

@Override
public boolean hasCachedTablePermission(String user, String table, TablePermission permission) {
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 if (serializedPerms != null) {
  return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);
 }
 return false;
}

代码示例来源:origin: apache/accumulo

/**
 * Sets up a new table configuration for the provided user/table. No checking for existence is
 * done here, it should be done before calling.
 */
private void createTablePerm(String user, Table.ID table, Set<TablePermission> perms)
  throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
    ZKSecurityTool.convertTablePermissions(perms), NodeExistsPolicy.FAIL);
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void grantTablePermission(String user, String table, TablePermission permission)
  throws AccumuloSecurityException {
 Set<TablePermission> tablePerms;
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 if (serializedPerms != null)
  tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
 else
  tablePerms = new TreeSet<>();
 try {
  if (tablePerms.add(permission)) {
   synchronized (zooCache) {
    zooCache.clear(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
    zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
      ZKSecurityTool.convertTablePermissions(tablePerms), NodeExistsPolicy.OVERWRITE);
   }
  }
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: apache/accumulo

@Override
public void revokeTablePermission(String user, String table, TablePermission permission)
  throws AccumuloSecurityException {
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 // User had no table permission, nothing to revoke.
 if (serializedPerms == null)
  return;
 Set<TablePermission> tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
 try {
  if (tablePerms.remove(permission)) {
   zooCache.clear();
   if (tablePerms.size() == 0)
    zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
      NodeMissingPolicy.SKIP);
   else
    zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
      ZKSecurityTool.convertTablePermissions(tablePerms), NodeExistsPolicy.OVERWRITE);
  }
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: apache/accumulo

return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);

代码示例来源:origin: org.apache.accumulo/accumulo-server

@Override
public boolean hasCachedTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 if (serializedPerms != null) {
  return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);
 }
 return false;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

@Override
public boolean hasCachedTablePermission(String user, String table, TablePermission permission)
  throws AccumuloSecurityException, TableNotFoundException {
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 if (serializedPerms != null) {
  return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);
 }
 return false;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

@Override
public void grantTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException {
 Set<TablePermission> tablePerms;
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 if (serializedPerms != null)
  tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
 else
  tablePerms = new TreeSet<TablePermission>();
 try {
  if (tablePerms.add(permission)) {
   synchronized (zooCache) {
    zooCache.clear(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
    zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, ZKSecurityTool.convertTablePermissions(tablePerms),
      NodeExistsPolicy.OVERWRITE);
   }
  }
 } catch (KeeperException e) {
  log.error(e, e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error(e, e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

@Override
public void grantTablePermission(String user, String table, TablePermission permission)
  throws AccumuloSecurityException {
 Set<TablePermission> tablePerms;
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 if (serializedPerms != null)
  tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
 else
  tablePerms = new TreeSet<>();
 try {
  if (tablePerms.add(permission)) {
   synchronized (zooCache) {
    zooCache.clear(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
    ZooReaderWriter.getInstance().putPersistentData(
      ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
      ZKSecurityTool.convertTablePermissions(tablePerms), NodeExistsPolicy.OVERWRITE);
   }
  }
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

@Override
public void revokeTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException {
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 // User had no table permission, nothing to revoke.
 if (serializedPerms == null)
  return;
 Set<TablePermission> tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
 try {
  if (tablePerms.remove(permission)) {
   zooCache.clear();
   IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
   if (tablePerms.size() == 0)
    zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, NodeMissingPolicy.SKIP);
   else
    zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table, ZKSecurityTool.convertTablePermissions(tablePerms),
      NodeExistsPolicy.OVERWRITE);
  }
 } catch (KeeperException e) {
  log.error(e, e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error(e, e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

/**
 * Sets up a new table configuration for the provided user/table. No checking for existence is done here, it should be done before calling.
 */
private void createTablePerm(String user, String table, Set<TablePermission> perms) throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  ZooReaderWriter.getRetryingInstance().putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
    ZKSecurityTool.convertTablePermissions(perms), NodeExistsPolicy.FAIL);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

@Override
public void revokeTablePermission(String user, String table, TablePermission permission)
  throws AccumuloSecurityException {
 byte[] serializedPerms = zooCache.get(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table);
 // User had no table permission, nothing to revoke.
 if (serializedPerms == null)
  return;
 Set<TablePermission> tablePerms = ZKSecurityTool.convertTablePermissions(serializedPerms);
 try {
  if (tablePerms.remove(permission)) {
   zooCache.clear();
   IZooReaderWriter zoo = ZooReaderWriter.getInstance();
   if (tablePerms.size() == 0)
    zoo.recursiveDelete(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
      NodeMissingPolicy.SKIP);
   else
    zoo.putPersistentData(ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
      ZKSecurityTool.convertTablePermissions(tablePerms), NodeExistsPolicy.OVERWRITE);
  }
 } catch (KeeperException e) {
  log.error("{}", e.getMessage(), e);
  throw new AccumuloSecurityException(user, SecurityErrorCode.CONNECTION_ERROR, e);
 } catch (InterruptedException e) {
  log.error("{}", e.getMessage(), e);
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

/**
 * Sets up a new table configuration for the provided user/table. No checking for existence is
 * done here, it should be done before calling.
 */
private void createTablePerm(String user, String table, Set<TablePermission> perms)
  throws KeeperException, InterruptedException {
 synchronized (zooCache) {
  zooCache.clear();
  ZooReaderWriter.getInstance().putPersistentData(
    ZKUserPath + "/" + user + ZKUserTablePerms + "/" + table,
    ZKSecurityTool.convertTablePermissions(perms), NodeExistsPolicy.FAIL);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);

代码示例来源:origin: org.apache.accumulo/accumulo-server

return ZKSecurityTool.convertTablePermissions(serializedPerms).contains(permission);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com