summaryrefslogtreecommitdiff
path: root/app/Controller/Base.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/Base.php')
-rw-r--r--app/Controller/Base.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index 8890db4c..462529b1 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -246,4 +246,25 @@ abstract class Base
return $task;
}
+
+ /**
+ * Common method to get a project
+ *
+ * @access protected
+ * @return array
+ */
+ protected function getProject()
+ {
+ $project_id = $this->request->getIntegerParam('project_id');
+ $project = $this->project->getById($project_id);
+
+ if (! $project) {
+ $this->session->flashError(t('Project not found.'));
+ $this->response->redirect('?controller=project');
+ }
+
+ $this->checkProjectPermissions($project['id']);
+
+ return $project;
+ }
}