z_acl (zotonic_core v1.0.0-rc.10)
Link to this section Summary
Functions
Call a function as the anonymous user.
Return a term that can be used as the ACL part of cache key.
Check if the current user is an admin or a sudo action
Check if an admin is logged on and the read only flag is not set. Exception for sudo, where updates are always allowed.
Check if an action is allowed for the current actor.
Check if an action on a property of a resource is allowed for the current actor.
Check if the current access permissions are set to read-only. This is an authorization option for the current z.auth cookie or bearer token.
Check if the current context acl is set using a sudo.
Log off, reset the acl field of the context
Log the user with the id on, fill the acl field of the context
Log the user with the id on, fill acl and set all user preferences (like timezone and language)
Refresh the authentication of the current user
Check if the resource is deletable by the current user
Check if the resource is editable by the current user
Check if the resource is connected to another resource by the current user
Check if a property of the resource is visible for the current user
Check if the resource is visible for the current user
Set the current context to read only. Models can use this state to prevent updates to data.
Call a function with admin privileges.
Return the id of the current user.
Return the list of user groups the current context is member of.
Link to this section Types
Link to this type
acl/0
-type acl() :: [operationrequest()].
Link to this type
action/0
-type action() :: use | admin | view | insert | update | delete | link | atom().
Link to this type
maybe_boolean/0
-type maybe_boolean() :: undefined | boolean().
Link to this type
object/0
-type object() :: m_rsc:resource() | #acl_rsc{} | #acl_edge{} | #acl_media{} | any().
Link to this type
operationrequest/0
Link to this section Functions
Link to this function
anondo(Context)
Link to this function
anondo(Fun, Context)
Link to this function
cache_key(Context)
-spec cache_key(z:context()) -> {m_rsc:resource_id() | undefined, any()}.
Link to this function
is_admin(Context)
-spec is_admin(z:context()) -> boolean().
Link to this function
is_admin_editable(Context)
-spec is_admin_editable(z:context()) -> boolean().
Link to this function
is_allowed(Action, Object, Context)
Link to this function
is_allowed_prop(Action, Object, Property, Context)
Link to this function
is_read_only(Context)
-spec is_read_only(z:context()) -> boolean().
Link to this function
is_sudo(Context)
-spec is_sudo(z:context()) -> boolean().
Link to this function
logoff(Context)
Link to this function
logon(Id, Context)
-spec logon(m_rsc:resource() | undefined, z:context()) -> z:context().
Link to this function
logon(Id, Options, Context)
-spec logon(m_rsc:resource() | undefined, map(), z:context()) -> z:context().
Link to this function
logon_prefs(Id, Context)
-spec logon_prefs(m_rsc:resource_id(), z:context()) -> z:context().
Link to this function
logon_prefs(Id, Options, Context)
-spec logon_prefs(m_rsc:resource_id(), map(), z:context()) -> z:context().
Link to this function
logon_refresh(Context)
Link to this function
maybe_allowed(Action, Object, Context)
-spec maybe_allowed(action(), object(), z:context()) -> maybe_boolean().
Link to this function
rsc_deletable(Id, Context)
-spec rsc_deletable(m_rsc:resource(), z:context()) -> boolean().
Link to this function
rsc_editable(Id, Context)
-spec rsc_editable(m_rsc:resource(), z:context()) -> boolean().
Link to this function
rsc_linkable(Id, Context)
-spec rsc_linkable(m_rsc:resource(), z:context()) -> boolean().
Link to this function
rsc_prop_visible(Id, Property, Context)
-spec rsc_prop_visible(m_rsc:resource(), atom() | binary(), z:context()) -> boolean().
Link to this function
rsc_visible(Id, Context)
-spec rsc_visible(m_rsc:resource(), z:context()) -> boolean().
Link to this function
set_read_only(IsReadOnly, Context)
Link to this function
sudo(Context)
Link to this function
sudo(Fun, Context)
Link to this function
user(Context)
-spec user(z:context()) -> m_rsc:resource_id() | undefined.
Link to this function
user_groups(Context)
-spec user_groups(z:context()) -> [m_rsc:resource_id()].