Module z_acl

Access control for Zotonic.

Copyright 2010-2013 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()

object()

object() = m_rsc:resource()

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.
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_prefs/2Log the user with the id on, fill acl and set all user preferences (like timezone and language).
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.
sudo/1
sudo/2Call a function with admin privileges.
user/1Return the id of the current user.
wm_is_authorized/2Convenience function, check if the current user has enough permissions, if not then redirect to the logon page.
wm_is_authorized/3

Function Details

anondo/1

anondo(Context) -> any()

anondo/2

anondo(F::FuncDef, Context::#context{}) -> FuncResult

Call a function as the anonymous user.

cache_key/1

cache_key(Context) -> term()

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

is_admin/1

is_admin(Context) -> any()

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

is_allowed/3

is_allowed(Action::term(), Object::term(), Context::#context{}) -> true | false

Check if an action is allowed for the current actor.

logoff/1

logoff(Context::#context{}) -> #context{}

Log off, reset the acl field of the context

logon/2

logon(Id::m_rsc:resource(), Context::#context{}) -> #context{}

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

logon_prefs/2

logon_prefs(Id::pos_integer(), Context::#context{}) -> #context{}

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

maybe_allowed/3

maybe_allowed(Action::term(), Object::term(), Context::#context{}) -> true | false | undefined

rsc_deletable/2

rsc_deletable(Id, Context) -> any()

Check if the resource is deletable by the current user

rsc_editable/2

rsc_editable(Id, Context) -> any()

Check if the resource is editable by the current user

rsc_linkable/2

rsc_linkable(Id, Context) -> any()

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

rsc_prop_visible/3

rsc_prop_visible(Id, Property, Context) -> any()

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

rsc_visible/2

rsc_visible(Id, Context) -> any()

Check if the resource is visible for the current user

sudo/1

sudo(Context) -> any()

sudo/2

sudo(F::FuncDef, Context::#context{}) -> FuncResult

Call a function with admin privileges.

user/1

user(Context) -> any()

Return the id of the current user.

wm_is_authorized/2

wm_is_authorized(ACLs::boolean() | acl(), Context::#context{}) -> cowmachine:reply()

Convenience function, check if the current user has enough permissions, if not then redirect to the logon page.

wm_is_authorized/3

wm_is_authorized(ACLs::boolean() | acl(), Redirect, Context::#context{}) -> cowmachine:reply()


Generated by EDoc, Dec 9 2016, 15:47:26.