From 0ae08b394cd4c169768e146f348be544ccca4e0b Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 26 Apr 2015 07:15:17 -0700 Subject: [PATCH] Raise a better error for SSH access by users with no permission to use Diffusion Summary: Fixes T7894. Test Plan: ``` $ git pull phabricator-ssh-exec: You do not have permission to access the Diffusion application, so you can not interact with repositories over SSH. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` Reviewers: btrahan, chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T7894 Differential Revision: https://secure.phabricator.com/D12555 --- .../diffusion/ssh/DiffusionSSHWorkflow.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php index c8345a38d1..5190f8d3d1 100644 --- a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php +++ b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php @@ -112,12 +112,23 @@ abstract class DiffusionSSHWorkflow extends PhabricatorSSHWorkflow { final public function execute(PhutilArgumentParser $args) { $this->args = $args; + $viewer = $this->getUser(); + $have_diffusion = PhabricatorApplication::isClassInstalledForViewer( + 'PhabricatorDiffusionApplication', + $viewer); + if (!$have_diffusion) { + throw new Exception( + pht( + 'You do not have permission to access the Diffusion application, '. + 'so you can not interact with repositories over SSH.')); + } + $repository = $this->identifyRepository(); $this->setRepository($repository); $is_cluster_request = $this->getIsClusterRequest(); $uri = $repository->getAlmanacServiceURI( - $this->getUser(), + $viewer, $is_cluster_request, array( 'ssh',