Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%%' HEADER
- %%% @author Susan Potter <me@susanpotter.net>
- %%% @date 2011-02-16T17:08
- %%% @license BSD
- %%% @doc Example of a security_handler callback module.
- %%% @end
- -module(custom_security_handler_callback).
- -include_lib("nitrogen_core/include/wf.hrl").
- % security_handler callback exports
- -export([authorized/2, login_url/0]).
- %%%.
- %%%' CALLBACKS
- %% @hidden
- authorized(_User, home_page) -> true;
- authorized(User, admin_page) -> admin_authorization(User);
- authorized(User, _) -> user_authorization(User).
- %% @hidden
- login_path() ->
- "/login".
- %%%.
- %%%' PRIVATE FUNCTIONS
- %% @private
- admin_authorization(User) ->
- case User of
- "admin" -> true;
- _ -> false
- end.
- user_authorization(User) ->
- case User of
- undefined -> false;
- _ -> true
- end.
- %%%.
- %%% vim: set filetype=erlang tabstop=2 foldmarker=%%%',%%%. foldmethod=marker:
Add Comment
Please, Sign In to add comment