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

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

Link to this function administered_by?(project, user) View Source
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

Link to this function contributed_by?(project, user) View Source
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

Retrieves conversation from associated record

Link to this function get_membership(project, user) View Source

Returns CodeCorps.ProjectUser for specified CodeCorps.Project and CodeCorps.User, or nil

Retrieves message from associated record

Link to this function get_organization(arg1) View Source
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

Link to this function get_project(arg1) View Source
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

Retrieves the role field from a CodeCorps.ProjectUser struct or an Ecto.Changeset

Retrieves task from associated record

Link to this function owned_by?(project, user) View Source
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

Link to this function task_authored_by?(task, user) View Source
task_authored_by?(CodeCorps.Task.t(), CodeCorps.User.t()) :: boolean()

Determines if the provided task was authored by the provided user