Skip to content

Commit c7a0d69

Browse files
committed
Remove extras-namespaces logic
Pulling for PR, will add back to a new branch/PR
1 parent db08060 commit c7a0d69

File tree

5 files changed

+17
-69
lines changed

5 files changed

+17
-69
lines changed

core/src/Revolution/Processors/System/Dashboard/Widget/GetList.php

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace MODX\Revolution\Processors\System\Dashboard\Widget;
1313

14-
use MODX\Revolution\modNamespace;
1514
use MODX\Revolution\modDashboardWidget;
1615
use MODX\Revolution\Processors\Model\GetListProcessor;
1716
use xPDO\Om\xPDOObject;
@@ -36,8 +35,6 @@ class GetList extends GetListProcessor
3635
public $canEdit = false;
3736
public $canRemove = false;
3837

39-
protected $extrasNamespaces = [];
40-
4138
/**
4239
* @return bool
4340
*/
@@ -52,7 +49,6 @@ public function initialize()
5249
$this->canCreate = $canManage;
5350
$this->canEdit = $canManage;
5451
$this->canRemove = $canManage;
55-
$this->extrasNamespaces = modNamespace::class::getExtrasNamespaces($this->modx);
5652

5753
return $initialized;
5854
}
@@ -104,23 +100,11 @@ public function prepareRow(xPDOObject $object)
104100
'delete' => $this->canRemove
105101
];
106102
$widgetData = $object->toArray();
107-
$widgetNamespace = $object->get('namespace');
108103
$isCoreWidget = strpos($widgetData['content'], '[[++manager_path]]') === 0;
109-
$widgetData['isExtrasWidget'] = in_array($widgetNamespace, $this->extrasNamespaces);
110-
$widgetData['isProtected'] = true;
111-
112-
switch (true) {
113-
case $widgetData['isExtrasWidget']:
114-
$widgetData['creator'] = $this->modx->lexicon('package_extra');
115-
break;
116-
case $isCoreWidget:
117-
$widgetData['creator'] = 'MODX';
118-
break;
119-
default:
120-
$widgetData['creator'] = $this->modx->lexicon('user');
121-
$widgetData['isProtected'] = false;
122-
}
123-
$widgetData['creator'] = strtolower($widgetData['creator']);
104+
$widgetData['isProtected'] = $isCoreWidget
105+
? true
106+
: false
107+
;
124108

125109
if ($isCoreWidget) {
126110
unset($permissions['delete']);

core/src/Revolution/Processors/Workspace/PackageNamespace/GetList.php

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use MODX\Revolution\modAccessNamespace;
1515
use MODX\Revolution\modNamespace;
1616
use MODX\Revolution\modUserGroup;
17-
use MODX\Revolution\Transport\modTransportPackage;
1817
use MODX\Revolution\Processors\Model\GetListProcessor;
1918
use xPDO\Om\xPDOObject;
2019
use xPDO\Om\xPDOQuery;
@@ -46,7 +45,6 @@ class GetList extends GetListProcessor
4645
protected $isGridFilter = false;
4746

4847
protected $coreNamespaces;
49-
protected $extrasNamespaces = [];
5048

5149
/**
5250
* {@inheritDoc}
@@ -74,7 +72,6 @@ public function initialize()
7472
$this->canEdit = $this->modx->hasPermission('namespaces');
7573
$this->canRemove = $this->modx->hasPermission('namespaces');
7674
$this->coreNamespaces = $this->classKey::getCoreNamespaces();
77-
$this->extrasNamespaces = modNamespace::class::getExtrasNamespaces($this->modx);
7875

7976
return $initialized;
8077
}
@@ -221,24 +218,13 @@ public function prepareRow(xPDOObject $object)
221218
$isCoreNamespace = $object->isCoreNamespace($namespaceName);
222219

223220
$namespaceData['reserved'] = ['name' => $this->coreNamespaces];
224-
$namespaceData['isProtected'] = true;
225-
$namespaceData['isExtrasNamespace'] = in_array($namespaceName, $this->extrasNamespaces);
226-
227-
switch (true) {
228-
case $namespaceData['isExtrasNamespace']:
229-
$namespaceData['creator'] = $this->modx->lexicon('package_extra');
230-
break;
231-
case $isCoreNamespace:
232-
$namespaceData['creator'] = 'modx';
233-
break;
234-
default:
235-
$namespaceData['creator'] = $this->modx->lexicon('user');
236-
$namespaceData['isProtected'] = false;
237-
}
238-
$namespaceData['creator'] = strtolower($namespaceData['creator']);
221+
$namespaceData['isProtected'] = $isCoreNamespace
222+
? true
223+
: false
224+
;
239225

240-
// Core and Extras paths should only be editable via the installation process
241-
if ($isCoreNamespace || $namespaceData['isExtrasNamespace']) {
226+
// Core paths should only be editable via the installation process
227+
if ($isCoreNamespace) {
242228
$permissions = [];
243229
}
244230
$namespaceData['permissions'] = $permissions;

core/src/Revolution/modNamespace.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -181,24 +181,6 @@ public function findPolicy($context = '')
181181
return $policy;
182182
}
183183

184-
public static function getExtrasNamespaces(modX $modx): array
185-
{
186-
$namespaceList = [];
187-
188-
$c = $modx->newQuery(modTransportPackage::class);
189-
$c->select([
190-
'name' => 'DISTINCT SUBSTRING_INDEX(`signature`,"-",1)'
191-
]);
192-
$namespaces = $modx->getIterator(modTransportPackage::class, $c);
193-
$namespaces->rewind();
194-
if ($namespaces->valid()) {
195-
foreach ($namespaces as $namespace) {
196-
$namespaceList[] = $namespace->get('name');
197-
}
198-
}
199-
return $namespaceList;
200-
}
201-
202184
/**
203185
* Returns a list of core Namespaces
204186
*

manager/assets/modext/widgets/system/modx.grid.dashboard.widgets.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ MODx.grid.DashboardWidgets = function(config = {}) {
2828
'content',
2929
'namespace',
3030
'lexicon',
31-
'size',
32-
'creator'
31+
'size'
3332
],
3433
paging: true,
3534
remoteSort: true,
@@ -81,8 +80,7 @@ MODx.grid.DashboardWidgets = function(config = {}) {
8180
},
8281
scope: this
8382
}
84-
},
85-
this.getCreatorColumnConfig('dashboard')
83+
}
8684
],
8785
tbar: [
8886
this.getCreateButton('dashboard', 'createDashboard'),

manager/assets/modext/workspace/namespace/modx.namespace.panel.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ MODx.grid.Namespace = function(config = {}) {
6262
'name',
6363
'path',
6464
'assets_path',
65-
'perm',
66-
'creator'
65+
'perm'
6766
],
6867
anchor: '100%',
6968
paging: true,
@@ -101,7 +100,7 @@ MODx.grid.Namespace = function(config = {}) {
101100
// eslint-disable-next-line no-param-reassign
102101
metaData.css = this.setEditableCellClasses(
103102
record,
104-
[record.json.isProtected, record.json.isExtrasNamespace],
103+
[record.json.isProtected],
105104
'',
106105
false
107106
);
@@ -122,16 +121,15 @@ MODx.grid.Namespace = function(config = {}) {
122121
// eslint-disable-next-line no-param-reassign
123122
metaData.css = this.setEditableCellClasses(
124123
record,
125-
[record.json.isProtected, record.json.isExtrasNamespace],
124+
[record.json.isProtected],
126125
'',
127126
false
128127
);
129128
return value;
130129
},
131130
scope: this
132131
}
133-
},
134-
this.getCreatorColumnConfig('namespace')
132+
}
135133
],
136134
tbar: [
137135
this.getCreateButton('namespace', {
@@ -157,7 +155,7 @@ MODx.grid.Namespace = function(config = {}) {
157155

158156
this.on({
159157
beforeedit: function(e) {
160-
if (!this.userCanEditRecord(e.record) || e.record.json.isProtected || e.record.json.isExtrasNamespace) {
158+
if (!this.userCanEditRecord(e.record) || e.record.json.isProtected) {
161159
return false;
162160
}
163161
}

0 commit comments

Comments
 (0)