From c2f77f4296c6b13eeb86067a772192b70577bca6 Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Sat, 20 Jan 2018 22:07:54 -0700 Subject: initial commit --- service/inetorg-add.lisp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 service/inetorg-add.lisp (limited to 'service/inetorg-add.lisp') diff --git a/service/inetorg-add.lisp b/service/inetorg-add.lisp new file mode 100644 index 0000000..a55f72d --- /dev/null +++ b/service/inetorg-add.lisp @@ -0,0 +1,54 @@ +;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +(declaim (optimize (speed 0) (safety 3) (debug 3))) + +(in-package #:ldapadmin) + +;; ========================================================================== ;; +;; inetorg-add + +(defclass inetorg-add (auth-service generic-form) + ((instructions :initarg :instructions + :initform nil + :accessor instructions)) + (:documentation "")) + +(define-generic-form-constructor (inetorg-add "inetorg-add-form" "/inetorg/add/submit") + '((:name "add-givenname" :label "givenName" :field-type "text") + (:name "add-sn" :label "sn" :field-type "text") + (:name "add-mail" :label "mail" :field-type "text") + (:name "add-postaladdress" :label "postalAddress" :field-type "text") + (:name "add-postalcode" :label "postalCode" :field-type "text") + (:name "add-st" :label "st" :field-type "text") + (:name "add-l" :label "l" :field-type "text") + (:name "add-telephonenumber" :label "telephoneNumber" :field-type "text") + (:name "add-mobile" :label "mobile" :field-type "text") + (:name "add-submit" :label "Create InetOrg Entry" :field-type "button"))) + +(defun inetorg-add-json () + (with-auth (instance inetorg-add) + (setf (instructions instance) "Use the form to add a new InetOrg entry."))) + +;; ========================================================================== ;; +;; inetorg-add-submit + +(defclass inetorg-add-submit (auth-service) + ((location-p :initarg :location-p + :initform nil + :accessor location-p)) + (:documentation "")) + +(defun inetorg-add-submit-json (givenname sn mail postaladdress postalcode st l telephonenumber mobile) + (with-auth (instance inetorg-add-submit) + (with-ldap (ldap) + (let ((ldap-user (make-instance 'ldap-user + :givenname givenname + :sn sn + :mail mail + :postaladdress postaladdress + :postalcode postalcode + :st st + :l l + :telephonenumber telephonenumber + :mobile mobile))) + (add-ldap-user ldap-user ldap) + (setf (message instance) "InetOrg entry created successfully."))))) -- cgit v1.3