Add setting option to disable private projects

This commit is contained in:
Frederic Guillot 2016-02-13 12:39:49 -05:00
parent 5d20b93b3a
commit 567d623446
31 changed files with 91 additions and 3 deletions

View File

@ -3,6 +3,7 @@ Version 1.0.26 (unreleased)
New features:
* Add setting option to disable private projects
* Add new config option to disable logout
Improvements:

View File

@ -38,6 +38,10 @@ class Me extends Base
public function createMyPrivateProject($name, $description = null)
{
if ($this->config->get('disable_private_project', 0) == 1) {
return false;
}
$values = array(
'name' => $name,
'description' => $description,

View File

@ -26,7 +26,12 @@ class Config extends Base
$values += array('password_reset' => 0);
break;
case 'project':
$values += array('subtask_restriction' => 0, 'subtask_time_tracking' => 0, 'cfd_include_closed_tasks' => 0);
$values += array(
'subtask_restriction' => 0,
'subtask_time_tracking' => 0,
'cfd_include_closed_tasks' => 0,
'disable_private_project' => 0,
);
break;
case 'integrations':
$values += array('integration_gravatar' => 0);

View File

@ -17,11 +17,12 @@ class App extends Base
*
* @access public
* @param string $param
* @param mixed $default_value
* @return mixed
*/
public function config($param)
public function config($param, $default_value = '')
{
return $this->config->get($param);
return $this->config->get($param, $default_value);
}
/**

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1121,4 +1121,7 @@ return array(
'End date: ' => 'Date de fin : ',
'New due date: ' => 'Nouvelle date d\'échéance : ',
'Start date changed: ' => 'Date de début modifiée : ',
'Disable private projects' => 'Désactiver les projets privés',
'Do you really want to remove this custom filter: "%s"?' => 'Voulez-vous vraiment supprimer ce filtre personalisé : « %s » ?',
'Remove a custom filter' => 'Supprimer un filtre personalisé',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
'End date: ' => 'Data final: ',
'New due date: ' => 'Nova data estimada: ',
'Start date changed: ' => 'Data inicio alterada: ',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -1118,4 +1118,7 @@ return array(
// 'End date: ' => '',
// 'New due date: ' => '',
// 'Start date changed: ' => '',
// 'Disable private projects' => '',
// 'Do you really want to remove this custom filter: "%s"?' => '',
// 'Remove a custom filter' => '',
);

View File

@ -7,10 +7,12 @@
<?= $this->url->link(t('New project'), 'ProjectCreation', 'create', array(), false, 'popover') ?>
</li>
<?php endif ?>
<?php if ($this->app->config('disable_private_project', 0) == 0): ?>
<li>
<i class="fa fa-lock fa-fw"></i>
<?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?>
</li>
<?php endif ?>
<li>
<i class="fa fa-search fa-fw"></i>
<?= $this->url->link(t('Search'), 'search', 'index') ?>

View File

@ -16,6 +16,7 @@
<?= $this->form->text('project_categories', $values, $errors) ?>
<p class="form-help"><?= t('Example: "Bug, Feature Request, Improvement"') ?></p>
<?= $this->form->checkbox('disable_private_project', t('Disable private projects'), 1, isset($values['disable_private_project']) && $values['disable_private_project'] == 1) ?>
<?= $this->form->checkbox('subtask_restriction', t('Allow only one subtask in progress at the same time for a user'), 1, $values['subtask_restriction'] == 1) ?>
<?= $this->form->checkbox('subtask_time_tracking', t('Trigger automatically subtask time tracking'), 1, $values['subtask_time_tracking'] == 1) ?>
<?= $this->form->checkbox('cfd_include_closed_tasks', t('Include closed tasks in the cumulative flow diagram'), 1, $values['cfd_include_closed_tasks'] == 1) ?>

View File

@ -44,9 +44,11 @@
<?php if ($this->user->hasAccess('ProjectCreation', 'create')): ?>
<li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New project'), 'ProjectCreation', 'create', array(), false, 'popover') ?></li>
<?php endif ?>
<?php if ($this->app->config('disable_private_project', 0) == 0): ?>
<li>
<i class="fa fa-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?>
</li>
<?php endif ?>
</ul>
</div>