Sovite.Core.Repo.Tables.AccessRules (sovite v0.2.0)

Copy Markdown View Source

Access rules for the restriction chains, stored in Sovite's database and managed with sovitectl access.

As a Sovite.Core.Lookup table, the handle names the kind of rule: :client, :helo, :sender, or :recipient. A lookup returns the action and its text, as an access(5) table would.

Summary

Functions

Deletes the rule for kind and pattern.

Lists all rules, by kind and pattern.

Sets the rule for kind and pattern, replacing any earlier one.

Functions

delete(repo, kind, pattern)

@spec delete(Sovite.Core.Repo.t(), atom(), String.t()) :: :ok | {:error, :not_found}

Deletes the rule for kind and pattern.

list(repo)

Lists all rules, by kind and pattern.

set(repo, kind, pattern, action, text \\ nil)

@spec set(
  Sovite.Core.Repo.t(),
  atom() | String.t(),
  String.t(),
  String.t(),
  String.t() | nil
) ::
  {:ok, Sovite.Core.Repo.Schemas.AccessRule.t()} | {:error, Ecto.Changeset.t()}

Sets the rule for kind and pattern, replacing any earlier one.