Add improved abstraction for team permissions

Relevant changes:
- replace user-viewer? with can-edit removing many double
  negations on the code
- always use team permissions making the permissions access uniform
  around all the code
- expose team permissions to ui tree through ctx/team-permissions
  context
This commit is contained in:
Andrey Antukh 2024-10-18 16:23:24 +02:00 committed by Alonso Torres
parent b3fcbd91e4
commit d6da8afdce
29 changed files with 412 additions and 391 deletions

View file

@ -19,9 +19,11 @@
[rumext.v2 :as mf]))
(mf/defc libraries-page
[{:keys [team you-viewer?] :as props}]
{::mf/props :obj}
[{:keys [team] :as props}]
(let [files-map (mf/deref refs/dashboard-shared-files)
projects (mf/deref refs/dashboard-projects)
can-edit (-> team :permissions :can-edit)
default-project (->> projects vals (d/seek :is-default))
@ -56,6 +58,6 @@
:project default-project
:origin :libraries
:limit limit
:you-viewer? you-viewer?
:can-edit can-edit
:library-view? components-v2}]]]))