repo.or.cz
/
sgn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
message dialog and js
[sgn.git]
/
mason
/
util
/
user.mas
blob
39ad429f235c9dd843df4fd457e946e7680d8751
1
%# Logged-in content
2
<%method logged_in>
3
% if(!!$c->user()){
4
<% $m->content %>
5
% }
6
</%method>
7
8
%# Logged-out content
9
<%method logged_out>
10
% if(!$c->user()){
11
<% $m->content %>
12
% }
13
</%method>
14
15
%# Role-based content
16
%# <&| /util/user.mas:role, roles=>["curator"] &>
17
%# <span>You're a curator Harry.</span>
18
%# </&>
19
<%method role>
20
<%args>
21
$roles => []
22
</%args>
23
<%init>
24
my $role_match = 0;
25
if(!!$c->user()){
26
foreach my $role (@{$roles}) {
27
if (grep(/^$role$/, $c->user()->get_object->get_roles())){
28
$role_match = 1;
29
}
30
}
31
}
32
</%init>
33
% if($role_match) {
34
<% $m->content %>
35
% }
36
</%method>