mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Check if user can create project before showing shortcut
Summary: In Maniphest, we provide an additional caption shortcut if you can create projects, which has no use if you cant. Fixes T6969 Test Plan: Check page with and without a user's capability. Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6969 Differential Revision: https://secure.phabricator.com/D11390
This commit is contained in:
parent
39406bd1f3
commit
498ce937e7
1 changed files with 16 additions and 9 deletions
|
@ -25,6 +25,10 @@ final class ManiphestTaskEditController extends ManiphestController {
|
||||||
ManiphestEditProjectsCapability::CAPABILITY);
|
ManiphestEditProjectsCapability::CAPABILITY);
|
||||||
$can_edit_status = $this->hasApplicationCapability(
|
$can_edit_status = $this->hasApplicationCapability(
|
||||||
ManiphestEditStatusCapability::CAPABILITY);
|
ManiphestEditStatusCapability::CAPABILITY);
|
||||||
|
$can_create_projects = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$user,
|
||||||
|
PhabricatorApplication::getByClass('PhabricatorProjectApplication'),
|
||||||
|
ProjectCreateProjectsCapability::CAPABILITY);
|
||||||
|
|
||||||
$parent_task = null;
|
$parent_task = null;
|
||||||
$template_id = null;
|
$template_id = null;
|
||||||
|
@ -664,6 +668,17 @@ final class ManiphestTaskEditController extends ManiphestController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($can_edit_projects) {
|
if ($can_edit_projects) {
|
||||||
|
$caption = null;
|
||||||
|
if ($can_create_projects) {
|
||||||
|
$caption = javelin_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '/project/create/',
|
||||||
|
'mustcapture' => true,
|
||||||
|
'sigil' => 'project-create',
|
||||||
|
),
|
||||||
|
pht('Create New Project'));
|
||||||
|
}
|
||||||
$form
|
$form
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTokenizerControl())
|
id(new AphrontFormTokenizerControl())
|
||||||
|
@ -671,15 +686,7 @@ final class ManiphestTaskEditController extends ManiphestController {
|
||||||
->setName('projects')
|
->setName('projects')
|
||||||
->setValue($projects_value)
|
->setValue($projects_value)
|
||||||
->setID($project_tokenizer_id)
|
->setID($project_tokenizer_id)
|
||||||
->setCaption(
|
->setCaption($caption)
|
||||||
javelin_tag(
|
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => '/project/create/',
|
|
||||||
'mustcapture' => true,
|
|
||||||
'sigil' => 'project-create',
|
|
||||||
),
|
|
||||||
pht('Create New Project')))
|
|
||||||
->setDatasource(new PhabricatorProjectDatasource()));
|
->setDatasource(new PhabricatorProjectDatasource()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue