From c2f77f4296c6b13eeb86067a772192b70577bca6 Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Sat, 20 Jan 2018 22:07:54 -0700 Subject: initial commit --- service/auth-service.lisp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 service/auth-service.lisp (limited to 'service/auth-service.lisp') diff --git a/service/auth-service.lisp b/service/auth-service.lisp new file mode 100644 index 0000000..0d0e8a0 --- /dev/null +++ b/service/auth-service.lisp @@ -0,0 +1,21 @@ +;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +(declaim (optimize (speed 0) (safety 3) (debug 3))) + +(in-package #:ldapadmin) + +;; ========================================================================== ;; + +(defclass auth-service (rest-service) + () + (:documentation "")) + +(defmethod initialize-instance :after ((auth-service auth-service) &key) + (when (not (string= (session-value :permissions) "admin")) + (setf (location auth-service) "home") + (setf (errormsg auth-service) "You are not authorized to access this resource."))) + +(defmacro with-auth ((instance form-class) &body body) + `(let ((,instance (make-instance ',form-class))) + (when (null (errormsg ,instance)) + ,@body) + (objects-to-json `(,,instance)))) -- cgit v1.3