Commit 01ced033 authored by Ivar Refsdal's avatar Ivar Refsdal

Initial commit

parents
/target
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port
.hgignore
.hg/
.idea/
*.iml
\ No newline at end of file
(defproject nsu-experiment "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/core.match "0.3.0-alpha4"]
])
(ns nsu-experiment.core)
(require '[clojure.core.match :refer [match]])
(def valid-request-1
{:nsd-employee false
:project-title true
:approved-ssb-instituion true
:primaryAffiliation :researcher
:access-type :online
:dataset-license :CC
:purpose :research
:supervisor-declaration false
})
(def valid-request-2
{:nsd-employee false
:project-title true
:approved-ssb-instituion true
:primaryAffiliation :student
:access-type :online
:dataset-license :CC
:purpose :research
:supervisor-declaration true
})
(def valid-request-3
{:nsd-employee true
:project-title true
:approved-ssb-instituion true
:primaryAffiliation :staff
:access-type :offline
:dataset-license :CC
:purpose :education
:supervisor-declaration false
})
(defn access
[request]
(match [request]
;; regel A
[{:nsd-employee _
:project-title true
:approved-ssb-instituion true
:primaryAffiliation (:or :staff :researcher :employee)
:access-type :online
:dataset-license _
:purpose _
:supervisor-declaration _
}] {:result true :rule :A}
;; regel B
[{:nsd-employee _
:project-title true
:approved-ssb-instituion true
:primaryAffiliation :student
:access-type _
:dataset-license :CC
:purpose :research
:supervisor-declaration true
}] {:result true :rule :B}
;; regel C
[{:nsd-employee _
:project-title true
:approved-ssb-instituion false
:primaryAffiliation (:or :staff :researcher :employee)
:access-type :online
:dataset-license :CC
:purpose :utredning ;; TODO
:supervisor-declaration true
}] {:result :egen-søknad :rule :C}
;; regel D
[{:nsd-employee true
:project-title _
:approved-ssb-instituion _
:primaryAffiliation _
:access-type _
:dataset-license _
:purpose _
:supervisor-declaration _
}] {:result true :rule :D}
))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment