code_corps v0.0.1 CodeCorps.Policy.Helpers View Source
Holds helpers for extracting record relationships and determining roles for authorization policies.
Link to this section Summary
Functions
Determines if the provided project is being administered by the provided User
Determines if the provided project is being contributed to by the provided User
Retrieves conversation from associated record
Returns CodeCorps.ProjectUser for specified CodeCorps.Project
and CodeCorps.User, or nil
Retrieves message from associated record
Retrieves an organization record, from a model struct, or an Ecto.Changeset
containing an organization_id field
Retrieves a project record, from a model struct, or an Ecto.Changeset
containing a project_id field
Retrieves the role field from a CodeCorps.ProjectUser struct or an Ecto.Changeset
Retrieves task from associated record
Determines if the provided organization or project is owned by the provided user
Determines if the provided task was authored by the provided user
Link to this section Functions
administered_by?(nil | CodeCorps.Project.t(), CodeCorps.User.t()) :: boolean()
Determines if the provided project is being administered by the provided User
Returns true if the user is an admin or higher member of the project
contributed_by?(nil | CodeCorps.Project.t(), CodeCorps.User.t()) :: boolean()
Determines if the provided project is being contributed to by the provided User
Returns true if the user is a contributor or higher member of the project
get_conversation(Ecto.Changeset.t() | CodeCorps.ConversationPart.t() | map()) :: CodeCorps.Conversation.t()
Retrieves conversation from associated record
get_membership(CodeCorps.Project.t(), CodeCorps.User.t()) :: nil | CodeCorps.ProjectUser.t()
Returns CodeCorps.ProjectUser for specified CodeCorps.Project
and CodeCorps.User, or nil
get_message(Ecto.Changeset.t() | CodeCorps.Conversation.t() | map()) :: CodeCorps.Message.t()
Retrieves message from associated record
get_organization(struct() | Ecto.Changeset.t() | any()) :: CodeCorps.Organization.t()
Retrieves an organization record, from a model struct, or an Ecto.Changeset
containing an organization_id field
Returns CodeCorps.Organization
get_project(struct() | Ecto.Changeset.t() | any()) :: CodeCorps.Project.t()
Retrieves a project record, from a model struct, or an Ecto.Changeset
containing a project_id field
Returns CodeCorps.Project
get_role(nil | CodeCorps.ProjectUser.t() | Ecto.Changeset.t()) :: String.t() | nil
Retrieves the role field from a CodeCorps.ProjectUser struct or an Ecto.Changeset
get_task(Ecto.Changeset.t() | CodeCorps.TaskSkill.t() | CodeCorps.UserTask.t() | map()) :: CodeCorps.Task.t()
Retrieves task from associated record
owned_by?(nil | CodeCorps.Organization.t() | CodeCorps.Project.t(), CodeCorps.User.t()) :: boolean()
Determines if the provided organization or project is owned by the provided user
task_authored_by?(CodeCorps.Task.t(), CodeCorps.User.t()) :: boolean()
Determines if the provided task was authored by the provided user