PhoenixKitProjects. Web. Components. AccessPanel
(PhoenixKitProjects v0.21.1)
Copy Markdown
View Source
"Who can see this project, and what can they do" — the access controls, in one place, shared by the surfaces that set them.
Both the creation form and the members page ask exactly this question, and they used to be able to answer it differently: creation had the whole panel, and after creation there was no way to reach visibility or the work floors at all. Rendering them from one component is what keeps the two surfaces honest — the same wording, the same choices, the same conditional rows.
The floors offered are only the ones Authz actually lets a project
override. This is a "who can X" panel, not a permission-scheme editor:
the rules that never move (settings, membership, archiving and deletion
stay with owners) are stated in plain language rather than hidden,
because they are what most people are checking for when they come
looking for permissions at all.
Conditional rows
A project whose tasks are simple enough not to need comments shouldn't
be asked who may comment: the question is noise, and answering it
stores a floor for a capability that isn't there. visible_actions/3
filters against the same flags and extensions the rest of the module
toggles, so rows appear and disappear as those change.
Summary
Functions
The capability a floor depends on, or nil when it always applies.
The subset of actions whose capability is actually present.
Functions
Attributes
authz_choices(:map) (required)authz_actions(:list) (required)visibility(:string) (required)public_link?(:boolean) - Defaults tofalse.ownership_note(:boolean) - show the "you own what you create" line — true while creating, false after. Defaults totrue.
The capability a floor depends on, or nil when it always applies.
The subset of actions whose capability is actually present.
flag_states and ext_states are the maps the caller already keeps for
its own toggles. A flag defaults to ON when absent (flags are opt-out),
an extension defaults to OFF (extensions are opt-in) — matching how each
resolves everywhere else.