SaltDns.Credentials.GrantList (Salt v1.0.0)

Ecto type for a credential's grants, stored as a jsonb list.

JSON form of a grant (SaltDns.Auth.Grants): :any for the zone or the types is "*", actions are strings ("read", "update", "manage").

%{"zone" => "*" | "example.com", "names" => ["www"],
  "types" => "*" | ["TXT"], "actions" => ["update"]}

Every grant that enters or leaves through this type is checked by SaltDns.Auth.Grants.validate/1. Casting an invalid list is an error. Loading an invalid stored list (a hand-edited or corrupt row) yields the atom :invalid instead of grants: the credential stays listable but SaltDns.Credentials and SaltDns.Access treat it as unusable, so a bad row fails closed.

Summary

Functions

Decodes the JSON form, validating every grant.

Callback implementation for Ecto.Type.embed_as/1.

Encodes validated grants to their JSON form.

Callback implementation for Ecto.Type.equal?/2.

Functions

decode(list)

@spec decode(term()) :: {:ok, [SaltDns.Auth.Grants.grant()]} | {:error, term()}

Decodes the JSON form, validating every grant.

embed_as(_)

Callback implementation for Ecto.Type.embed_as/1.

encode(grants)

@spec encode([SaltDns.Auth.Grants.grant()]) :: [map()]

Encodes validated grants to their JSON form.

equal?(term1, term2)

Callback implementation for Ecto.Type.equal?/2.