BUGFIX: Make sure findAnAdministrator gets a global administrator when subsites is installed.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@94369 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2009-12-03 21:32:46 +00:00 committed by Sam Minnee
parent faab8f7d16
commit a783448266

View File

@ -605,7 +605,8 @@ class Security extends Controller {
$permission = DataObject::get_one("Permission", "\"Code\" = 'ADMIN'", true, "\"Permission\".\"ID\""); $permission = DataObject::get_one("Permission", "\"Code\" = 'ADMIN'", true, "\"Permission\".\"ID\"");
$adminGroup = null; $adminGroup = null;
if($permission) $adminGroup = DataObject::get_one("Group", "\"Group\".\"ID\" = '{$permission->GroupID}'", true, "\"Group\".\"ID\""); $subsiteCheck = class_exists('GroupSubsites') ? ' AND "Group"."SubsiteID" = 0' : '';
if($permission) $adminGroup = DataObject::get_one("Group", "\"Group\".\"ID\" = '{$permission->GroupID}'$subsiteCheck", true, "\"Group\".\"ID\"");
if($adminGroup) { if($adminGroup) {
if($adminGroup->Members()->First()) { if($adminGroup->Members()->First()) {
@ -857,4 +858,4 @@ class Security extends Controller {
} }
} }
?> ?>