PhoenixKitProjects.Schemas.ProjectSubjectGrant (PhoenixKitProjects v0.21.1)

Copy Markdown View Source

A project role held by a GROUP rather than a person: a staff team, a staff department, or a site role.

Direct people stay in PhoenixKitProjects.Schemas.ProjectMember — that table keeps its real foreign key to phoenix_kit_users, the last-owner guard, and ownership succession. This one answers the other half: "the Design team can work here", "contractors may look".

subject_uuid carries no foreign key on purpose. It points into three different tables, two of which (staff teams and departments) live in a sibling package that may not be installed at all. Integrity is the context's job: PhoenixKitProjects.Grants resolves a subject before writing, and skips grants whose subject has since vanished when reading.

owner is not an assignable role here — ownership needs an accountable person, and a team-owned project would break the last-owner guard the moment the team emptied. The database rejects it too.

Summary

Functions

Assignable roles — never owner.

Assignable subject types.

Types

t()

@type t() :: %PhoenixKitProjects.Schemas.ProjectSubjectGrant{
  __meta__: term(),
  granted_by_uuid: term(),
  inserted_at: term(),
  project: term(),
  project_uuid: term(),
  role: term(),
  subject_type: term(),
  subject_uuid: term(),
  updated_at: term(),
  uuid: term()
}

Functions

changeset(grant, attrs)

roles()

@spec roles() :: [String.t()]

Assignable roles — never owner.

subject_types()

@spec subject_types() :: [String.t()]

Assignable subject types.