mirror of
https://github.com/logseq/logseq.git
synced 2026-04-27 23:54:55 +00:00
fix: only manager can delete remote graph
Fixes LOG-3118
This commit is contained in:
@@ -13,7 +13,9 @@
|
||||
[frontend.state :as state]
|
||||
[goog.crypt :as crypt]
|
||||
[goog.crypt.Hmac]
|
||||
[goog.crypt.Sha256]))
|
||||
[goog.crypt.Sha256]
|
||||
[logseq.db :as ldb]
|
||||
[frontend.db :as db]))
|
||||
|
||||
(defn set-preferred-format!
|
||||
[format]
|
||||
@@ -276,6 +278,20 @@
|
||||
[]
|
||||
(or (alpha-user?) (beta-user?)))
|
||||
|
||||
(defn get-user-type
|
||||
[repo]
|
||||
(when-let [uuid (ldb/get-graph-rtc-uuid (db/get-db repo))]
|
||||
(-> (some #(when (= uuid (:GraphUUID %)) %) (:rtc/graphs @state/state))
|
||||
:graph<->user-user-type)))
|
||||
|
||||
(defn manager?
|
||||
[repo]
|
||||
(= (get-user-type repo) "manager"))
|
||||
|
||||
(defn member?
|
||||
[repo]
|
||||
(= (get-user-type repo) "member"))
|
||||
|
||||
(comment
|
||||
;; We probably need this for some new features later
|
||||
(defonce feature-matrix {:file-sync :beta})
|
||||
|
||||
Reference in New Issue
Block a user