CPub.Web.Authorization.Scope (CPub v0.3.0) View Source

Defines the valid scopes of authorization to CPub.

Valid scopes are:

  • :read
  • :write
  • :follow

See the Mastodon OAuth scopes for inspiration on more finer-grained scopes that might be implemented in the future.

Link to this section Summary

Functions

Parse and validate a string into a list of valid scopes.

Returns true if scope1 is a subset of scope2

Returns true is scope or list of scopes is valid.

Link to this section Functions

Specs

default() :: [atom()]

Specs

parse(any()) :: {:ok, [atom()]} | {:error, any()}

Parse and validate a string into a list of valid scopes.

Link to this function

scope_subset?(scope1, scope2)

View Source

Specs

scope_subset?([atom()], [atom()]) :: bool()

Returns true if scope1 is a subset of scope2

Specs

valid?([atom()] | atom()) :: bool()

Returns true is scope or list of scopes is valid.