AbsinthePermission.PolicyChecker (AbsinthePermission v0.1.0)

This module provides pre and post operation policy checks functionality.

Link to this section Summary

Functions

Check given permission is in permission list. If given permission is nil or empty string it'll evaluate as true.

Filters given data based on filters specified for a policy.

Checks given policies against input arguments and absinthe context. If there is match to any policies, it'll return highest ranked policy's permission. If there is no match to any policy, then there's no need to any permission. So it'll return permission granted.

Link to this section Types

Specs

args() :: Keyword.t()

Specs

clause() :: Keyword.t()

Specs

condition() :: Keyword.t()
Link to this type

permission()

Specs

permission() :: atom() | binary()
Link to this type

remote_context()

Specs

remote_context() :: Keyword.t()

Link to this section Functions

Link to this function

has_permission?(required_perm, user_perms)

Specs

has_permission?(atom() | binary(), [atom()] | [binary()]) :: boolean()

Check given permission is in permission list. If given permission is nil or empty string it'll evaluate as true.

Link to this function

reject(val, fun)

Specs

reject(list(), function()) :: list()
reject(map(), function()) :: map()
Link to this function

reject(val, filters, args, context)

Specs

reject(list() | map(), [atom() | binary()], args(), map()) :: map()

Filters given data based on filters specified for a policy.

Link to this function

should_we_allow?(args, conds, context)

Specs

should_we_allow?(args(), [condition()], map()) :: boolean()

Checks given policies against input arguments and absinthe context. If there is match to any policies, it'll return highest ranked policy's permission. If there is no match to any policy, then there's no need to any permission. So it'll return permission granted.