Skip to content

Instantly share code, notes, and snippets.

@skuro
Created September 4, 2011 22:18
Show Gist options
  • Save skuro/1193620 to your computer and use it in GitHub Desktop.
Save skuro/1193620 to your computer and use it in GitHub Desktop.
Alfresco repository tree-seq in Clojure
(ns alfresco.sample
(:require [alfresco.nodes :as n]
[alfresco.model :as m]
[alfresco.auth :as a]))
;; Creates a tree-seq to navigate a repository sub branch
(defn ts
[root]
(a/as-admin ;; in a normal context, you should already be authenticated
(let [user (a/whoami) ;; store the currently authenticated user, needed by the following closures
branch? (fn [x] (a/run-as user
(m/qname-isa? (n/type-qname x) (m/qname "cm:folder"))))
children (fn [x] (a/run-as user
(n/children x)))]
(tree-seq branch? children root))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment