public static void restoreSnapshotAcl(SnapshotDescription snapshot, TableName newTableName, Configuration conf) throws IOException { if (snapshot.hasUsersAndPermissions() && snapshot.getUsersAndPermissions() != null) { LOG.info("Restore snapshot acl to table. snapshot: " + snapshot + ", table: " + newTableName); ListMultimap<String, Permission> perms = ShadedAccessControlUtil.toUserTablePermissions(snapshot.getUsersAndPermissions()); try (Connection conn = ConnectionFactory.createConnection(conf)) { for (Entry<String, Permission> e : perms.entries()) { String user = e.getKey(); TablePermission tablePerm = (TablePermission) e.getValue(); TablePermission newPerm = new TablePermission(newTableName, tablePerm.getFamily(), tablePerm.getQualifier(), tablePerm.getActions()); AccessControlClient.grant(conn, newPerm.getTableName(), user, newPerm.getFamily(), newPerm.getQualifier(), newPerm.getActions()); } } catch (Throwable e) { throw new IOException("Grant acl into newly creatd table failed. snapshot: " + snapshot + ", table: " + newTableName, e); } } } }
hash = (53 * hash) + getOwner().hashCode(); if (hasUsersAndPermissions()) { hash = (37 * hash) + USERS_AND_PERMISSIONS_FIELD_NUMBER; hash = (53 * hash) + getUsersAndPermissions().hashCode();
private void restoreSnapshotAcl(final MasterProcedureEnv env) throws IOException { if (restoreAcl && snapshot.hasUsersAndPermissions() && snapshot.getUsersAndPermissions() != null && SnapshotDescriptionUtils .isSecurityAvailable(env.getMasterServices().getConfiguration())) { // restore acl of snapshot to table. RestoreSnapshotHelper.restoreSnapshotAcl(snapshot, TableName.valueOf(snapshot.getTable()), env.getMasterServices().getConfiguration()); } }
.equals(other.getOwner()); result = result && (hasUsersAndPermissions() == other.hasUsersAndPermissions()); if (hasUsersAndPermissions()) { result = result && getUsersAndPermissions() .equals(other.getUsersAndPermissions());
hash = (53 * hash) + getOwner().hashCode(); if (hasUsersAndPermissions()) { hash = (37 * hash) + USERS_AND_PERMISSIONS_FIELD_NUMBER; hash = (53 * hash) + getUsersAndPermissions().hashCode();
onChanged(); if (other.hasUsersAndPermissions()) { mergeUsersAndPermissions(other.getUsersAndPermissions());
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; if (!hasName()) { memoizedIsInitialized = 0; return false; } if (hasUsersAndPermissions()) { if (!getUsersAndPermissions().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
.equals(other.getOwner()); result = result && (hasUsersAndPermissions() == other.hasUsersAndPermissions()); if (hasUsersAndPermissions()) { result = result && getUsersAndPermissions() .equals(other.getUsersAndPermissions());
onChanged(); if (other.hasUsersAndPermissions()) { mergeUsersAndPermissions(other.getUsersAndPermissions());
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; if (!hasName()) { memoizedIsInitialized = 0; return false; } if (hasUsersAndPermissions()) { if (!getUsersAndPermissions().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
private void restoreSnapshotAcl(MasterProcedureEnv env) throws IOException { Configuration conf = env.getMasterServices().getConfiguration(); if (restoreAcl && snapshot.hasUsersAndPermissions() && snapshot.getUsersAndPermissions() != null && SnapshotDescriptionUtils.isSecurityAvailable(conf)) { RestoreSnapshotHelper.restoreSnapshotAcl(snapshot, tableDescriptor.getTableName(), conf); } }