summaryrefslogtreecommitdiff
path: root/service/inetorg-view-service.lisp
diff options
context:
space:
mode:
authorckonstanski <ckonstanski@pippiandcarlos.com>2020-12-21 08:59:56 -0700
committerckonstanski <ckonstanski@pippiandcarlos.com>2020-12-21 08:59:56 -0700
commit0ed1cba1b39daaf8eef693233f081b455c88dece (patch)
tree0322ba1444ef724d4613e3c26ed2679e71bf1882 /service/inetorg-view-service.lisp
parentbac1df6134eee78b79810d13c71a2b22b4739a12 (diff)
stuff
Diffstat (limited to 'service/inetorg-view-service.lisp')
-rw-r--r--service/inetorg-view-service.lisp72
1 files changed, 72 insertions, 0 deletions
diff --git a/service/inetorg-view-service.lisp b/service/inetorg-view-service.lisp
new file mode 100644
index 0000000..5cbd0c6
--- /dev/null
+++ b/service/inetorg-view-service.lisp
@@ -0,0 +1,72 @@
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+(declaim (optimize (speed 0) (safety 3) (debug 3)))
+
+(in-package #:ldapadmin)
+
+(defclass inetorg-view (auth-service)
+ ((title :initarg :title
+ :initform nil
+ :accessor title))
+ (:documentation ""))
+
+(defun inetorg-view-json ()
+ (with-auth (instance inetorg-view)
+ (setf (title instance) "Use the form to filter the InetOrg results.")))
+
+(defclass inetorg-view-search-service (auth-service)
+ ((form :initarg :form
+ :initform nil
+ :accessor form)
+ (title :initarg :title
+ :initform nil
+ :accessor title)
+ (location-p :initarg :location-p
+ :initform nil
+ :accessor location-p))
+ (:documentation ""))
+
+(defmethod initialize-instance :after ((inetorg-view-search-service inetorg-view-search-service) &key)
+ (setf (form inetorg-view-search-service) (make-form "inetorg-view-search-form"
+ nil
+ t
+ '((:name "view-givenname" :label "givenName" :field-type "text")
+ (:name "view-sn" :label "sn" :field-type "text")
+ (:name "view-mail" :label "mail" :field-type "text")
+ (:name "view-postaladdress" :label "postalAddress" :field-type "text")
+ (:name "view-postalcode" :label "postalCode" :field-type "text")
+ (:name "view-st" :label "st" :field-type "text")
+ (:name "view-l" :label "l" :field-type "text")
+ (:name "view-telephonenumber" :label "telephoneNumber" :field-type "text")
+ (:name "view-mobile" :label "mobile" :field-type "text")
+ (:name "view-businesscategory" :label "businessCategory" :field-type "text")
+ (:label "Search InetOrg Entries" :field-type "button" :onclick "on_inetorg_view_search_clicked()")))))
+
+(defun inetorg-view-search-json ()
+ (with-auth (instance inetorg-view-search-service)
+ nil))
+
+(defclass inetorg-view-results (auth-service)
+ ((results :initarg :results
+ :initform nil
+ :accessor results)
+ (location-p :initarg :location-p
+ :initform nil
+ :accessor location-p))
+ (:documentation ""))
+
+(defun inetorg-view-results-json (givenname sn mail postaladdress postalcode st l telephonenumber mobile businesscategory)
+ (with-auth (instance inetorg-view-results-service)
+ (with-ldap (ldap)
+ (setf (results instance)
+ (sort (search-ldap-users ldap
+ `((:givenname ,givenname)
+ (:sn ,sn)
+ (:mail ,mail)
+ (:postaladdress ,postaladdress)
+ (:postalcode ,postalcode)
+ (:st ,st)
+ (:l ,l)
+ (:telephonenumber ,telephonenumber)
+ (:mobile ,mobile)
+ (:businesscategory ,businesscategory)))
+ (lambda (x y) (string< (get-cn x) (get-cn y))))))))