@@ -624,6 +624,20 @@ public function switchAction($action, $httpVars, $fileVars)
624
624
HTMLWriter::charsetHeader ("application/json " );
625
625
$ roleData = $ role ->getDataArray (true );
626
626
$ allReps = ConfService::getRepositoriesList ("all " , false );
627
+ $ sharedRepos = array ();
628
+ if (isSet ($ userObject )){
629
+ // Add User shared Repositories as well
630
+ $ acls = $ userObject ->mergedRole ->listAcls ();
631
+ if (count ($ acls )) {
632
+ $ sharedRepos = ConfService::getConfStorageImpl ()->listRepositoriesWithCriteria (array (
633
+ "uuid " => array_keys ($ acls ),
634
+ "parent_uuid " => AJXP_FILTER_NOT_EMPTY ,
635
+ "owner_user_id " => AJXP_FILTER_NOT_EMPTY
636
+ ));
637
+ $ allReps = array_merge ($ allReps , $ sharedRepos );
638
+ }
639
+ }
640
+
627
641
$ repos = array ();
628
642
$ repoDetailed = array ();
629
643
// USER
@@ -642,7 +656,6 @@ public function switchAction($action, $httpVars, $fileVars)
642
656
)){
643
657
continue ;
644
658
}
645
- $ repos [$ repositoryId ] = SystemTextEncoding::toUTF8 ($ repositoryObject ->getDisplay ());
646
659
$ meta = array ();
647
660
if ($ repositoryObject ->getOption ("META_SOURCES " ) != null ){
648
661
$ meta = array_keys ($ repositoryObject ->getOption ("META_SOURCES " ));
@@ -653,6 +666,28 @@ public function switchAction($action, $httpVars, $fileVars)
653
666
"scope " => $ repositoryObject ->securityScope (),
654
667
"meta " => $ meta
655
668
);
669
+
670
+ if (array_key_exists ($ repositoryId , $ sharedRepos )){
671
+ $ sharedRepos [$ repositoryId ] = SystemTextEncoding::toUTF8 ($ repositoryObject ->getDisplay ());
672
+ $ repoParentLabel = $ repoParentId = $ repositoryObject ->getParentId ();
673
+ $ repoOwnerLabel = $ repoOwnerId = $ repositoryObject ->getOwner ();
674
+ if (isSet ($ allReps [$ repoParentId ])){
675
+ $ repoParentLabel = SystemTextEncoding::toUTF8 ($ allReps [$ repoParentId ]->getDisplay ());
676
+ }
677
+ $ ownerObject = ConfService::getConfStorageImpl ()->createUserObject ($ repoOwnerId );
678
+ if (isSet ($ ownerObject )){
679
+ $ repoOwnerLabel = $ ownerObject ->personalRole ->filterParameterValue ("core.conf " , "USER_DISPLAY_NAME " , AJXP_REPO_SCOPE_ALL , $ repoOwnerId );
680
+ }
681
+ $ repoDetailed [$ repositoryId ]["share " ] = array (
682
+ "parent_user " => $ repoOwnerId ,
683
+ "parent_user_label " => $ repoOwnerLabel ,
684
+ "parent_repository " => $ repoParentId ,
685
+ "parent_repository_label " => $ repoParentLabel
686
+ );
687
+ }else {
688
+ $ repos [$ repositoryId ] = SystemTextEncoding::toUTF8 ($ repositoryObject ->getDisplay ());
689
+ }
690
+
656
691
}
657
692
// Make sure it's utf8
658
693
$ data = array (
@@ -663,6 +698,7 @@ public function switchAction($action, $httpVars, $fileVars)
663
698
"GLOBAL_PLUGINS " => array ("action.avatar " , "action.disclaimer " , "action.scheduler " , "action.skeleton " , "action.updater " )
664
699
),
665
700
"REPOSITORIES " => $ repos ,
701
+ "SHARED_REPOSITORIES " => $ sharedRepos ,
666
702
"REPOSITORIES_DETAILS " => $ repoDetailed ,
667
703
"PROFILES " => array ("standard|Standard " ,"admin|Administrator " ,"shared|Shared " ,"guest|Guest " )
668
704
)
0 commit comments