/** * Build list of AclEntries from the AclFeature * @param aclFeature AclFeature * @return List of entries */ @VisibleForTesting static ImmutableList<AclEntry> getEntriesFromAclFeature(AclFeature aclFeature) { if (aclFeature == null) { return ImmutableList.<AclEntry> of(); } ImmutableList.Builder<AclEntry> b = new ImmutableList.Builder<AclEntry>(); for (int pos = 0, entry; pos < aclFeature.getEntriesSize(); pos++) { entry = aclFeature.getEntryAt(pos); b.add(AclEntryStatusFormat.toAclEntry(entry)); } return b.build(); }
private static AclFeatureProto.Builder buildAclEntries(AclFeature f) { AclFeatureProto.Builder b = AclFeatureProto.newBuilder(); for (int pos = 0, e; pos < f.getEntriesSize(); pos++) { e = f.getEntryAt(pos); b.addEntries(e); } return b; }
private boolean hasPermission(INodeAttributes inode, FsAction access) { if (inode == null) { return true; } final FsPermission mode = inode.getFsPermission(); final AclFeature aclFeature = inode.getAclFeature(); if (aclFeature != null && aclFeature.getEntriesSize() > 0) { // It's possible that the inode has a default ACL but no access ACL. int firstEntry = aclFeature.getEntryAt(0); if (AclEntryStatusFormat.getScope(firstEntry) == AclEntryScope.ACCESS) { return hasAclPermission(inode, access, mode, aclFeature); } } final FsAction checkAction; if (getUser().equals(inode.getUserName())) { //user class checkAction = mode.getUserAction(); } else if (isMemberOfGroup(inode.getGroupName())) { //group class checkAction = mode.getGroupAction(); } else { //other class checkAction = mode.getOtherAction(); } return checkAction.implies(access); }
entry = aclFeature.getEntryAt(pos); if (AclEntryStatusFormat.getScope(entry) == AclEntryScope.DEFAULT) { break;
/** * Build list of AclEntries from the AclFeature * @param aclFeature AclFeature * @return List of entries */ @VisibleForTesting static ImmutableList<AclEntry> getEntriesFromAclFeature(AclFeature aclFeature) { if (aclFeature == null) { return ImmutableList.<AclEntry> of(); } ImmutableList.Builder<AclEntry> b = new ImmutableList.Builder<AclEntry>(); for (int pos = 0, entry; pos < aclFeature.getEntriesSize(); pos++) { entry = aclFeature.getEntryAt(pos); b.add(AclEntryStatusFormat.toAclEntry(entry)); } return b.build(); }
/** * Build list of AclEntries from the AclFeature * @param aclFeature AclFeature * @return List of entries */ @VisibleForTesting static ImmutableList<AclEntry> getEntriesFromAclFeature(AclFeature aclFeature) { if (aclFeature == null) { return ImmutableList.<AclEntry> of(); } ImmutableList.Builder<AclEntry> b = new ImmutableList.Builder<AclEntry>(); for (int pos = 0, entry; pos < aclFeature.getEntriesSize(); pos++) { entry = aclFeature.getEntryAt(pos); b.add(AclEntryStatusFormat.toAclEntry(entry)); } return b.build(); }
private boolean hasPermission(INodeAttributes inode, FsAction access) { if (inode == null) { return true; } final FsPermission mode = inode.getFsPermission(); final AclFeature aclFeature = inode.getAclFeature(); if (aclFeature != null) { // It's possible that the inode has a default ACL but no access ACL. int firstEntry = aclFeature.getEntryAt(0); if (AclEntryStatusFormat.getScope(firstEntry) == AclEntryScope.ACCESS) { return hasAclPermission(inode, access, mode, aclFeature); } } final FsAction checkAction; if (getUser().equals(inode.getUserName())) { //user class checkAction = mode.getUserAction(); } else if (getGroups().contains(inode.getGroupName())) { //group class checkAction = mode.getGroupAction(); } else { //other class checkAction = mode.getOtherAction(); } return checkAction.implies(access); }
private boolean hasPermission(INodeAttributes inode, FsAction access) { if (inode == null) { return true; } final FsPermission mode = inode.getFsPermission(); final AclFeature aclFeature = inode.getAclFeature(); if (aclFeature != null) { // It's possible that the inode has a default ACL but no access ACL. int firstEntry = aclFeature.getEntryAt(0); if (AclEntryStatusFormat.getScope(firstEntry) == AclEntryScope.ACCESS) { return hasAclPermission(inode, access, mode, aclFeature); } } final FsAction checkAction; if (getUser().equals(inode.getUserName())) { //user class checkAction = mode.getUserAction(); } else if (isMemberOfGroup(inode.getGroupName())) { //group class checkAction = mode.getGroupAction(); } else { //other class checkAction = mode.getOtherAction(); } return checkAction.implies(access); }
private static AclFeatureProto.Builder buildAclEntries(AclFeature f, final SaverContext.DeduplicationMap<String> map) { AclFeatureProto.Builder b = AclFeatureProto.newBuilder(); for (int pos = 0, e; pos < f.getEntriesSize(); pos++) { e = f.getEntryAt(pos); int nameId = map.getId(AclEntryStatusFormat.getName(e)); int v = ((nameId & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET) | (AclEntryStatusFormat.getType(e).ordinal() << ACL_ENTRY_TYPE_OFFSET) | (AclEntryStatusFormat.getScope(e).ordinal() << ACL_ENTRY_SCOPE_OFFSET) | (AclEntryStatusFormat.getPermission(e).ordinal()); b.addEntries(v); } return b; }
private static AclFeatureProto.Builder buildAclEntries(AclFeature f, final SaverContext.DeduplicationMap<String> map) { AclFeatureProto.Builder b = AclFeatureProto.newBuilder(); for (int pos = 0, e; pos < f.getEntriesSize(); pos++) { e = f.getEntryAt(pos); int nameId = map.getId(AclEntryStatusFormat.getName(e)); int v = ((nameId & ACL_ENTRY_NAME_MASK) << ACL_ENTRY_NAME_OFFSET) | (AclEntryStatusFormat.getType(e).ordinal() << ACL_ENTRY_TYPE_OFFSET) | (AclEntryStatusFormat.getScope(e).ordinal() << ACL_ENTRY_SCOPE_OFFSET) | (AclEntryStatusFormat.getPermission(e).ordinal()); b.addEntries(v); } return b; }
entry = aclFeature.getEntryAt(pos); if (AclEntryStatusFormat.getScope(entry) == AclEntryScope.DEFAULT) { break;
entry = aclFeature.getEntryAt(pos); if (AclEntryStatusFormat.getScope(entry) == AclEntryScope.DEFAULT) { break;