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: New features:
* Add setting option to disable private projects
* Add new config option to disable logout * Add new config option to disable logout
Improvements: Improvements:

View File

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

View File

@@ -26,7 +26,12 @@ class Config extends Base
$values += array('password_reset' => 0); $values += array('password_reset' => 0);
break; break;
case 'project': 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; break;
case 'integrations': case 'integrations':
$values += array('integration_gravatar' => 0); $values += array('integration_gravatar' => 0);

View File

@@ -17,11 +17,12 @@ class App extends Base
* *
* @access public * @access public
* @param string $param * @param string $param
* @param mixed $default_value
* @return mixed * @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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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 : ', 'End date: ' => 'Date de fin : ',
'New due date: ' => 'Nouvelle date d\'échéance : ', 'New due date: ' => 'Nouvelle date d\'échéance : ',
'Start date changed: ' => 'Date de début modifiée : ', '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ', 'End date: ' => 'Data final: ',
'New due date: ' => 'Nova data estimada: ', 'New due date: ' => 'Nova data estimada: ',
'Start date changed: ' => 'Data inicio alterada: ', '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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: ' => '', // 'End date: ' => '',
// 'New due date: ' => '', // 'New due date: ' => '',
// 'Start date changed: ' => '', // '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') ?> <?= $this->url->link(t('New project'), 'ProjectCreation', 'create', array(), false, 'popover') ?>
</li> </li>
<?php endif ?> <?php endif ?>
<?php if ($this->app->config('disable_private_project', 0) == 0): ?>
<li> <li>
<i class="fa fa-lock fa-fw"></i> <i class="fa fa-lock fa-fw"></i>
<?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?> <?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?>
</li> </li>
<?php endif ?>
<li> <li>
<i class="fa fa-search fa-fw"></i> <i class="fa fa-search fa-fw"></i>
<?= $this->url->link(t('Search'), 'search', 'index') ?> <?= $this->url->link(t('Search'), 'search', 'index') ?>

View File

@@ -16,6 +16,7 @@
<?= $this->form->text('project_categories', $values, $errors) ?> <?= $this->form->text('project_categories', $values, $errors) ?>
<p class="form-help"><?= t('Example: "Bug, Feature Request, Improvement"') ?></p> <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_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('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) ?> <?= $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')): ?> <?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> <li><i class="fa fa-plus fa-fw"></i><?= $this->url->link(t('New project'), 'ProjectCreation', 'create', array(), false, 'popover') ?></li>
<?php endif ?> <?php endif ?>
<?php if ($this->app->config('disable_private_project', 0) == 0): ?>
<li> <li>
<i class="fa fa-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?> <i class="fa fa-lock fa-fw"></i><?= $this->url->link(t('New private project'), 'ProjectCreation', 'createPrivate', array(), false, 'popover') ?>
</li> </li>
<?php endif ?>
</ul> </ul>
</div> </div>