Module z_acl

Access control for Zotonic.

Copyright © 2010-2021 Marc Worrell

Authors: Marc Worrell (marc@worrell.nl).

Description

Access control for Zotonic. Interfaces to modules implementing the ACL events.

Data Types

acl()

acl() = [operationrequest()]

action()

action() = use | admin | view | insert | update | delete | link | atom()

maybe_boolean()

maybe_boolean() = undefined | boolean()

object()

object() = m_rsc:resource() | #acl_rsc{} | #acl_edge{} | #acl_media{} | any()

operationrequest()

operationrequest() = {action(), object()}

Function Index

anondo/1
anondo/2Call a function as the anonymous user.
cache_key/1Return a term that can be used as the ACL part of cache key.
is_admin/1Check if the current user is an admin or a sudo action.
is_allowed/3Check if an action is allowed for the current actor.
is_allowed_prop/4Check if an action on a property of a resource is allowed for the current actor.
is_read_only/1
logoff/1Log off, reset the acl field of the context.
logon/2Log the user with the id on, fill the acl field of the context.
logon/3
logon_prefs/2Log the user with the id on, fill acl and set all user preferences (like timezone and language).
logon_prefs/3
logon_refresh/1Refresh the authentication of the current user.
maybe_allowed/3
rsc_deletable/2Check if the resource is deletable by the current user.
rsc_editable/2Check if the resource is editable by the current user.
rsc_linkable/2Check if the resource is connected to another resource by the current user.
rsc_prop_visible/3Check if a property of the resource is visible for the current user.
rsc_visible/2Check if the resource is visible for the current user.
set_read_only/2
sudo/1
sudo/2Call a function with admin privileges.
user/1Return the id of the current user.
user_groups/1Return the list of user groups the current context is member of.

Function Details

anondo/1

anondo(Context::z:context()) -> z:context()

anondo/2

anondo(Fun, Context::z:context()) -> any()

Call a function as the anonymous user.

cache_key/1

cache_key(Context::z:context()) -> {m_rsc:resource_id() | undefined, any()}

Return a term that can be used as the ACL part of cache key.

is_admin/1

is_admin(Context::z:context()) -> boolean()

Check if the current user is an admin or a sudo action

is_allowed/3

is_allowed(Action::action(), Object::object(), Context::z:context()) -> boolean()

Check if an action is allowed for the current actor.

is_allowed_prop/4

is_allowed_prop(Action::action(), Object::object(), Property::atom() | binary(), Context::z:context()) -> true | false | undefined

Check if an action on a property of a resource is allowed for the current actor.

is_read_only/1

is_read_only(Context::z:context()) -> boolean()

logoff/1

logoff(Context::z:context()) -> z:context()

Log off, reset the acl field of the context

logon/2

logon(Id::m_rsc:resource() | undefined, Context::z:context()) -> z:context()

Log the user with the id on, fill the acl field of the context

logon/3

logon(Id::m_rsc:resource() | undefined, Options::map(), Context::z:context()) -> z:context()

logon_prefs/2

logon_prefs(Id::m_rsc:resource_id(), Context::z:context()) -> z:context()

Log the user with the id on, fill acl and set all user preferences (like timezone and language)

logon_prefs/3

logon_prefs(Id::m_rsc:resource_id(), Options::map(), Context::z:context()) -> z:context()

logon_refresh/1

logon_refresh(Context::z:context()) -> z:context()

Refresh the authentication of the current user

maybe_allowed/3

maybe_allowed(Action::action(), Object::object(), Context::z:context()) -> maybe_boolean()

rsc_deletable/2

rsc_deletable(Id::m_rsc:resource(), Context::z:context()) -> boolean()

Check if the resource is deletable by the current user

rsc_editable/2

rsc_editable(Id::m_rsc:resource(), Context::z:context()) -> boolean()

Check if the resource is editable by the current user

rsc_linkable/2

rsc_linkable(Id::m_rsc:resource(), Context::z:context()) -> boolean()

Check if the resource is connected to another resource by the current user

rsc_prop_visible/3

rsc_prop_visible(Id::m_rsc:resource(), Property::atom() | binary(), Context::z:context()) -> boolean()

Check if a property of the resource is visible for the current user

rsc_visible/2

rsc_visible(Id::m_rsc:resource(), Context::z:context()) -> boolean()

Check if the resource is visible for the current user

set_read_only/2

set_read_only(IsReadOnly::boolean(), Context::z:context()) -> z:context()

sudo/1

sudo(Context::z:context()) -> z:context()

sudo/2

sudo(Fun, Context::z:context()) -> any()

Call a function with admin privileges.

user/1

user(Context::z:context()) -> m_rsc:resource_id() | undefined

Return the id of the current user.

user_groups/1

user_groups(Context::z:context()) -> [m_rsc:resource_id()]

Return the list of user groups the current context is member of.


Generated by EDoc