Pluf Framework

Pluf Framework Commit Details


Date:2008-11-05 08:21:49 (16 years 1 month ago)
Author:Loic d'Anterroches
Branch:develop, master
Commit:e7853dd4686e64f4c0c26d5426f08d20687d508d
Parents: 3f1fffb33fc7e890255c0f74c7163eab4c4b15ed
Message:Added a new template tag to get permission details.

Changes:

File differences

src/Pluf/Template/Compiler.php
128128
129129
130130
131
131132
132133
133134
'aurl' => 'Pluf_Template_Tag_Rurl',
'media' => 'Pluf_Template_Tag_MediaUrl',
'amedia' => 'Pluf_Template_Tag_RmediaUrl',
'aperm' => 'Pluf_Template_Tag_APerm',
'getmsgs' => 'Pluf_Template_Tag_Messages',
);
/**
src/Pluf/Template/Tag/APerm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of Plume Framework, a simple PHP Application Framework.
# Copyright (C) 2001-2007 Loic d'Anterroches and contributors.
#
# Plume Framework is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Plume Framework is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
/**
* Assign a permission to a template variable.
*
* This template tag is available by default under the name
* aperm. Example of usage:
*
* <code>
* {aperm 'can_drive', $user, 'MyApp.can_drive'}
* {aperm 'can_drive_big_car', $user, 'MyApp.can_drive', $bigcar}
* {if $can_drive}Can drive!{/if}
* </code>
*
*/
class Pluf_Template_Tag_APerm extends Pluf_Template_Tag
{
/**
* @param string Variable to get the permission
* @param Pluf_User
* @param string Permission string
* @param mixed Optional Pluf_Model if using row level permission (null)
*/
function start($var, $user, $perm, $object=null)
{
$this->context->set($var, $user->hasPerm($perm, $object));
}
}

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.06613s using 13 queries.