Refactored [47082]: Modified Member::mapInCMSGroups to make use of CMSMain::providePermissions.

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60522 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Hayden Smith 2008-08-12 22:14:36 +00:00
parent ef08421ed7
commit 78c2615821

View File

@ -814,8 +814,18 @@ class Member extends DataObject {
*/ */
public static function mapInCMSGroups($groups = null) { public static function mapInCMSGroups($groups = null) {
if(!$groups || $groups->Count() == 0) { if(!$groups || $groups->Count() == 0) {
$perms = array('ADMIN', 'CMS_ACCESS_AssetAdmin');
$cmsPerms = singleton('CMSMain')->providePermissions();
if(!empty($cmsPerms)) {
$perms = array_unique(array_merge($perms, array_keys($cmsPerms)));
}
$SQL_perms = "'" . array_join(Convert::raw2sql($perms), "', '") . "'";
$groups = DataObject::get('Group', "", "", $groups = DataObject::get('Group', "", "",
"INNER JOIN `Permission` ON `Permission`.GroupID = `Group`.ID AND `Permission`.Code IN ('ADMIN', 'CMS_ACCESS_AssetAdmin')"); "INNER JOIN `Permission` ON `Permission`.GroupID = `Group`.ID AND `Permission`.Code IN ($SQL_perms)");
} }
$groupIDList = array(); $groupIDList = array();