summaryrefslogtreecommitdiff
path: root/app/Template/project
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-12-11 20:51:40 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-12-11 20:51:40 -0500
commit76019d76287f174cb6bf81fe052dc5c5c53be46c (patch)
tree51398e06b6a96b9b91e4a90ce7871d44f93a4a70 /app/Template/project
parent0cd31abbc4e520d93bc4a0f5480dc898bbe5f25b (diff)
Add project owner support (allow user management to a regular user), see #316
Diffstat (limited to 'app/Template/project')
-rw-r--r--app/Template/project/layout.php2
-rw-r--r--app/Template/project/sidebar.php4
-rw-r--r--app/Template/project/users.php10
3 files changed, 13 insertions, 3 deletions
diff --git a/app/Template/project/layout.php b/app/Template/project/layout.php
index 27a93021..19fe32b9 100644
--- a/app/Template/project/layout.php
+++ b/app/Template/project/layout.php
@@ -7,7 +7,7 @@
</div>
<section class="sidebar-container" id="project-section">
- <?= Helper\template('project/sidebar', array('project' => $project)) ?>
+ <?= Helper\template('project/sidebar', array('project' => $project, 'is_owner' => $is_owner)) ?>
<div class="sidebar-content">
<?= $project_content_for_layout ?>
diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php
index 376a1427..ef591d2e 100644
--- a/app/Template/project/sidebar.php
+++ b/app/Template/project/sidebar.php
@@ -18,11 +18,13 @@
<li>
<?= Helper\a(t('Category management'), 'category', 'index', array('project_id' => $project['id'])) ?>
</li>
- <?php if (Helper\is_admin()): ?>
+ <?php endif ?>
+ <?php if ((Helper\is_admin() || $is_owner) && $project['is_private'] == 0): ?>
<li>
<?= Helper\a(t('User management'), 'project', 'users', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>
+ <?php if (Helper\is_admin() || $project['is_private']): ?>
<li>
<?= Helper\a(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?>
</li>
diff --git a/app/Template/project/users.php b/app/Template/project/users.php
index 0908533f..3a59df7a 100644
--- a/app/Template/project/users.php
+++ b/app/Template/project/users.php
@@ -15,8 +15,16 @@
<?php foreach ($users['allowed'] as $user_id => $username): ?>
<li>
<strong><?= Helper\escape($username) ?></strong>
+ <?php $is_owner = array_key_exists($user_id, $users['owners']);
+ if ($is_owner): ?> [owner] <?php endif ?>
<?php if ($project['is_private'] == 0): ?>
- (<?= Helper\a(t('revoke'), 'project', 'revoke', array('project_id' => $project['id'], 'user_id' => $user_id), true) ?>)
+ <?php if ($is_owner): ?>
+ (<a href=<?= Helper\u('project', 'setOwner', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 0), true) ?> ><?= t('make user') ?></a>
+ <?php else: ?>
+ (<a href=<?= Helper\u('project', 'setOwner', array('project_id' => $project['id'], 'user_id' => $user_id, 'is_owner' => 1), true) ?> ><?= t('make owner') ?></a>
+ <?php endif ?>
+ or
+ <?= Helper\a(t('revoke'), 'project', 'revoke', array('project_id' => $project['id'], 'user_id' => $user_id), true) ?>)
<?php endif ?>
</li>
<?php endforeach ?>