From: Paul Hänsch Date: Wed, 11 May 2022 16:19:44 +0000 (+0200) Subject: use acls in edit processing X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=cbbfaa80cfd8f582357f9228df6ac6f712734ae8;p=shellwiki use acls in edit processing --- diff --git a/page_edit.sh b/page_edit.sh index b5beeaf..ca70c67 100755 --- a/page_edit.sh +++ b/page_edit.sh @@ -26,9 +26,8 @@ if [ "$edit_page" = "$PATH_INFO" ]; then # END EDIT SCRIPT, continue in index.cgi elif [ "$edit_action" = update ]; then - mkdir -p -- "${edit_file%/#page.md}" - - if S_LOCK "$edit_file"; then + if mkdir -p -- "${edit_file%/#page.md}" \ + && S_LOCK "$edit_file"; then POST pagetext >"$edit_file" S_RELEASE "$edit_file" REDIRECT "${_BASE}${PATH_INFO%\[edit\]}" @@ -41,13 +40,16 @@ elif [ "$edit_action" = cancel ]; then S_RELEASE "$edit_file" REDIRECT "${_BASE}${PATH_INFO%\[edit\]}" -elif mkdir -p -- "${edit_file%/#page.md}" && S_LOCK "$edit_file"; then - # Display editor page - SESSION_COOKIE +elif ! acl_write "$edit_page"; then + theme_403 + +elif mkdir -p -- "${edit_file%/#page.md}" \ + && S_LOCK "$edit_file"; then theme_editor "$edit_page" else - export ERRMSG="ERR_NOLOCK" - theme_page "$edit_page" + printf 'Refresh: %i; url=%s\r\n' 4 ../ + export ERROR_MSG="Unable to lock page for editing" + theme_409 fi