mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
Fix line length
This commit is contained in:
parent
db69c486a0
commit
8b5f593999
@ -187,7 +187,8 @@ class GroupSubsites extends DataExtension implements PermissionProvider
|
||||
}
|
||||
}
|
||||
|
||||
// WORKAROUND for databases that complain about an ORDER BY when the column wasn't selected (e.g. SQL Server)
|
||||
// WORKAROUND for databases that complain about an ORDER BY when the column wasn't selected
|
||||
// (e.g. SQL Server)
|
||||
$select = $query->getSelect();
|
||||
if (isset($select[0]) && !$select[0] == 'COUNT(*)') {
|
||||
$query->addOrderBy('AccessAllSubsites', 'DESC');
|
||||
@ -230,7 +231,10 @@ class GroupSubsites extends DataExtension implements PermissionProvider
|
||||
return [
|
||||
'SECURITY_SUBSITE_GROUP' => [
|
||||
'name' => _t(__CLASS__ . '.MANAGE_SUBSITES', 'Manage subsites for groups'),
|
||||
'category' => _t('SilverStripe\\Security\\Permission.PERMISSIONS_CATEGORY', 'Roles and access permissions'),
|
||||
'category' => _t(
|
||||
'SilverStripe\\Security\\Permission.PERMISSIONS_CATEGORY',
|
||||
'Roles and access permissions'
|
||||
),
|
||||
'help' => _t(
|
||||
__CLASS__ . '.MANAGE_SUBSITES_HELP',
|
||||
'Ability to limit the permissions for a group to one or more subsites.'
|
||||
|
@ -62,7 +62,10 @@ class SiteTreeSubsites extends DataExtension
|
||||
}
|
||||
|
||||
// If you're querying by ID, ignore the sub-site - this is a bit ugly...
|
||||
// if(!$query->where || (strpos($query->where[0], ".\"ID\" = ") === false && strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false && strpos($query->where[0], "ID = ") !== 0)) {
|
||||
// if(!$query->where
|
||||
// || (strpos($query->where[0], ".\"ID\" = ") === false
|
||||
// && strpos($query->where[0], ".`ID` = ") === false && strpos($query->where[0], ".ID = ") === false
|
||||
// && strpos($query->where[0], "ID = ") !== 0)) {
|
||||
if ($query->filtersOnID()) {
|
||||
return;
|
||||
}
|
||||
@ -418,7 +421,10 @@ class SiteTreeSubsites extends DataExtension
|
||||
Subsite::disable_subsite_filter(true);
|
||||
$candidatePage = DataObject::get_one(
|
||||
SiteTree::class,
|
||||
"\"URLSegment\" = '" . Convert::raw2sql(urldecode($rest)) . "' AND \"SubsiteID\" = " . $subsiteID,
|
||||
"\"URLSegment\" = '"
|
||||
. Convert::raw2sql(urldecode($rest))
|
||||
. "' AND \"SubsiteID\" = "
|
||||
. $subsiteID,
|
||||
false
|
||||
);
|
||||
Subsite::disable_subsite_filter($origDisableSubsiteFilter);
|
||||
|
@ -480,7 +480,9 @@ class Subsite extends DataObject
|
||||
)
|
||||
->innerJoin(
|
||||
'Permission',
|
||||
"\"Group\".\"ID\"=\"Permission\".\"GroupID\" AND \"Permission\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')"
|
||||
"\"Group\".\"ID\"=\"Permission\".\"GroupID\"
|
||||
AND \"Permission\".\"Code\"
|
||||
IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')"
|
||||
);
|
||||
|
||||
if (!$subsites) {
|
||||
@ -504,7 +506,9 @@ class Subsite extends DataObject
|
||||
->innerJoin('PermissionRole', '"Group_Roles"."PermissionRoleID"="PermissionRole"."ID"')
|
||||
->innerJoin(
|
||||
'PermissionRoleCode',
|
||||
"\"PermissionRole\".\"ID\"=\"PermissionRoleCode\".\"RoleID\" AND \"PermissionRoleCode\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')"
|
||||
"\"PermissionRole\".\"ID\"=\"PermissionRoleCode\".\"RoleID\"
|
||||
AND \"PermissionRoleCode\".\"Code\"
|
||||
IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')"
|
||||
);
|
||||
|
||||
if (!$subsites && $rolesSubsites) {
|
||||
@ -628,10 +632,12 @@ class Subsite extends DataObject
|
||||
$groupCount = DB::query("
|
||||
SELECT COUNT(\"Permission\".\"ID\")
|
||||
FROM \"Permission\"
|
||||
INNER JOIN \"Group\" ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1
|
||||
INNER JOIN \"Group_Members\" ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\"
|
||||
WHERE \"Permission\".\"Code\" IN ('$SQL_perms')
|
||||
AND \"Group_Members\".\"MemberID\" = {$memberID}
|
||||
INNER JOIN \"Group\"
|
||||
ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1
|
||||
INNER JOIN \"Group_Members\"
|
||||
ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\"
|
||||
WHERE \"Permission\".\"Code\"
|
||||
IN ('$SQL_perms') AND \"Group_Members\".\"MemberID\" = {$memberID}
|
||||
")->value();
|
||||
|
||||
// Count this user's groups which have a role that can access the main site
|
||||
|
@ -141,9 +141,18 @@ class SubsitesVirtualPage extends VirtualPage
|
||||
{
|
||||
$labels = parent::fieldLabels($includerelations);
|
||||
$labels['CustomMetaTitle'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaTitle', 'Title');
|
||||
$labels['CustomMetaKeywords'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaKeywords', 'Keywords');
|
||||
$labels['CustomMetaDescription'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaDescription', 'Description');
|
||||
$labels['CustomExtraMeta'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomExtraMeta', 'Custom Meta Tags');
|
||||
$labels['CustomMetaKeywords'] = _t(
|
||||
'SilverStripe\\Subsites\\Model\\Subsite.CustomMetaKeywords',
|
||||
'Keywords'
|
||||
);
|
||||
$labels['CustomMetaDescription'] = _t(
|
||||
'SilverStripe\\Subsites\\Model\\Subsite.CustomMetaDescription',
|
||||
'Description'
|
||||
);
|
||||
$labels['CustomExtraMeta'] = _t(
|
||||
'SilverStripe\\Subsites\\Model\\Subsite.CustomExtraMeta',
|
||||
'Custom Meta Tags'
|
||||
);
|
||||
|
||||
return $labels;
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ class SubsiteAdminTest extends BaseSubsiteTest
|
||||
|
||||
// Confirm that this URL gets you the entire page, with the edit form loaded
|
||||
$response2 = Director::test(
|
||||
"admin/subsites/SilverStripe-Subsites-Model-Subsite/EditForm/field/SilverStripe-Subsites-Model-Subsite/item/$subsite1ID/edit",
|
||||
"admin/subsites/SilverStripe-Subsites-Model-Subsite/EditForm/field/"
|
||||
."SilverStripe-Subsites-Model-Subsite/item/$subsite1ID/edit",
|
||||
null,
|
||||
$this->adminLoggedInSession()
|
||||
);
|
||||
|
@ -57,7 +57,8 @@ class SubsiteTest extends BaseSubsiteTest
|
||||
$tmplStaff = $this->objFromFixture('Page', 'staff');
|
||||
$tmplHome = DataObject::get_one('Page', "\"URLSegment\" = 'home'");
|
||||
|
||||
// Publish all the pages in the template, testing that DataObject::get only returns pages from the chosen subsite
|
||||
// Publish all the pages in the template, testing that DataObject::get only returns pages
|
||||
// from the chosen subsite
|
||||
$pages = DataObject::get(SiteTree::class);
|
||||
$totalPages = $pages->count();
|
||||
foreach ($pages as $page) {
|
||||
@ -193,7 +194,8 @@ class SubsiteTest extends BaseSubsiteTest
|
||||
$this->assertEquals(
|
||||
$subsite1->ID,
|
||||
Subsite::getSubsiteIDForDomain('www.example.org'),
|
||||
'Matches without strict checking when using www prefix, still matching first domain regardless of www prefix (falling back to subsite primary key ordering)'
|
||||
'Matches without strict checking when using www prefix, '
|
||||
.'still matching first domain regardless of www prefix (falling back to subsite primary key ordering)'
|
||||
);
|
||||
$this->assertEquals(
|
||||
$subsite1->ID,
|
||||
|
Loading…
x
Reference in New Issue
Block a user