X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=manager%2Fbasic_login.lsp;h=8ca9920882219ae4895b247b59b63097403d375a;hb=3feeffd680a6d4abfb63b15a40e5246e4969ddf4;hp=7231ef0e0e7f7b3b62d4f5965a3655dafd7d5497;hpb=10d5ff6dcc2a35e5d690216edc16950e4fb022a9;p=rrq%2Fhourglass.git diff --git a/manager/basic_login.lsp b/manager/basic_login.lsp index 7231ef0..8ca9920 100644 --- a/manager/basic_login.lsp +++ b/manager/basic_login.lsp @@ -8,6 +8,8 @@ ;; name to determine th actual script. That lookup will also use the ;; "role base" as declared in "roles.txt" +(load "siteconfig.lsp") + (write-line 2 (string (date-value) " " (main-args))) (unless (ends-with (main-args 0) ".cgi") (if (exists file? (list (main-args 1) @@ -30,16 +32,14 @@ (write-line 1 (read-file "tmpl/unauthorized.http")) (exit 0)) -(define (role-script ROLE) +;; Determine actual script name respecting given role, if any. +(define (role-script (ROLE ".")) (let ((CMD (and (regex "([^/]*).cgi$" (main-args 0) 0) $1))) - (if (= "." ROLE) (string CMD ".lsp") - (format "%s/%s.lsp" ROLE CMD)))) + (if (= "." ROLE) (string CMD ".lsp") (format "%s/%s.lsp" ROLE CMD)))) (setf - ROLES (map (fn (x) (parse x ":")) (parse (read-file "roles.txt") "\n")) REMOTE_USER (and (regex "([^:]+):" (base64-dec (6 AUTH)) 0) $1) - ROLE (or (lookup REMOTE_USER ROLES) "child") - SCRIPT (role-script ROLE) + SCRIPT (role-script) ) (env "REMOTE_USER" REMOTE_USER) (env "ROLE" ROLE)