ordo/modules/ordo/facts.scm

19 lines
708 B
Scheme

(define-module (ordo facts)
#:use-module ((srfi srfi-88) #:select (string->keyword))
#:use-module (ordo context)
#:use-module (ordo facts user)
#:export (gather-facts))
(define (set-facts! src keys)
(for-each (lambda (k)
(set-play-var! (string->keyword (string-append "fact." k))
(assoc-ref src (string->keyword k))))
keys))
(define (gather-facts)
(let* ((conn (current-connection))
(id (fact:id conn))
(user-name (assoc-ref id #:user-name))
(pwent (fact:pwent conn user-name)))
(set-facts! id '("user-name" "user-id" "group-name" "group-id" "groups"))
(set-facts! pwent '("gecos" "home-dir" "shell"))))