mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Added '<% if HasPerm(PERM_CODE() %>' to ViewableData for template
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41094 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c0660c147b
commit
8ecb8f0d6a
@ -681,6 +681,15 @@ class ViewableData extends Object implements Iterator {
|
|||||||
function CurrentMember() {
|
function CurrentMember() {
|
||||||
return Member::currentUser();
|
return Member::currentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the current user has the given permission.
|
||||||
|
* Can be used to implement security-specific sections within templates
|
||||||
|
* @return int The Permission record-ID if the permission can be found, null otherwise
|
||||||
|
*/
|
||||||
|
function HasPerm($permCode) {
|
||||||
|
return Permission::check($permCode);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add some arbitrary data to this viewabledata object. Returns a new object with the
|
* Add some arbitrary data to this viewabledata object. Returns a new object with the
|
||||||
|
Loading…
Reference in New Issue
Block a user