@@ -656,6 +656,12 @@ public function switchAction($action, $httpVars, $fileVars)
656
656
657
657
$ file = AJXP_Utils::decodeSecureMagic ($ httpVars ["file " ]);
658
658
$ node = new AJXP_Node ($ this ->urlBase .$ file );
659
+ $ loggedUser = AuthService::getLoggedUser ();
660
+ if (isSet ($ httpVars ["owner " ]) && $ loggedUser ->isAdmin ()
661
+ && $ loggedUser ->getGroupPath () == "/ " && $ loggedUser ->getId () != AJXP_Utils::sanitize ($ httpVars ["owner " ], AJXP_SANITIZE_EMAILCHARS )){
662
+ // Impersonate the current user
663
+ $ node ->setUser (AJXP_Utils::sanitize ($ httpVars ["owner " ], AJXP_SANITIZE_EMAILCHARS ));
664
+ }
659
665
if (!file_exists ($ node ->getUrl ())){
660
666
$ mess = ConfService::getMessages ();
661
667
throw new Exception (str_replace ('%s ' , "Cannot find file " .$ file , $ mess ["share_center.219 " ]));
@@ -1634,7 +1640,7 @@ public function listSharesAsNodes($rootPath, $currentUser = true, $parentReposit
1634
1640
1635
1641
foreach ($ shares as $ hash => $ shareData ){
1636
1642
1637
- $ icon = "hdd_external_mount.png " ;
1643
+ $ icon = "folder " ;
1638
1644
$ meta = array (
1639
1645
"icon " => $ icon ,
1640
1646
"openicon " => $ icon ,
@@ -1654,16 +1660,28 @@ public function listSharesAsNodes($rootPath, $currentUser = true, $parentReposit
1654
1660
continue ;
1655
1661
}
1656
1662
$ meta ["text " ] = $ repoObject ->getDisplay ();
1657
- $ meta ["share_type_readable " ] = $ repoObject ->hasContentFilter () ? "Publiclet " : ($ shareType == "repository " ? "Workspace " : "Minisite " );
1658
- if (isSet ($ shareData ["LEGACY_REPO_OR_MINI " ])){
1659
- $ meta ["share_type_readable " ] = "Repository or Minisite (legacy) " ;
1663
+ $ permissions = $ this ->getRightsManager ()->computeSharedRepositoryAccessRights ($ repoId , true , null );
1664
+ $ regularUsers = count (array_filter ($ permissions , function ($ a ){
1665
+ return (!isSet ($ a ["HIDDEN " ]) || $ a ["HIDDEN " ] == false );
1666
+ })) > 0 ;
1667
+ $ hiddenUsers = count (array_filter ($ permissions , function ($ a ){
1668
+ return (isSet ($ a ["HIDDEN " ]) && $ a ["HIDDEN " ] == true );
1669
+ })) > 0 ;
1670
+ if ($ regularUsers && $ hiddenUsers ){
1671
+ $ meta ["share_type_readable " ] = "Public Link & Internal Users " ;
1672
+ }elseif ($ regularUsers ){
1673
+ $ meta ["share_type_readable " ] = "Internal Users " ;
1674
+ }else if ($ hiddenUsers ){
1675
+ $ meta ["share_type_readable " ] = "Public Link " ;
1676
+ }else {
1677
+ $ meta ["share_type_readable " ] = $ repoObject ->hasContentFilter () ? "Public Link " : ($ shareType == "repository " ? "Internal Users " : "Public Link " );
1678
+ if (isSet ($ shareData ["LEGACY_REPO_OR_MINI " ])){
1679
+ $ meta ["share_type_readable " ] = "Internal Only " ;
1680
+ }
1660
1681
}
1661
1682
$ meta ["share_data " ] = ($ shareType == "repository " ? 'Shared as workspace: ' .$ repoObject ->getDisplay () : $ this ->getPublicAccessManager ()->buildPublicLink ($ hash ));
1662
1683
$ meta ["shared_element_hash " ] = $ hash ;
1663
1684
$ meta ["owner " ] = $ repoObject ->getOwner ();
1664
- if ($ shareType != "repository " ) {
1665
- $ meta ["copy_url " ] = $ this ->getPublicAccessManager ()->buildPublicLink ($ hash );
1666
- }
1667
1685
$ meta ["shared_element_parent_repository " ] = $ repoObject ->getParentId ();
1668
1686
if (!empty ($ parent )) {
1669
1687
$ parentPath = $ parent ->getOption ("PATH " , false , $ meta ["owner " ]);
@@ -1677,18 +1695,13 @@ public function listSharesAsNodes($rootPath, $currentUser = true, $parentReposit
1677
1695
$ meta ["shared_element_parent_repository_label " ] = $ repoObject ->getParentId ();
1678
1696
}
1679
1697
}
1680
- if ($ shareType != "repository " ){
1681
- if ($ repoObject ->hasContentFilter ()){
1682
- $ meta ["ajxp_shared_minisite " ] = "file " ;
1683
- $ meta ["icon " ] = "mime_empty.png " ;
1684
- $ meta ["original_path " ] = array_pop (array_keys ($ repoObject ->getContentFilter ()->filters ));
1685
- }else {
1686
- $ meta ["ajxp_shared_minisite " ] = "public " ;
1687
- $ meta ["icon " ] = "folder.png " ;
1688
- $ meta ["original_path " ] = $ repoObject ->getOption ("PATH " );
1689
- }
1690
- $ meta ["icon " ] = $ repoObject ->hasContentFilter () ? "mime_empty.png " : "folder.png " ;
1698
+ if ($ repoObject ->hasContentFilter ()){
1699
+ $ meta ["ajxp_shared_minisite " ] = "file " ;
1700
+ $ meta ["icon " ] = "mime_empty.png " ;
1701
+ $ meta ["original_path " ] = array_pop (array_keys ($ repoObject ->getContentFilter ()->filters ));
1691
1702
}else {
1703
+ $ meta ["ajxp_shared_minisite " ] = "public " ;
1704
+ $ meta ["icon " ] = "folder.png " ;
1692
1705
$ meta ["original_path " ] = $ repoObject ->getOption ("PATH " );
1693
1706
}
1694
1707
if (!empty ($ parentPath ) && strpos ($ meta ["original_path " ], $ parentPath ) === 0 ){
0 commit comments