From 298ef035ed6e6931fa10de9ff535ee3bc7d7e332 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 16 Dec 2009 05:40:05 +0000 Subject: [PATCH] BUGFIX: Make sure findAnAdministrator gets a global administrator when subsites is installed. (from r94369) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@95603 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- security/Security.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/security/Security.php b/security/Security.php index 46f9c3e4f..3f1ce02a5 100644 --- a/security/Security.php +++ b/security/Security.php @@ -611,7 +611,8 @@ class Security extends Controller { $permission = DataObject::get_one("Permission", "\"Code\" = 'ADMIN'", true, "\"Permission\".\"ID\""); $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->Members()->First()) { @@ -863,4 +864,4 @@ class Security extends Controller { } } -?> \ No newline at end of file +?>