__acl: add "other" ACL entry support and some comments, remove getfacl's inline comments

This commit is contained in:
ander 2019-04-16 19:06:48 +03:00
parent e04d647d8e
commit c1a34caba7
4 changed files with 28 additions and 5 deletions

View file

@ -26,6 +26,7 @@ then
exit 1
fi
getfacl "/$__object_id" 2>/dev/null \
| grep -E '^((default:)?(user|group):[^:]|(default:)?mask::)' \
getfacl -E "/$__object_id" 2>/dev/null \
| grep -E '^(default:)?(user|group|(mask|other):):[^:]' \
| sed -r 's/#.+$//' \
|| true

View file

@ -28,7 +28,8 @@ acl_is="$( cat "$__object/explorer/acl_is" )"
acl_path="/$__object_id"
acl_should="$( for parameter in user group
acl_should="$(
for parameter in user group
do
if [ ! -f "$__object/parameter/$parameter" ]
then continue
@ -53,6 +54,7 @@ do
fi
done < "$__object/parameter/$parameter"
done
if [ -f "$__object/parameter/mask" ]
then
l=$( cat "$__object/parameter/mask" )
@ -64,6 +66,18 @@ then
then echo "default:mask::$l"
fi
fi
if [ -f "$__object/parameter/other" ]
then
l=$( cat "$__object/parameter/other" )
echo "other::$l"
if [ -f "$__object/parameter/default" ] \
&& [ "$is_dir" = '1' ]
then echo "default:other::$l"
fi
fi
)"
setfacl_exec='setfacl'
@ -89,8 +103,11 @@ then
else
echo "$acl_is" | while read -r acl
do
# Skip wanted ACL entries which already exist
# and skip mask and other entries, because we
# can't actually remove them, but only change.
if echo "$acl_should" | grep -Eq "^$acl" \
|| echo "$acl" | grep -Eq '^(default:)?mask'
|| echo "$acl" | grep -Eq '^(default:)?(mask|other)'
then continue
fi

View file

@ -18,6 +18,9 @@ OPTIONAL PARAMETERS
mask
Add mask ACL entry.
other
Add other ACL entry.
OPTIONAL MULTIPLE PARAMETERS
----------------------------
@ -53,7 +56,8 @@ EXAMPLES
--user bob:r-x \
--group project-group:rwx \
--group some-other-group:r-x \
--mask r-x
--mask r-x \
--other r-x
AUTHORS

View file

@ -1 +1,2 @@
mask
other