mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Allowing usage of $member parameter for Member::check() as ID, Code or Object
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62844 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
306ea3761f
commit
764ab2b1a2
@ -85,7 +85,7 @@ class Permission extends DataObject {
|
|||||||
* @param string $code Code of the permission to check
|
* @param string $code Code of the permission to check
|
||||||
* @param string $arg Optional argument (e.g. a permissions for a specific
|
* @param string $arg Optional argument (e.g. a permissions for a specific
|
||||||
* page)
|
* page)
|
||||||
* @param int $memberID Optional member ID. If set to NULL, the permssion
|
* @param int|Member $member Optional member instance or ID. If set to NULL, the permssion
|
||||||
* will be checked for the current user
|
* will be checked for the current user
|
||||||
* @param bool $strict Use "strict" checking (which means a permission
|
* @param bool $strict Use "strict" checking (which means a permission
|
||||||
* will be granted if the key does not exist at all)?
|
* will be granted if the key does not exist at all)?
|
||||||
@ -94,15 +94,15 @@ class Permission extends DataObject {
|
|||||||
* disabled, TRUE will be returned if the permission does
|
* disabled, TRUE will be returned if the permission does
|
||||||
* not exist at all.
|
* not exist at all.
|
||||||
*/
|
*/
|
||||||
public static function check($code, $arg = "any", $memberID = null, $strict = true) {
|
public static function check($code, $arg = "any", $member = null, $strict = true) {
|
||||||
if(!$memberID) {
|
if(!$member) {
|
||||||
if(!Member::currentUser()) {
|
if(!Member::currentUser()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$memberID = Member::currentUserID();
|
$member = Member::currentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::checkMember($memberID, $code, $arg, $strict);
|
return self::checkMember($member, $code, $arg, $strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user