/** * Update the mask to be the union of owning group entry, named user entry and named group entry. * This method must be called when the aforementioned entries are modified. */ public void updateMask() { if (hasExtended()) { AclActions actions = getOwningGroupActions(); mExtendedEntries.updateMask(actions); } }
return new AclActions(getOwningUserActions()); if (hasExtended()) { AclActions actions = mExtendedEntries.getNamedUser(user); if (actions != null) { groupActions.merge(getOwningGroupActions()); if (hasExtended()) { for (String group : groups) { AclActions actions = mExtendedEntries.getNamedGroup(group); if (hasExtended()) { groupActions.mask(mExtendedEntries.mMaskActions);
@Override public String getFingerprint(String path) { // TODO(yuzhu): include default ACL in the fingerprint try { UfsStatus status = getStatus(path); Pair<AccessControlList, DefaultAccessControlList> aclPair = getAclPair(path); if (aclPair == null || aclPair.getFirst() == null || !aclPair.getFirst().hasExtended()) { return Fingerprint.create(getUnderFSType(), status).serialize(); } else { return Fingerprint.create(getUnderFSType(), status, aclPair.getFirst()).serialize(); } } catch (Exception e) { // In certain scenarios, it is expected that the UFS path does not exist. LOG.debug("Failed fingerprint. path: {} error: {}", path, e.toString()); return Constants.INVALID_UFS_FINGERPRINT; } }
/** * Returns a list of {@link AclEntry} which represent this ACL instance. The mask will only be * included if extended ACL entries exist. * * @return an immutable list of ACL entries */ public List<AclEntry> getEntries() { ImmutableList.Builder<AclEntry> builder = new ImmutableList.Builder<>(); builder.add(new AclEntry.Builder() .setType(AclEntryType.OWNING_USER) .setSubject(mOwningUser) .setActions(getOwningUserActions()) .build()); builder.add(new AclEntry.Builder() .setType(AclEntryType.OWNING_GROUP) .setSubject(mOwningGroup) .setActions(getOwningGroupActions()) .build()); builder.add(new AclEntry.Builder() .setType(AclEntryType.OTHER) .setActions(getOtherActions()) .build()); if (hasExtended()) { builder.addAll(mExtendedEntries.getEntries()); } return builder.build(); }
for (AclEntry entry : entries) { if ((entry.isDefault() && inode.getDefaultACL().hasExtended()) || (!entry.isDefault() && inode.getACL().hasExtended())) { if (entry.getType() == AclEntryType.MASK) { throw new InvalidArgumentException(
private void printLsString(URIStatus status, boolean hSize) { // detect the extended acls boolean hasExtended = status.getAcl().hasExtended() || !status.getDefaultAcl().isEmpty(); System.out.print(formatLsString(hSize, SecurityUtils.isSecurityEnabled(mFsContext.getConf()), status.isFolder(), FormatUtils.formatMode((short) status.getMode(), status.isFolder(), hasExtended), status.getOwner(), status.getGroup(), status.getLength(), status.getLastModificationTimeMs(), status.getInAlluxioPercentage(), status.getPersistenceState(), status.getPath(), mFsContext.getConf().get(PropertyKey.USER_DATE_FORMAT_PATTERN))); }
/** * @param acl the access control list to convert * @return the proto representation of this object */ public static PAcl toProto(AccessControlList acl) { PAcl.Builder pAcl = PAcl.newBuilder(); pAcl.setOwner(acl.getOwningUser()); pAcl.setOwningGroup(acl.getOwningGroup()); pAcl.setMode(acl.getMode()); if (acl.hasExtended()) { for (AclEntry entry : acl.getExtendedEntries().getEntries()) { pAcl.addEntries(toProto(entry)); } } pAcl.setIsDefault(false); return pAcl.build(); }
/** * Creates a new instance of {@link alluxio.util.webui.UIFileInfo}. * * @param status underlying {@link URIStatus} */ public UIFileInfo(URIStatus status) { // detect the extended acls boolean hasExtended = status.getAcl().hasExtended() || !status.getDefaultAcl().isEmpty(); mId = status.getFileId(); mName = status.getName(); mAbsolutePath = status.getPath(); mBlockSizeBytes = status.getBlockSizeBytes(); mSize = status.getLength(); mCreationTimeMs = status.getCreationTimeMs(); mLastModificationTimeMs = status.getLastModificationTimeMs(); mInAlluxio = (100 == status.getInAlluxioPercentage()); mInAlluxioPercentage = status.getInAlluxioPercentage(); mIsDirectory = status.isFolder(); mPinned = status.isPinned(); mOwner = status.getOwner(); mGroup = status.getGroup(); mMode = FormatUtils.formatMode((short) status.getMode(), status.isFolder(), hasExtended); mPersistenceState = status.getPersistenceState(); mFileLocations = new ArrayList<>(); }
= ufs.getAclPair(ufsUri.toString()); if (aclPair == null || aclPair.getFirst() == null || !aclPair.getFirst().hasExtended()) { ufsFpParsed = Fingerprint.create(ufs.getUnderFSType(), cachedStatus); ufsFingerprint = ufsFpParsed.serialize();