@@ -207,47 +207,57 @@ public function listAllActions($action, $httpVars, $fileVars)
207
207
echo json_encode (array ("LIST " => array (), "HAS_GROUPS " => true ));
208
208
return ;
209
209
}
210
+ if (isSet ($ _SESSION ["ALL_ACTIONS_CACHE " ])){
211
+ $ actions = $ _SESSION ["ALL_ACTIONS_CACHE " ];
212
+ }else {
210
213
211
- $ nodes = AJXP_PluginsService::getInstance ()->searchAllManifests ("//action " , "node " , false , true , true );
212
- $ actions = array ();
213
- foreach ($ nodes as $ node ) {
214
- $ xPath = new DOMXPath ($ node ->ownerDocument );
215
- $ proc = $ xPath ->query ("processing " , $ node );
216
- if (!$ proc ->length ) continue ;
217
- $ txt = $ xPath ->query ("gui/@text " , $ node );
218
- if ($ txt ->length ) {
219
- $ messId = $ txt ->item (0 )->nodeValue ;
220
- } else {
221
- $ messId = "" ;
222
- }
223
- $ parentPlugin = $ node ->parentNode ->parentNode ->parentNode ;
224
- $ pId = $ parentPlugin ->attributes ->getNamedItem ("id " )->nodeValue ;
225
- if (empty ($ pId )) {
226
- $ pId = $ parentPlugin ->nodeName .". " ;
227
- if ($ pId == "ajxpdriver. " ) $ pId = "access. " ;
228
- $ pId .= $ parentPlugin ->attributes ->getNamedItem ("name " )->nodeValue ;
229
- }
230
- //echo($pId." : ". $node->attributes->getNamedItem("name")->nodeValue . " (".$messId.")<br>");
231
- if (!is_array ($ actions [$ pId ])) $ actions [$ pId ] = array ();
232
- $ actionName = $ node ->attributes ->getNamedItem ("name " )->nodeValue ;
233
- $ actions [$ pId ][$ actionName ] = array ( "action " => $ actionName , "label " => $ messId );
234
-
235
- }
236
- ksort ($ actions , SORT_STRING );
237
- foreach ($ actions as $ actPid => $ actionGroup ) {
238
- ksort ($ actionGroup , SORT_STRING );
239
- $ actions [$ actPid ] = array ();
240
- foreach ($ actionGroup as $ v ) {
241
- $ actions [$ actPid ][] = $ v ;
214
+ $ nodes = AJXP_PluginsService::getInstance ()->searchAllManifests ("//action " , "node " , false , true , true );
215
+ $ actions = array ();
216
+ foreach ($ nodes as $ node ) {
217
+ $ xPath = new DOMXPath ($ node ->ownerDocument );
218
+ $ proc = $ xPath ->query ("processing " , $ node );
219
+ if (!$ proc ->length ) continue ;
220
+ $ txt = $ xPath ->query ("gui/@text " , $ node );
221
+ if ($ txt ->length ) {
222
+ $ messId = $ txt ->item (0 )->nodeValue ;
223
+ } else {
224
+ $ messId = "" ;
225
+ }
226
+ $ parentPlugin = $ node ->parentNode ->parentNode ->parentNode ;
227
+ $ pId = $ parentPlugin ->attributes ->getNamedItem ("id " )->nodeValue ;
228
+ if (empty ($ pId )) {
229
+ $ pId = $ parentPlugin ->nodeName .". " ;
230
+ if ($ pId == "ajxpdriver. " ) $ pId = "access. " ;
231
+ $ pId .= $ parentPlugin ->attributes ->getNamedItem ("name " )->nodeValue ;
232
+ }
233
+ //echo($pId." : ". $node->attributes->getNamedItem("name")->nodeValue . " (".$messId.")<br>");
234
+ if (!is_array ($ actions [$ pId ])) $ actions [$ pId ] = array ();
235
+ $ actionName = $ node ->attributes ->getNamedItem ("name " )->nodeValue ;
236
+ $ actions [$ pId ][$ actionName ] = array ( "action " => $ actionName , "label " => $ messId );
237
+
238
+ }
239
+ ksort ($ actions , SORT_STRING );
240
+ foreach ($ actions as $ actPid => $ actionGroup ) {
241
+ ksort ($ actionGroup , SORT_STRING );
242
+ $ actions [$ actPid ] = array ();
243
+ foreach ($ actionGroup as $ v ) {
244
+ $ actions [$ actPid ][] = $ v ;
245
+ }
242
246
}
247
+ $ _SESSION ["ALL_ACTIONS_CACHE " ] = $ actions ;
243
248
}
244
249
HTMLWriter::charsetHeader ("application/json " );
245
250
echo json_encode (array ("LIST " => $ actions , "HAS_GROUPS " => true ));
246
251
break ;
247
252
248
253
case "list_all_plugins_parameters " :
249
254
250
- $ actions = $ this ->getEditableParameters (true );
255
+ if (isSet ($ _SESSION ["ALL_PARAMS_CACHE " ])){
256
+ $ actions = $ _SESSION ["ALL_PARAMS_CACHE " ];
257
+ }else {
258
+ $ actions = $ this ->getEditableParameters (true );
259
+ $ _SESSION ["ALL_PARAMS_CACHE " ] = $ actions ;
260
+ }
251
261
HTMLWriter::charsetHeader ("application/json " );
252
262
echo json_encode (array ("LIST " => $ actions , "HAS_GROUPS " => true ));
253
263
break ;
@@ -640,6 +650,7 @@ public function switchAction($action, $httpVars, $fileVars)
640
650
$ repoDetailed [$ repositoryId ] = array (
641
651
"label " => SystemTextEncoding::toUTF8 ($ repositoryObject ->getDisplay ()),
642
652
"driver " => $ repositoryObject ->getAccessType (),
653
+ "scope " => $ repositoryObject ->securityScope (),
643
654
"meta " => $ meta
644
655
);
645
656
}
@@ -1448,7 +1459,7 @@ public function switchAction($action, $httpVars, $fileVars)
1448
1459
}
1449
1460
$ nested = array ();
1450
1461
$ definitions = $ plug ->getConfigsDefinitions ();
1451
- print ("<repository index= \"$ repId \"" );
1462
+ print ("<repository index= \"$ repId \" securityScope= \"" . $ repository -> securityScope (). "\" " );
1452
1463
foreach ($ repository as $ name => $ option ) {
1453
1464
if (strstr ($ name , " " )>-1 ) continue ;
1454
1465
if ($ name == "driverInstance " ) continue ;
@@ -1636,9 +1647,13 @@ public function switchAction($action, $httpVars, $fileVars)
1636
1647
// TODO : WHAT TO DO FOR SUB ADMINS ?
1637
1648
if (isSet ($ httpVars ["permission_mask " ]) && !empty ($ httpVars ["permission_mask " ])){
1638
1649
$ mask = json_decode ($ httpVars ["permission_mask " ], true );
1639
- $ perm = new AJXP_PermissionMask ($ mask );
1640
1650
$ rootGroup = AuthService::getRole ("AJXP_GRP_/ " );
1641
- $ rootGroup ->setMask ($ repId , $ perm );
1651
+ if (count ($ mask )){
1652
+ $ perm = new AJXP_PermissionMask ($ mask );
1653
+ $ rootGroup ->setMask ($ repId , $ perm );
1654
+ }else {
1655
+ $ rootGroup ->clearMask ($ repId );
1656
+ }
1642
1657
AuthService::updateRole ($ rootGroup );
1643
1658
}
1644
1659
ConfService::replaceRepository ($ repId , $ repo );
0 commit comments