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) + 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()); } }
result = result && getUsersAndPermissions() .equals(other.getUsersAndPermissions());
hash = (53 * hash) + getUsersAndPermissions().hashCode();
.computeMessageSize(7, getUsersAndPermissions());
mergeUsersAndPermissions(other.getUsersAndPermissions());
public void writeTo(org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) == 0x00000001)) { org.apache.hbase.thirdparty.com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { org.apache.hbase.thirdparty.com.google.protobuf.GeneratedMessageV3.writeString(output, 2, table_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt64(3, creationTime_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeEnum(4, type_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt32(5, version_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { org.apache.hbase.thirdparty.com.google.protobuf.GeneratedMessageV3.writeString(output, 6, owner_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeMessage(7, getUsersAndPermissions()); } unknownFields.writeTo(output); }
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; }
result = result && getUsersAndPermissions() .equals(other.getUsersAndPermissions());
mergeUsersAndPermissions(other.getUsersAndPermissions());
.computeMessageSize(7, getUsersAndPermissions());
public void writeTo(org.apache.hbase.thirdparty.com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (((bitField0_ & 0x00000001) == 0x00000001)) { org.apache.hbase.thirdparty.com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { org.apache.hbase.thirdparty.com.google.protobuf.GeneratedMessageV3.writeString(output, 2, table_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt64(3, creationTime_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeEnum(4, type_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt32(5, version_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { org.apache.hbase.thirdparty.com.google.protobuf.GeneratedMessageV3.writeString(output, 6, owner_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeMessage(7, getUsersAndPermissions()); } unknownFields.writeTo(output); }
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); } }