basic set-up of lib/auth system; + minor corrections

This commit is contained in:
Helmut Merz 2024-08-10 09:16:16 +02:00
parent 919119d649
commit d09abff170
7 changed files with 61 additions and 5 deletions

9
lib/auth/auth.lisp Normal file
View file

@ -0,0 +1,9 @@
;;;; cl-scopes/lib/auth - authentication services
(defpackage :scopes-auth
(:use :common-lisp)
(:local-nicknames (:dom :scopes/web/dom))
(:import-from :scopes/web/dom #:div #:label)
(:export #:login))
(in-package :scopes-auth)

23
lib/auth/scopes-auth.asd Normal file
View file

@ -0,0 +1,23 @@
(in-package #:asdf-user)
(defsystem :scopes-auth
:author "cyberconcepts.org Team <team@cyberconcepts.org>"
:license "MIT"
:version "0.0.1"
:homepage "https://www.cyberconcepts.org"
:description "Authentication services"
:depends-on (:scopes)
:components ((:file "auth"))
:long-description "scopes framework: authentication services."
;;#.(uiop:read-file-string
;; (uiop:subpathname *load-pathname* "README.md")))
:in-order-to ((test-op
(test-op "scopes-auth/test"))))
(defsystem :scopes-auth/test
:depends-on (:scopes-auth)
:components ((:file "test/test-auth"))
:perform (test-op (o c)
(symbol-call :scopes-auth/test :run)))

View file

@ -0,0 +1,21 @@
;;;; cl-scopes/lib/auth/test - tests for the scopes-auth system
(defpackage :scopes-auth/test
(:use :common-lisp)
(:local-nicknames (:auth :scopes-auth)
(:t :scopes/testing))
(:import-from :scopes/testing #:deftest #:==)
(:export #:run))
(in-package :scopes-auth/test)
;;;; test runner
(defun run ()
(let ((t:*test-suite* (t:test-suite "auth")))
(unwind-protect
(progn
(test-login))
(t:show-result))))
(deftest test-login ())

View file

@ -5,7 +5,7 @@
:license "MIT" :license "MIT"
:version "0.0.1" :version "0.0.1"
:homepage "https://www.cyberconcepts.org" :homepage "https://www.cyberconcepts.org"
:description "Generic data processing." :description "Generic data processing"
:depends-on (:scopes-core :scopes-web :depends-on (:scopes-core :scopes-web
:dbi :sxql) :dbi :sxql)
:components ((:file "storage/folder" :depends-on ("storage/tracking")) :components ((:file "storage/folder" :depends-on ("storage/tracking"))

View file

@ -38,7 +38,7 @@
(query f `((:parentid ,(id f))))) (query f `((:parentid ,(id f)))))
(defun parent (f) (defun parent (f)
(let ((pid (parse-integer (util:keyword-to-string (shape:head-value f :parentid))))) (let ((pid (util:to-integer (shape:head-value f :parentid))))
(tracking:query-one (tracking:container f) (tracking:query-one (tracking:container f)
(tracking:make-where `((:trackid ,pid)))))) (tracking:make-where `((:trackid ,pid))))))

View file

@ -1,5 +1,5 @@
;;; cl-scopes/test/config-sqlite.lisp ;;;; cl-scopes/test/config-sqlite.lisp
;;; use: `(load "test/...")` from package scopes/test-storage ;;;; use: `(load "test/...")` from package scopes/test-storage
(in-package :scopes/test-storage) (in-package :scopes/test-storage)

View file

@ -4,7 +4,7 @@
(:use :common-lisp) (:use :common-lisp)
(:export #:lg #:lgd #:lgi (:export #:lg #:lgd #:lgi
#:rfill #:rtrim #:loop-plist #:filter-plist #:plist-pairs #:plist-equal #:rfill #:rtrim #:loop-plist #:filter-plist #:plist-pairs #:plist-equal
#:flatten-str #:to-keyword #:keyword-to-string #:to-string #:flatten-str #:to-keyword #:keyword-to-string #:to-integer #:to-string
#:absolute-dir #:check-dir #:ensure-dir #:home-path #:path-from-string #:absolute-dir #:check-dir #:ensure-dir #:home-path #:path-from-string
#:relative-path #:runtime-path #:system-path)) #:relative-path #:runtime-path #:system-path))
@ -58,6 +58,9 @@
(format nil pattern k) (format nil pattern k)
(str:join sep (mapcar #'(lambda (s) (format nil pattern s)) k))))) (str:join sep (mapcar #'(lambda (s) (format nil pattern s)) k)))))
(defun to-integer (k)
(parse-integer (string k)))
(defun to-keyword (s) (defun to-keyword (s)
(if (string= s "") (if (string= s "")
nil nil