Permalink
Browse files

Handle context in listShares()

  • Loading branch information...
1 parent f7b883d commit d8391a7d4fef6e2aff4f76e51d0da6772ffd828a @cdujeu cdujeu committed Jun 7, 2016
@@ -176,15 +176,16 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
}
/**
+ * @param $ctx ContextInterface
* @return array
*/
- public function listMinisites()
+ public function listMinisites(ContextInterface $ctx)
{
/**
* @var ShareCenter $shareCenter
*/
$shareCenter = PluginsService::getInstance()->findPluginById("action.share");
- $publicLets = $shareCenter->listShares(true, null);
+ $publicLets = $shareCenter->listShares($ctx->hasUser() ? $ctx->getUser()->getId() : "shared", null);
$minisites = array();
foreach ($publicLets as $hash => $publicletData) {
if(!isSet($publicletData["AJXP_APPLICATION_BASE"]) && !isSet($publicletData["TRAVEL_PATH_TO_ROOT"])) continue;
@@ -905,7 +905,7 @@ public function switchAction(ServerRequestInterface &$requestInterface, Response
$parentRepoId = isset($httpVars["parent_repository_id"]) ? $httpVars["parent_repository_id"] : "";
$userContext = $httpVars["user_context"];
- $currentUser = true;
+ $currentUser = $ctx->getUser()->getId();
if($userContext == "global" && $ctx->getUser()->isAdmin()){
$currentUser = false;
}else if($userContext == "user" && $ctx->getUser()->isAdmin() && !empty($httpVars["user_id"])){
@@ -1742,17 +1742,11 @@ public function shareNode(ContextInterface $ctx, $ajxpNode, $httpVars, &$update)
* @param null $cursor
* @return array
*/
- public function listShares($currentUser = true, $parentRepositoryId="", $cursor = null){
+ public function listShares($currentUser, $parentRepositoryId="", $cursor = null){
if($currentUser === false){
$crtUser = "";
- }else if(AuthService::usersEnabled()){
- if($currentUser === true){
- $crtUser = AuthService::getLoggedUser()->getId();
- }else{
- $crtUser = $currentUser;
- }
- }else{
- $crtUser = "shared";
+ }else {
+ $crtUser = $currentUser;
}
return $this->getShareStore()->listShares($crtUser, $parentRepositoryId, $cursor);
}
@@ -1766,7 +1760,7 @@ public function listShares($currentUser = true, $parentRepositoryId="", $cursor
* @param bool $xmlPrint
* @return AJXP_Node[]
*/
- public function listSharesAsNodes(ContextInterface $ctx, $rootPath, $currentUser = true, $parentRepositoryId = "", $cursor = null, $xmlPrint = false){
+ public function listSharesAsNodes(ContextInterface $ctx, $rootPath, $currentUser, $parentRepositoryId = "", $cursor = null, $xmlPrint = false){
$shares = $this->listShares($currentUser, $parentRepositoryId, $cursor);
$nodes = array();

0 comments on commit d8391a7

Please sign in to comment.