summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Action.php4
-rw-r--r--app/Controller/Base.php3
-rw-r--r--app/Controller/Board.php16
-rw-r--r--app/Controller/Project.php10
-rw-r--r--app/Controller/Subtask.php8
-rw-r--r--app/Controller/Task.php10
-rw-r--r--app/Controller/User.php6
7 files changed, 29 insertions, 28 deletions
diff --git a/app/Controller/Action.php b/app/Controller/Action.php
index 0bf8ff0c..64d77aab 100644
--- a/app/Controller/Action.php
+++ b/app/Controller/Action.php
@@ -27,7 +27,7 @@ class Action extends Base
'available_events' => $this->action->getAvailableEvents(),
'available_params' => $this->action->getAllActionParameters(),
'columns_list' => $this->board->getColumnsList($project['id']),
- 'users_list' => $this->project->getUsersList($project['id']),
+ 'users_list' => $this->projectPermission->getUsersList($project['id']),
'projects_list' => $this->project->getList(false),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),
@@ -51,7 +51,7 @@ class Action extends Base
'values' => $values,
'action_params' => $action->getActionRequiredParameters(),
'columns_list' => $this->board->getColumnsList($project['id']),
- 'users_list' => $this->project->getUsersList($project['id']),
+ 'users_list' => $this->projectPermission->getUsersList($project['id']),
'projects_list' => $this->project->getList(false),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index 383b22d1..cc180158 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -26,6 +26,7 @@ use Model\LastLogin;
* @property \Model\LastLogin $lastLogin
* @property \Model\Notification $notification
* @property \Model\Project $project
+ * @property \Model\ProjectPermission $projectPermission
* @property \Model\SubTask $subTask
* @property \Model\Task $task
* @property \Model\TaskHistory $taskHistory
@@ -211,7 +212,7 @@ abstract class Base
{
if ($this->acl->isRegularUser()) {
- if ($project_id > 0 && ! $this->project->isUserAllowed($project_id, $this->acl->getUserId())) {
+ if ($project_id > 0 && ! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
$this->forbidden();
}
}
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index e002ce3b..b56adca0 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -55,11 +55,11 @@ class Board extends Base
{
$task = $this->getTask();
$project = $this->project->getById($task['project_id']);
- $projects = $this->project->getAvailableList($this->acl->getUserId());
+ $projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
$params = array(
'errors' => array(),
'values' => $task,
- 'users_list' => $this->project->getUsersList($project['id']),
+ 'users_list' => $this->projectPermission->getUsersList($project['id']),
'projects' => $projects,
'current_project_id' => $project['id'],
'current_project_name' => $project['name'],
@@ -109,7 +109,7 @@ class Board extends Base
{
$task = $this->getTask();
$project = $this->project->getById($task['project_id']);
- $projects = $this->project->getAvailableList($this->acl->getUserId());
+ $projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
$params = array(
'errors' => array(),
'values' => $task,
@@ -194,7 +194,7 @@ class Board extends Base
$project_id = $last_seen_project_id ?: $favorite_project_id;
if (! $project_id) {
- $projects = $this->project->getAvailableList($this->acl->getUserId());
+ $projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
if (empty($projects)) {
@@ -220,7 +220,7 @@ class Board extends Base
public function show($project_id = 0)
{
$project = $this->getProject($project_id);
- $projects = $this->project->getAvailableList($this->acl->getUserId());
+ $projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
$board_selector = $projects;
unset($board_selector[$project['id']]);
@@ -228,7 +228,7 @@ class Board extends Base
$this->user->storeLastSeenProjectId($project['id']);
$this->response->html($this->template->layout('board_index', array(
- 'users' => $this->project->getUsersList($project['id'], true, true),
+ 'users' => $this->projectPermission->getUsersList($project['id'], true, true),
'filters' => array('user_id' => UserModel::EVERYBODY_ID),
'projects' => $projects,
'current_project_id' => $project['id'],
@@ -394,7 +394,7 @@ class Board extends Base
if ($project_id > 0 && $this->request->isAjax()) {
- if (! $this->project->isUserAllowed($project_id, $this->acl->getUserId())) {
+ if (! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
$this->response->status(401);
}
@@ -433,7 +433,7 @@ class Board extends Base
$project_id = $this->request->getIntegerParam('project_id');
$timestamp = $this->request->getIntegerParam('timestamp');
- if ($project_id > 0 && ! $this->project->isUserAllowed($project_id, $this->acl->getUserId())) {
+ if ($project_id > 0 && ! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
$this->response->text('Not Authorized', 401);
}
diff --git a/app/Controller/Project.php b/app/Controller/Project.php
index 2459f094..7b174ef4 100644
--- a/app/Controller/Project.php
+++ b/app/Controller/Project.php
@@ -206,7 +206,7 @@ class Project extends Base
$this->response->html($this->projectLayout('project_users', array(
'project' => $project,
- 'users' => $this->project->getAllUsers($project['id']),
+ 'users' => $this->projectPermission->getAllUsers($project['id']),
'menu' => 'projects',
'title' => t('Edit project access list')
)));
@@ -220,11 +220,11 @@ class Project extends Base
public function allow()
{
$values = $this->request->getValues();
- list($valid,) = $this->project->validateUserAccess($values);
+ list($valid,) = $this->projectPermission->validateModification($values);
if ($valid) {
- if ($this->project->allowUser($values['project_id'], $values['user_id'])) {
+ if ($this->projectPermission->allowUser($values['project_id'], $values['user_id'])) {
$this->session->flash(t('Project updated successfully.'));
}
else {
@@ -249,11 +249,11 @@ class Project extends Base
'user_id' => $this->request->getIntegerParam('user_id'),
);
- list($valid,) = $this->project->validateUserAccess($values);
+ list($valid,) = $this->projectPermission->validateModification($values);
if ($valid) {
- if ($this->project->revokeUser($values['project_id'], $values['user_id'])) {
+ if ($this->projectPermission->revokeUser($values['project_id'], $values['user_id'])) {
$this->session->flash(t('Project updated successfully.'));
}
else {
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php
index ec2e6948..a103f999 100644
--- a/app/Controller/Subtask.php
+++ b/app/Controller/Subtask.php
@@ -41,7 +41,7 @@ class Subtask extends Base
'task_id' => $task['id'],
),
'errors' => array(),
- 'users_list' => $this->project->getUsersList($task['project_id']),
+ 'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'task' => $task,
'menu' => 'tasks',
'title' => t('Add a sub-task')
@@ -79,7 +79,7 @@ class Subtask extends Base
$this->response->html($this->taskLayout('subtask_create', array(
'values' => $values,
'errors' => $errors,
- 'users_list' => $this->project->getUsersList($task['project_id']),
+ 'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'task' => $task,
'menu' => 'tasks',
'title' => t('Add a sub-task')
@@ -99,7 +99,7 @@ class Subtask extends Base
$this->response->html($this->taskLayout('subtask_edit', array(
'values' => $subtask,
'errors' => array(),
- 'users_list' => $this->project->getUsersList($task['project_id']),
+ 'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'status_list' => $this->subTask->getStatusList(),
'subtask' => $subtask,
'task' => $task,
@@ -136,7 +136,7 @@ class Subtask extends Base
$this->response->html($this->taskLayout('subtask_edit', array(
'values' => $values,
'errors' => $errors,
- 'users_list' => $this->project->getUsersList($task['project_id']),
+ 'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'status_list' => $this->subTask->getStatusList(),
'subtask' => $subtask,
'task' => $task,
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index d958c248..5de25a0e 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -123,7 +123,7 @@ class Task extends Base
),
'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE),
'columns_list' => $this->board->getColumnsList($project_id),
- 'users_list' => $this->project->getUsersList($project_id),
+ 'users_list' => $this->projectPermission->getUsersList($project_id),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project_id),
'menu' => 'tasks',
@@ -169,7 +169,7 @@ class Task extends Base
'values' => $values,
'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE),
'columns_list' => $this->board->getColumnsList($values['project_id']),
- 'users_list' => $this->project->getUsersList($values['project_id']),
+ 'users_list' => $this->projectPermission->getUsersList($values['project_id']),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($values['project_id']),
'menu' => 'tasks',
@@ -199,7 +199,7 @@ class Task extends Base
'values' => $task,
'errors' => array(),
'task' => $task,
- 'users_list' => $this->project->getUsersList($task['project_id']),
+ 'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($task['project_id']),
'ajax' => $this->request->isAjax(),
@@ -248,7 +248,7 @@ class Task extends Base
'errors' => $errors,
'task' => $task,
'columns_list' => $this->board->getColumnsList($values['project_id']),
- 'users_list' => $this->project->getUsersList($values['project_id']),
+ 'users_list' => $this->projectPermission->getUsersList($values['project_id']),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($values['project_id']),
'menu' => 'tasks',
@@ -458,7 +458,7 @@ class Task extends Base
$task = $this->getTask();
$values = $task;
$errors = array();
- $projects_list = $this->project->getAvailableList($this->acl->getUserId());
+ $projects_list = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
unset($projects_list[$task['project_id']]);
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 72ef521c..504f4aed 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -189,7 +189,7 @@ class User extends Base
{
$user = $this->getUser();
$this->response->html($this->layout('user_show', array(
- 'projects' => $this->project->getAvailableList($user['id']),
+ 'projects' => $this->projectPermission->getAllowedProjects($user['id']),
'user' => $user,
)));
}
@@ -252,7 +252,7 @@ class User extends Base
}
$this->response->html($this->layout('user_notifications', array(
- 'projects' => $this->project->getAvailableList($user['id']),
+ 'projects' => $this->projectPermission->getAllowedProjects($user['id']),
'notifications' => $this->notification->readSettings($user['id']),
'user' => $user,
)));
@@ -353,7 +353,7 @@ class User extends Base
$this->response->html($this->layout('user_edit', array(
'values' => $values,
'errors' => $errors,
- 'projects' => $this->project->filterListByAccess($this->project->getList(), $user['id']),
+ 'projects' => $this->projectPermission->getAllowedProjects($user['id']),
'user' => $user,
)));
}