__acl: optimize gencode-remote

This commit is contained in:
ander 2019-04-16 19:24:38 +03:00
parent c1a34caba7
commit a1634b3ec0

View file

@ -28,57 +28,42 @@ acl_is="$( cat "$__object/explorer/acl_is" )"
acl_path="/$__object_id" acl_path="/$__object_id"
acl_should="$( acl_should="$( for parameter in user group mask other
for parameter in user group
do do
if [ ! -f "$__object/parameter/$parameter" ] if [ ! -f "$__object/parameter/$parameter" ]
then continue then
continue
fi fi
while read -r l
while read -r acl
do do
if echo "$l" | grep -Fq 'X' if echo "$acl" | grep -Fq 'X'
then then
if [ "$is_dir" = '1' ] if [ "$is_dir" = '1' ]
then then
l="$( echo "$l" | sed 's/X$/x/' )" acl="$( echo "$acl" | sed 's/X$/x/' )"
else else
l="$( echo "$l" | sed 's/X$/-/' )" acl="$( echo "$acl" | sed 's/X$/-/' )"
fi fi
fi fi
echo "$parameter:$l" if echo "$parameter" | grep -Eq '(mask|other)'
then
sep=::
else
sep=:
fi
echo "$parameter$sep$acl"
if [ -f "$__object/parameter/default" ] \ if [ -f "$__object/parameter/default" ] \
&& [ "$is_dir" = '1' ] && [ "$is_dir" = '1' ]
then echo "default:$parameter:$l" then
echo "default:$parameter$sep$acl"
fi fi
done < "$__object/parameter/$parameter" done \
done < "$__object/parameter/$parameter"
done )"
if [ -f "$__object/parameter/mask" ]
then
l=$( cat "$__object/parameter/mask" )
echo "mask::$l"
if [ -f "$__object/parameter/default" ] \
&& [ "$is_dir" = '1' ]
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' setfacl_exec='setfacl'