diff options
| author | ckonstanski <ckonstanski@pippiandcarlos.com> | 2018-01-20 22:07:54 -0700 |
|---|---|---|
| committer | ckonstanski <ckonstanski@pippiandcarlos.com> | 2018-01-20 22:07:54 -0700 |
| commit | c2f77f4296c6b13eeb86067a772192b70577bca6 (patch) | |
| tree | 8437af60a559b7ed206fe4b256b4ea583292b9f1 /service/inetorg-add.lisp | |
initial commit
Diffstat (limited to 'service/inetorg-add.lisp')
| -rw-r--r-- | service/inetorg-add.lisp | 54 |
1 files changed, 54 insertions, 0 deletions
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."))))) |
