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

/modules/mod_admin/resources/resource_admin.erl

https://code.google.com/p/zotonic/
Erlang | 36 lines | 13 code | 7 blank | 16 comment | 0 complexity | ef5855a9c8dafd01de578863bd27c784 MD5 | raw file
 1%% @author Tim Benniks <tim@timbenniks.com>
 2%% @copyright 2009 Tim Benniks.
 3%% @doc Admin webmachine_resource.
 4
 5%% Copyright 2009 Tim Benniks
 6%%
 7%% Licensed under the Apache License, Version 2.0 (the "License");
 8%% you may not use this file except in compliance with the License.
 9%% You may obtain a copy of the License at
10%% 
11%%     http://www.apache.org/licenses/LICENSE-2.0
12%% 
13%% Unless required by applicable law or agreed to in writing, software
14%% distributed under the License is distributed on an "AS IS" BASIS,
15%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16%% See the License for the specific language governing permissions and
17%% limitations under the License.
18
19-module(resource_admin).
20-author("Tim Benniks <tim@timbenniks.com>").
21
22-export([
23    is_authorized/2
24]).
25
26-include_lib("resource_html.hrl").
27
28is_authorized(ReqData, Context) ->
29    z_acl:wm_is_authorized(use, z_context:get(acl_module, Context, mod_admin), ReqData, Context).
30
31
32html(Context) ->
33    Template = z_context:get(template, Context, "admin.tpl"),
34    Selected = z_context:get(selected, Context, "dashboard"),
35    Html = z_template:render(Template, [{selected, Selected}], Context),
36    z_context:output(Html, Context).