Restrict actions for project viewers

This commit is contained in:
Frederic Guillot
2015-12-06 17:39:21 -05:00
parent bd849ff655
commit f0651c48c1
13 changed files with 87 additions and 47 deletions

View File

@@ -15,12 +15,12 @@
'comment' => $comment,
'task' => $task,
'project' => $project,
'not_editable' => isset($not_editable) && $not_editable,
'editable' => $editable,
'is_public' => isset($is_public) && $is_public,
)) ?>
<?php endforeach ?>
<?php if (! isset($not_editable)): ?>
<?php if ($editable): ?>
<?= $this->render('comment/create', array(
'skip_cancel' => true,
'values' => array(

View File

@@ -86,7 +86,7 @@
</li>
<?php endif ?>
<?php if (! isset($not_editable) && $task['recurrence_status'] != \Kanboard\Model\Task::RECURRING_STATUS_NONE): ?>
<?php if ($editable && $task['recurrence_status'] != \Kanboard\Model\Task::RECURRING_STATUS_NONE): ?>
<li>
<strong><?= t('Recurring information') ?></strong>
<?= $this->render('task/recurring_info', array(

View File

@@ -1,33 +1,34 @@
<section id="main" class="public-task">
<?= $this->render('task/details', array('task' => $task, 'project' => $project, 'not_editable' => true)) ?>
<?= $this->render('task/details', array('task' => $task, 'project' => $project, 'editable' => false)) ?>
<p class="pull-right"><?= $this->url->link(t('Back to the board'), 'board', 'readonly', array('token' => $project['token'])) ?></p>
<?= $this->render('task/description', array(
'task' => $task,
'project' => $project,
'is_public' => true
'is_public' => true,
)) ?>
<?= $this->render('tasklink/show', array(
'task' => $task,
'links' => $links,
'project' => $project,
'not_editable' => true
'editable' => false,
'is_public' => true,
)) ?>
<?= $this->render('subtask/show', array(
'task' => $task,
'subtasks' => $subtasks,
'not_editable' => true
'editable' => false
)) ?>
<?= $this->render('task/comments', array(
'task' => $task,
'comments' => $comments,
'project' => $project,
'not_editable' => true,
'editable' => false,
'is_public' => true,
)) ?>

View File

@@ -4,6 +4,7 @@
'recurrence_trigger_list' => $this->task->recurrenceTriggers(),
'recurrence_timeframe_list' => $this->task->recurrenceTimeframes(),
'recurrence_basedate_list' => $this->task->recurrenceBasedates(),
'editable' => $this->user->hasProjectAccess('taskmodification', 'edit', $project['id']),
)) ?>
<?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $project['id'])): ?>
@@ -11,8 +12,34 @@
<?php endif ?>
<?= $this->render('task/description', array('task' => $task)) ?>
<?= $this->render('tasklink/show', array('task' => $task, 'links' => $links, 'link_label_list' => $link_label_list)) ?>
<?= $this->render('subtask/show', array('task' => $task, 'subtasks' => $subtasks, 'project' => $project, 'users_list' => isset($users_list) ? $users_list : array())) ?>
<?= $this->render('tasklink/show', array(
'task' => $task,
'links' => $links,
'link_label_list' => $link_label_list,
'editable' => $this->user->hasProjectAccess('tasklink', 'edit', $project['id']),
'is_public' => false,
)) ?>
<?= $this->render('subtask/show', array(
'task' => $task,
'subtasks' => $subtasks,
'project' => $project,
'users_list' => isset($users_list) ? $users_list : array(),
'editable' => $this->user->hasProjectAccess('subtask', 'edit', $project['id']),
)) ?>
<?= $this->render('task/time_tracking_summary', array('task' => $task)) ?>
<?= $this->render('file/show', array('task' => $task, 'files' => $files, 'images' => $images)) ?>
<?= $this->render('task/comments', array('task' => $task, 'comments' => $comments, 'project' => $project)) ?>
<?= $this->render('file/show', array(
'task' => $task,
'files' => $files,
'images' => $images
)) ?>
<?= $this->render('task/comments', array(
'task' => $task,
'comments' => $comments,
'project' => $project,
'editable' => $this->user->hasProjectAccess('comment', 'edit', $project['id']),
)) ?>