__acl: add nice oneliners and move default ACL decision out of the loop
This commit is contained in:
parent
0f3c162696
commit
86f45db1b9
1 changed files with 10 additions and 17 deletions
|
@ -28,6 +28,13 @@ acl_is="$( cat "$__object/explorer/acl_is" )"
|
||||||
|
|
||||||
acl_path="/$__object_id"
|
acl_path="/$__object_id"
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/default" ] && [ "$is_dir" = '1' ]
|
||||||
|
then
|
||||||
|
set_default=1
|
||||||
|
else
|
||||||
|
set_default=0
|
||||||
|
fi
|
||||||
|
|
||||||
acl_should="$( for parameter in user group mask other
|
acl_should="$( for parameter in user group mask other
|
||||||
do
|
do
|
||||||
if [ ! -f "$__object/parameter/$parameter" ]
|
if [ ! -f "$__object/parameter/$parameter" ]
|
||||||
|
@ -39,30 +46,16 @@ do
|
||||||
do
|
do
|
||||||
if echo "$acl" | awk -F: '{ print $NF }' | grep -Fq 'X'
|
if echo "$acl" | awk -F: '{ print $NF }' | grep -Fq 'X'
|
||||||
then
|
then
|
||||||
if [ "$is_dir" = '1' ]
|
[ "$is_dir" = '1' ] && rep=x || rep=-
|
||||||
then
|
|
||||||
rep=x
|
|
||||||
else
|
|
||||||
rep=-
|
|
||||||
fi
|
|
||||||
|
|
||||||
acl="$( echo "$acl" | sed "s/\(.*\)X/\1$rep/" )"
|
acl="$( echo "$acl" | sed "s/\(.*\)X/\1$rep/" )"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "$parameter" | grep -Eq '(mask|other)'
|
echo "$parameter" | grep -Eq '(mask|other)' && sep=:: || sep=:
|
||||||
then
|
|
||||||
sep=::
|
|
||||||
else
|
|
||||||
sep=:
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "$parameter$sep$acl"
|
echo "$parameter$sep$acl"
|
||||||
|
|
||||||
if [ -f "$__object/parameter/default" ] \
|
[ "$set_default" = '1' ] && echo "default:$parameter$sep$acl"
|
||||||
&& [ "$is_dir" = '1' ]
|
|
||||||
then
|
|
||||||
echo "default:$parameter$sep$acl"
|
|
||||||
fi
|
|
||||||
done \
|
done \
|
||||||
< "$__object/parameter/$parameter"
|
< "$__object/parameter/$parameter"
|
||||||
done )"
|
done )"
|
||||||
|
|
Loading…
Reference in a new issue