MINOR Formatting in Permission::checkMember()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66736 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-11-26 03:39:33 +00:00 committed by Sam Minnee
parent 18178c3e79
commit 61c58014c1

View File

@ -124,15 +124,19 @@ class Permission extends DataObject {
$perms_list = self::get_declared_permissions_list();
$memberID = (is_object($member)) ? $member->ID : $member;
if(self::$declared_permissions && is_array($perms_list) &&
!in_array($code, $perms_list)) {
//user_error("Permission '$code' has not been declared. Use " .
// "Permission::declare_permissions() to add this permission",
// E_USER_WARNING);
/*
if(self::$declared_permissions && is_array($perms_list) && !in_array($code, $perms_list)) {
user_error(
"Permission '$code' has not been declared. Use " .
"Permission::declare_permissions() to add this permission",
E_USER_WARNING
);
}
*/
$groupList = self::groupList($memberID);
if($groupList) {
if(!$groupList) return false;
$groupCSV = implode(", ", $groupList);
// Arg component
@ -147,19 +151,19 @@ class Permission extends DataObject {
if(is_numeric($arg)) {
$argClause = "AND Arg IN (-1, $arg) ";
} else {
user_error("Permission::checkMember: bad arg '$arg'",
E_USER_ERROR);
user_error("Permission::checkMember: bad arg '$arg'", E_USER_ERROR);
}
}
if(is_array($code)) $SQL_codeList = "'" . implode("', '", Convert::raw2sql($code)) . "'";
else $SQL_codeList = "'" . Convert::raw2sql($code) . "'";
if(is_array($code)) {
$SQL_codeList = "'" . implode("', '", Convert::raw2sql($code)) . "'";
} else {
$SQL_codeList = "'" . Convert::raw2sql($code) . "'";
}
$SQL_code = Convert::raw2sql($code);
$adminFilter = (self::$admin_implies_all)
? ",'ADMIN'"
: '';
$adminFilter = (self::$admin_implies_all) ? ",'ADMIN'" : '';
// Raw SQL for efficiency
$permission = DB::query("
@ -173,8 +177,7 @@ class Permission extends DataObject {
)
")->value();
if($permission)
return $permission;
if($permission) return $permission;
// Strict checking disabled?
@ -187,14 +190,12 @@ class Permission extends DataObject {
AND (Type = " . self::GRANT_PERMISSION . ")
)
")->value();
if(!$hasPermission) {
return true;
}
if(!$hasPermission) return true;
}
return false;
}
}
/**