PageRenderTime 19ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/priv/sites/zotonic_status/zotonic_status.erl

https://code.google.com/p/zotonic/
Erlang | 26 lines | 17 code | 6 blank | 3 comment | 1 complexity | c0f690e5539fc18b377a77b2ff73ae5f MD5 | raw file
 1-module(zotonic_status).
 2-author("Marc Worrell <marc@worrell.nl>").
 3
 4-mod_title("Zotonic Status").
 5-mod_descr("Default Zotonic site, used when no other site can handle the supplied Host.").
 6-mod_prio(10).
 7
 8-export([
 9    observe_user_is_enabled/2,
10    observe_acl_logon/2,
11    observe_acl_logoff/2
12]).
13
14-include_lib("zotonic.hrl").
15
16%% @doc Check if an user is enabled.
17observe_user_is_enabled({user_is_enabled, UserId}, _Context) ->
18    UserId == 1.
19
20%% @doc Let the user log on, this is the moment to start caching information.
21observe_acl_logon({acl_logon, UserId}, Context) ->
22    Context#context{user_id=UserId}.
23
24%% @doc Let the user log off, clean up any cached information.
25observe_acl_logoff({acl_logoff}, Context) ->
26    Context#context{acl=undefined, user_id=undefined}.