Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/clj/collect_earth_online/db/projects.clj
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,15 @@

(defn get-project-by-id [{:keys [params session]}]
(let [user-id (:userId session -1)
project-id (tc/val->int (:projectId params))]
(data-response (build-project-by-id user-id project-id))))
project-id (tc/val->int (:projectId params))
project (build-project-by-id user-id project-id)]
(if (or (:isProjectAdmin project)
(and (= (:availability project) "published")
(or (= (:privacyLevel project) "public")
(and (pos? user-id) (= (:privacyLevel project) "users"))
(and (:userRole project) (= (:privacyLevel project) "institution")))))
(data-response project)
(data-response "" {:status 403}))))

(defn get-template-by-id [{:keys [params]}]
(let [project-id (tc/val->int (:projectId params))
Expand Down