terminator v0.1.4 Terminator.Role View Source
Role is grouped representation of multiple abilities. It allows you to assign or manage multiple roles at once.
Link to this section Summary
Functions
Builds ecto changeset for a role
Link to this section Types
A role struct
Link to this section Functions
Link to this function
build(identifier, abilities, name)
View Source
build(identifier, abilities, name)
View Source
build(identifier :: String.t(), abilities :: [String.t()], name :: String.t()) ::
Ecto.Changeset.t()
build(identifier :: String.t(), abilities :: [String.t()], name :: String.t()) :: Ecto.Changeset.t()
Builds ecto changeset for a role.
Examples
iex> changeset = Terminator.Role.build("admin", ["delete_account"], "Administrator of application")
#Ecto.Changeset<
action: nil,
changes: %{
abilities: ["delete_account"],
identifier: "admin",
name: "Administrator of application"
},
errors: [],
data: #Terminator.Role<>,
valid?: true
>
iex> changeset |> Repo.insert
{:ok,
%Terminator.Role{
__meta__: #Ecto.Schema.Metadata<:loaded, "terminator_roles">,
abilities: ["delete_account"],
id: 1,
identifier: "admin",
inserted_at: ~N[2019-01-03 19:50:13],
name: "Administrator of application",
updated_at: ~N[2019-01-03 19:50:13]
}}
Link to this function
changeset(struct, params \\ %{})
View Source
changeset(struct, params \\ %{})
View Source
changeset(struct :: Terminator.Role.t(), params :: map() | nil) ::
Ecto.Changeset.t()
changeset(struct :: Terminator.Role.t(), params :: map() | nil) :: Ecto.Changeset.t()