Module z_controller_helper

Helper functions commonly used in controllers.

Copyright © 2014-2019 Marc Worrell

Authors: Marc Worrell.

Description

Helper functions commonly used in controllers.

Function Index

decode_request/2Decode the request data.
encode_response/2Encode the response data.
get_configured_id/1Fetch the id from the dispatch configuration.
get_id/1Fetch the id from the request or the dispatch configuration.
is_authorized/1Check if the current user is allowed to access the controller.
is_authorized/2
is_authorized/3
req_body/1

Function Details

decode_request/2

decode_request(CT::undefined | cow_http_hd:media_type(), Context::z:context()) -> {map() | binary(), z:context()}

Decode the request data

encode_response/2

encode_response(Mime::cow_http_hd:media_type(), Data::term()) -> binary()

Encode the response data

get_configured_id/1

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

Fetch the id from the dispatch configuration.

get_id/1

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

Fetch the id from the request or the dispatch configuration.

is_authorized/1

is_authorized(Context::z:context()) -> {boolean(), z:context()}

Check if the current user is allowed to access the controller.

is_authorized/2

is_authorized(ACLs::boolean() | z_acl:acl(), Context::z:context()) -> {boolean(), z:context()}

is_authorized/3

is_authorized(Action::z_acl:action(), Object::z_acl:object(), Context::z:context()) -> {boolean(), z:context()}

req_body/1

req_body(Context::z:context()) -> {binary(), z:context()}


Generated by EDoc