@@ -683,6 +683,26 @@ public function switchAction($action, $httpVars, $fileVars)
683
683
}
684
684
} else if (isSet ($ groupPath )) {
685
685
$ data ["GROUP " ] = array ("PATH " => $ groupPath , "LABEL " => $ groupLabel );
686
+ if ($ roleId != "AJXP_GRP_/ " ){
687
+ $ parentGroupRoles = array ();
688
+ $ parentPath = AJXP_Utils::forwardSlashDirname ($ roleId );
689
+ while ($ parentPath != "AJXP_GRP_ " ){
690
+ $ parentRole = AuthService::getRole ($ parentPath );
691
+ if ($ parentRole != null ) {
692
+ array_unshift ($ parentGroupRoles , $ parentRole );
693
+ }
694
+ $ parentPath = AJXP_Utils::forwardSlashDirname ($ parentPath );
695
+ }
696
+ $ rootGroup = AuthService::getRole ("AJXP_GRP_/ " );
697
+ if ($ rootGroup != null ) array_unshift ($ parentGroupRoles , $ rootGroup );
698
+ if (count ($ parentGroupRoles )){
699
+ $ parentRole = clone array_shift ($ parentGroupRoles );
700
+ foreach ($ parentGroupRoles as $ pgRole ){
701
+ $ parentRole = $ pgRole ->override ($ parentRole );
702
+ }
703
+ $ data ["PARENT_ROLE " ] = $ parentRole ->getDataArray ();
704
+ }
705
+ }
686
706
}
687
707
688
708
@@ -1562,7 +1582,23 @@ public function switchAction($action, $httpVars, $fileVars)
1562
1582
$ repId = $ httpVars ["repository_id " ];
1563
1583
$ repo = ConfService::getRepositoryById ($ repId );
1564
1584
if (!$ repo ->isWriteable ()){
1565
- throw new Exception ("This workspace is not writeable. Please edit directly the conf/bootstrap_repositories.php file. " );
1585
+ if (isSet ($ httpVars ["permission_mask " ]) && !empty ($ httpVars ["permission_mask " ])){
1586
+ $ mask = json_decode ($ httpVars ["permission_mask " ], true );
1587
+ $ rootGroup = AuthService::getRole ("AJXP_GRP_/ " );
1588
+ if (count ($ mask )){
1589
+ $ perm = new AJXP_PermissionMask ($ mask );
1590
+ $ rootGroup ->setMask ($ repId , $ perm );
1591
+ }else {
1592
+ $ rootGroup ->clearMask ($ repId );
1593
+ }
1594
+ AuthService::updateRole ($ rootGroup );
1595
+ AJXP_XMLWriter::header ();
1596
+ AJXP_XMLWriter::sendMessage ("The permission mask was updated for this workspace " , null );
1597
+ AJXP_XMLWriter::close ();
1598
+ break ;
1599
+ }else {
1600
+ throw new Exception ("This workspace is not writeable. Please edit directly the conf/bootstrap_repositories.php file. " );
1601
+ }
1566
1602
}
1567
1603
$ res = 0 ;
1568
1604
if (isSet ($ httpVars ["newLabel " ])) {
@@ -2203,6 +2239,20 @@ public function listUsers($root, $child, $hashValue = null, $returnNodes = false
2203
2239
$ users = AuthService::listUsers ($ baseGroup , "" , -1 , -1 , true , false );
2204
2240
$ groups = AuthService::listChildrenGroups ($ baseGroup );
2205
2241
}
2242
+
2243
+ if ($ this ->getName () == "ajxp_admin " && $ baseGroup == "/ " && $ hashValue == 1 ){
2244
+ $ nodeKey = "/data/ " .$ root ."/ " ;
2245
+ $ meta = array (
2246
+ "icon " => "users-folder.png " ,
2247
+ "icon_class " => "icon-home " ,
2248
+ "ajxp_mime " => "group " ,
2249
+ "object_id " => "/ "
2250
+ );
2251
+ $ xml = AJXP_XMLWriter::renderNode ($ nodeKey , "Root Group " , true , $ meta , true , false );
2252
+ if (!$ returnNodes ) print ($ xml );
2253
+ else $ allNodes [$ nodeKey ] = $ xml ;
2254
+ }
2255
+
2206
2256
foreach ($ groups as $ groupId => $ groupLabel ) {
2207
2257
2208
2258
$ nodeKey = "/data/ " .$ root ."/ " .ltrim ($ groupId ,"/ " );
@@ -2307,7 +2357,7 @@ public function listRoles($root, $child, $hashValue = null, $returnNodes = false
2307
2357
if (!AuthService::usersEnabled ()) return array ();
2308
2358
$ roles = AuthService::getRolesList (array (), !$ this ->listSpecialRoles );
2309
2359
ksort ($ roles );
2310
- if (!$ this ->listSpecialRoles ){
2360
+ if (!$ this ->listSpecialRoles && ! $ this -> getName () == " ajxp_admin " ){
2311
2361
$ rootGroupRole = AuthService::getRole ("AJXP_GRP_/ " , true );
2312
2362
if ($ rootGroupRole ->getLabel () == "AJXP_GRP_/ " ){
2313
2363
$ rootGroupRole ->setLabel ("Root Group " );
0 commit comments