forked from mbattyani/cl-slides
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.lisp
48 lines (38 loc) · 1.65 KB
/
user.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(in-package #:slides)
(defmethod interface::clipboard ((obj slides-user))
(clipboard obj))
(defmethod meta::short-description ((user slides-user))
(user-name user))
(defun get-user (obj)
(when *app*
(users *app*)))
(defmethod interface::groups ((user slides-user))
(let ((groups nil))
(when (or (developer user)(admin user))
(setf groups '(:admin :owner)))
(when (developer user) (push :dev groups))
groups))
(defmethod interface::dynamic-groups ((user slides-user) (object slides-user) user-groups)
(if (eq user object)
(list* :owner user-groups)
user-groups))
(defmethod interface::dynamic-groups ((user slides-user) (object presentation) user-groups)
(if (eq user (meta::parent object))
(list* :author user-groups)
user-groups))
(defmethod interface::dynamic-groups ((user slides-user) (object slide) user-groups)
(interface::dynamic-groups user (meta::parent object) user-groups))
(defun start-new-pres (user)
(let ((pres (make-instance 'presentation :parent user)))
(push pres (presentations user))
(interface::send-url-to-interface (interface::encode-object-url pres))))
(make-instance 'interface::object-view :object-class 'slides-user :special-view t
:country-languages '(:en :fr) :name "dashboard" :source-code
`(:br
(:h1 "My presentations")
(:slot-table presentations)
((:fn-link start-new-pres :class "btn btn-lg btn-success") "Make a new presentation") :br))
(make-instance 'interface::object-view :object-class 'slides-user :special-view t
:country-languages '(:en :fr) :name "usettings" :source-code
`((:h1 "My Settings")
(:slot-table user-name auto-login) :br))