__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 exit 1
fi fi
getfacl "/$__object_id" 2>/dev/null \ getfacl -E "/$__object_id" 2>/dev/null \
| grep -E '^((default:)?(user|group):[^:]|(default:)?mask::)' \ | grep -E '^(default:)?(user|group|(mask|other):):[^:]' \
| sed -r 's/#.+$//' \
|| true || true

View file

@ -28,7 +28,8 @@ acl_is="$( cat "$__object/explorer/acl_is" )"
acl_path="/$__object_id" acl_path="/$__object_id"
acl_should="$( for parameter in user group acl_should="$(
for parameter in user group
do do
if [ ! -f "$__object/parameter/$parameter" ] if [ ! -f "$__object/parameter/$parameter" ]
then continue then continue
@ -53,6 +54,7 @@ do
fi fi
done < "$__object/parameter/$parameter" done < "$__object/parameter/$parameter"
done done
if [ -f "$__object/parameter/mask" ] if [ -f "$__object/parameter/mask" ]
then then
l=$( cat "$__object/parameter/mask" ) l=$( cat "$__object/parameter/mask" )
@ -64,6 +66,18 @@ then
then echo "default:mask::$l" then echo "default:mask::$l"
fi fi
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' setfacl_exec='setfacl'
@ -89,8 +103,11 @@ then
else else
echo "$acl_is" | while read -r acl echo "$acl_is" | while read -r acl
do 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" \ if echo "$acl_should" | grep -Eq "^$acl" \
|| echo "$acl" | grep -Eq '^(default:)?mask' || echo "$acl" | grep -Eq '^(default:)?(mask|other)'
then continue then continue
fi fi

View file

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

View file

@ -1 +1,2 @@
mask mask
other