(library (sph storage dg permission access) (export perm-create perm-delete perm-execute perm-link perm-modify perm-not-create perm-not-delete perm-not-execute perm-not-link perm-not-modify perm-not-read perm-read sph-storage-dg-permission-access-description) (import (rnrs bytevectors) (rnrs eval) (sph) (sph hashtable) (sph storage dg) (sph storage dg permission) (only (guile) resolve-module symbol-append)) (define sph-storage-dg-permission-access-description "defines a set of usable default access permissions. experimental") (define perm-create) (define perm-delete) (define perm-read) (define perm-modify) (define perm-execute) (define perm-link) (define perm-not-create) (define perm-not-delete) (define perm-not-read) (define perm-not-modify) (define perm-not-execute) (define perm-not-link) (define (create+set-permission-elements . names) (dg-txn-call-write (l (txn) (apply (l (pe-ide opposite-pe-ide) (eval (pair (q begin) (apply append (map (l (name ide opposite) (ht-set! dg-p3-permissions ide opposite) (ht-set! dg-p3-permissions opposite ide) (list (list (q set!) (string->symbol (string-append "perm-" name)) ide) (list (q set!) (string->symbol (string-append "perm-not-" name)) opposite))) (reverse names) pe-ide opposite-pe-ide))) (resolve-module (q (sph storage dg two permission access))))) (create-permission-elements txn names))))) (define (create-permission-elements txn names) ( (l (pe-ide opposite-pe-ide) (dg-relation-ensure txn ide-alias-permission-element (append pe-ide opposite-pe-ide)) (list pe-ide opposite-pe-ide)) (dg-intern-ensure txn names) (dg-intern-ensure txn (map (l (ele) (string-append "not-" ele)) names)))) (dg-init-extension-add (create+set-permission-elements "create" "delete" "read" "modify" "execute" "link")))