mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: orphaned permissions and subsite administrator groups were causing trouble - now with the JOIN the first global administrator group is picked up when ussing the override login. (from r94835)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@95625 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
14c66fb2f8
commit
ca45cbe7e2
@ -608,13 +608,18 @@ class Security extends Controller {
|
||||
* privileges.
|
||||
*/
|
||||
static function findAnAdministrator($username = 'admin', $password = 'password') {
|
||||
$permission = DataObject::get_one("Permission", "\"Code\" = 'ADMIN'", true, "\"Permission\".\"ID\"");
|
||||
|
||||
$adminGroup = null;
|
||||
// coupling to subsites module
|
||||
$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) {
|
||||
// find a group with ADMIN permission
|
||||
$adminGroup = DataObject::get('Group',
|
||||
"\"Permission\".\"Code\" = 'ADMIN'$subsiteCheck",
|
||||
"\"Group\".\"ID\"",
|
||||
"JOIN \"Permission\" ON \"Group\".\"ID\"=\"Permission\".\"GroupID\"",
|
||||
'1');
|
||||
if ($adminGroup) {
|
||||
$adminGroup = $adminGroup->First();
|
||||
|
||||
if($adminGroup->Members()->First()) {
|
||||
$member = $adminGroup->Members()->First();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user