X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=auth%2Fdefault.sh;h=02778db798c126186d02417f619fcc981d9593bd;hb=c69b352f7a56f4893d30b1c0f99dd061c1363430;hp=816ad70acc1f1872a530301031c7bf218607680d;hpb=de7354de554623c0bd7864d4680a6058cbcd1201;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