X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=auth%2Fdefault.sh;h=02778db798c126186d02417f619fcc981d9593bd;hb=fdfe0310c6bc644da671b847120e0bd84d923634;hp=816ad70acc1f1872a530301031c7bf218607680d;hpb=0daec72fa8a85edebc46c665475f819091f3dac9;p=shellwiki diff --git a/auth/default.sh b/auth/default.sh index 816ad70..02778db 100644 --- a/auth/default.sh +++ b/auth/default.sh @@ -1,3 +1,18 @@ #!/bin/sh . "$_EXEC/cgilite/users.sh" + +GROUP_BASE="${GROUP_BASE:-/[wiki]/}" + +rgx_uname="$(printf '%s' "$USER_NAME" |sed 's;[.*+?^${}()|[\]\\];\\&;g')" + +USER_GROUPS="$( + grep -lE '^[\t ]*[-+*][\t ]+'"${rgx_uname}${CR}"'?$' "$_DATA/pages${GROUP_BASE%/}/&"*"/#page.md" \ + | while read group; do + group="${group#"$_DATA/pages${GROUP_BASE%/}/"}" + group="${group%"/#page.md"}" + printf '%s\n' "$group" + done +)" 2>&- + +export USER_GROUPS