mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Sam's fix for "Unknown column Group.SubsiteID" with new subsites (from r100375)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105555 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
08fb51c584
commit
95c4befb4a
@ -625,14 +625,22 @@ class Security extends Controller {
|
||||
*/
|
||||
static function findAnAdministrator() {
|
||||
// coupling to subsites module
|
||||
$subsiteCheck = class_exists('GroupSubsites') ? ' AND "Group"."SubsiteID" = 0' : '';
|
||||
$origSubsite = null;
|
||||
if(is_callable('Subsite::changeSubsite')) {
|
||||
$origSubsite = Subsite::currentSubsiteID();
|
||||
Subsite::changeSubsite(0);
|
||||
}
|
||||
|
||||
// find a group with ADMIN permission
|
||||
$adminGroup = DataObject::get('Group',
|
||||
"\"Permission\".\"Code\" = 'ADMIN'$subsiteCheck",
|
||||
"\"Permission\".\"Code\" = 'ADMIN'",
|
||||
"\"Group\".\"ID\"",
|
||||
"JOIN \"Permission\" ON \"Group\".\"ID\"=\"Permission\".\"GroupID\"",
|
||||
'1');
|
||||
|
||||
if(is_callable('Subsite::changeSubsite')) {
|
||||
Subsite::changeSubsite($origSubsite);
|
||||
}
|
||||
if ($adminGroup) {
|
||||
$adminGroup = $adminGroup->First();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user