mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02: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();
|
$select = $query->getSelect();
|
||||||
if (isset($select[0]) && !$select[0] == 'COUNT(*)') {
|
if (isset($select[0]) && !$select[0] == 'COUNT(*)') {
|
||||||
$query->addOrderBy('AccessAllSubsites', 'DESC');
|
$query->addOrderBy('AccessAllSubsites', 'DESC');
|
||||||
@ -230,7 +231,10 @@ class GroupSubsites extends DataExtension implements PermissionProvider
|
|||||||
return [
|
return [
|
||||||
'SECURITY_SUBSITE_GROUP' => [
|
'SECURITY_SUBSITE_GROUP' => [
|
||||||
'name' => _t(__CLASS__ . '.MANAGE_SUBSITES', 'Manage subsites for groups'),
|
'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(
|
'help' => _t(
|
||||||
__CLASS__ . '.MANAGE_SUBSITES_HELP',
|
__CLASS__ . '.MANAGE_SUBSITES_HELP',
|
||||||
'Ability to limit the permissions for a group to one or more subsites.'
|
'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 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()) {
|
if ($query->filtersOnID()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -418,7 +421,10 @@ class SiteTreeSubsites extends DataExtension
|
|||||||
Subsite::disable_subsite_filter(true);
|
Subsite::disable_subsite_filter(true);
|
||||||
$candidatePage = DataObject::get_one(
|
$candidatePage = DataObject::get_one(
|
||||||
SiteTree::class,
|
SiteTree::class,
|
||||||
"\"URLSegment\" = '" . Convert::raw2sql(urldecode($rest)) . "' AND \"SubsiteID\" = " . $subsiteID,
|
"\"URLSegment\" = '"
|
||||||
|
. Convert::raw2sql(urldecode($rest))
|
||||||
|
. "' AND \"SubsiteID\" = "
|
||||||
|
. $subsiteID,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
Subsite::disable_subsite_filter($origDisableSubsiteFilter);
|
Subsite::disable_subsite_filter($origDisableSubsiteFilter);
|
||||||
|
@ -480,7 +480,9 @@ class Subsite extends DataObject
|
|||||||
)
|
)
|
||||||
->innerJoin(
|
->innerJoin(
|
||||||
'Permission',
|
'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) {
|
if (!$subsites) {
|
||||||
@ -504,7 +506,9 @@ class Subsite extends DataObject
|
|||||||
->innerJoin('PermissionRole', '"Group_Roles"."PermissionRoleID"="PermissionRole"."ID"')
|
->innerJoin('PermissionRole', '"Group_Roles"."PermissionRoleID"="PermissionRole"."ID"')
|
||||||
->innerJoin(
|
->innerJoin(
|
||||||
'PermissionRoleCode',
|
'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) {
|
if (!$subsites && $rolesSubsites) {
|
||||||
@ -628,10 +632,12 @@ class Subsite extends DataObject
|
|||||||
$groupCount = DB::query("
|
$groupCount = DB::query("
|
||||||
SELECT COUNT(\"Permission\".\"ID\")
|
SELECT COUNT(\"Permission\".\"ID\")
|
||||||
FROM \"Permission\"
|
FROM \"Permission\"
|
||||||
INNER JOIN \"Group\" ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1
|
INNER JOIN \"Group\"
|
||||||
INNER JOIN \"Group_Members\" ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\"
|
ON \"Group\".\"ID\" = \"Permission\".\"GroupID\" AND \"Group\".\"AccessAllSubsites\" = 1
|
||||||
WHERE \"Permission\".\"Code\" IN ('$SQL_perms')
|
INNER JOIN \"Group_Members\"
|
||||||
AND \"Group_Members\".\"MemberID\" = {$memberID}
|
ON \"Group_Members\".\"GroupID\" = \"Permission\".\"GroupID\"
|
||||||
|
WHERE \"Permission\".\"Code\"
|
||||||
|
IN ('$SQL_perms') AND \"Group_Members\".\"MemberID\" = {$memberID}
|
||||||
")->value();
|
")->value();
|
||||||
|
|
||||||
// Count this user's groups which have a role that can access the main site
|
// 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 = parent::fieldLabels($includerelations);
|
||||||
$labels['CustomMetaTitle'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaTitle', 'Title');
|
$labels['CustomMetaTitle'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaTitle', 'Title');
|
||||||
$labels['CustomMetaKeywords'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaKeywords', 'Keywords');
|
$labels['CustomMetaKeywords'] = _t(
|
||||||
$labels['CustomMetaDescription'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomMetaDescription', 'Description');
|
'SilverStripe\\Subsites\\Model\\Subsite.CustomMetaKeywords',
|
||||||
$labels['CustomExtraMeta'] = _t('SilverStripe\\Subsites\\Model\\Subsite.CustomExtraMeta', 'Custom Meta Tags');
|
'Keywords'
|
||||||
|
);
|
||||||
|
$labels['CustomMetaDescription'] = _t(
|
||||||
|
'SilverStripe\\Subsites\\Model\\Subsite.CustomMetaDescription',
|
||||||
|
'Description'
|
||||||
|
);
|
||||||
|
$labels['CustomExtraMeta'] = _t(
|
||||||
|
'SilverStripe\\Subsites\\Model\\Subsite.CustomExtraMeta',
|
||||||
|
'Custom Meta Tags'
|
||||||
|
);
|
||||||
|
|
||||||
return $labels;
|
return $labels;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ class SubsiteAdminTest extends BaseSubsiteTest
|
|||||||
|
|
||||||
// Confirm that this URL gets you the entire page, with the edit form loaded
|
// Confirm that this URL gets you the entire page, with the edit form loaded
|
||||||
$response2 = Director::test(
|
$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,
|
null,
|
||||||
$this->adminLoggedInSession()
|
$this->adminLoggedInSession()
|
||||||
);
|
);
|
||||||
|
@ -57,7 +57,8 @@ class SubsiteTest extends BaseSubsiteTest
|
|||||||
$tmplStaff = $this->objFromFixture('Page', 'staff');
|
$tmplStaff = $this->objFromFixture('Page', 'staff');
|
||||||
$tmplHome = DataObject::get_one('Page', "\"URLSegment\" = 'home'");
|
$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);
|
$pages = DataObject::get(SiteTree::class);
|
||||||
$totalPages = $pages->count();
|
$totalPages = $pages->count();
|
||||||
foreach ($pages as $page) {
|
foreach ($pages as $page) {
|
||||||
@ -193,7 +194,8 @@ class SubsiteTest extends BaseSubsiteTest
|
|||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$subsite1->ID,
|
$subsite1->ID,
|
||||||
Subsite::getSubsiteIDForDomain('www.example.org'),
|
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(
|
$this->assertEquals(
|
||||||
$subsite1->ID,
|
$subsite1->ID,
|
||||||
|
Loading…
Reference in New Issue
Block a user