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
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100375 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
bad4352d60
commit
1e921362fc
@ -619,14 +619,22 @@ class Security extends Controller {
|
|||||||
*/
|
*/
|
||||||
static function findAnAdministrator() {
|
static function findAnAdministrator() {
|
||||||
// coupling to subsites module
|
// 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
|
// find a group with ADMIN permission
|
||||||
$adminGroup = DataObject::get('Group',
|
$adminGroup = DataObject::get('Group',
|
||||||
"\"Permission\".\"Code\" = 'ADMIN'$subsiteCheck",
|
"\"Permission\".\"Code\" = 'ADMIN'",
|
||||||
"\"Group\".\"ID\"",
|
"\"Group\".\"ID\"",
|
||||||
"JOIN \"Permission\" ON \"Group\".\"ID\"=\"Permission\".\"GroupID\"",
|
"JOIN \"Permission\" ON \"Group\".\"ID\"=\"Permission\".\"GroupID\"",
|
||||||
'1');
|
'1');
|
||||||
|
|
||||||
|
if(is_callable('Subsite::changeSubsite')) {
|
||||||
|
Subsite::changeSubsite($origSubsite);
|
||||||
|
}
|
||||||
if ($adminGroup) {
|
if ($adminGroup) {
|
||||||
$adminGroup = $adminGroup->First();
|
$adminGroup = $adminGroup->First();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user