summaryrefslogtreecommitdiff
path: root/app/Controller/Base.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-10-05 19:40:57 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-10-05 19:40:57 -0400
commitd138834dcf902534f78237939926e97fd9a0eebe (patch)
treea6247b9ed98079899c9e21d43044030b69088bee /app/Controller/Base.php
parent7f5a871f84639a90eebd0ac1d0ee7f759e220cf6 (diff)
Regular users are able to create private projects
Diffstat (limited to 'app/Controller/Base.php')
-rw-r--r--app/Controller/Base.php29
1 files changed, 24 insertions, 5 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index 9c1416fc..f24ea8ff 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -209,11 +209,8 @@ abstract class Base
*/
protected function checkProjectPermissions($project_id)
{
- if ($this->acl->isRegularUser()) {
-
- if ($project_id > 0 && ! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
- $this->forbidden();
- }
+ if ($this->acl->isRegularUser() && ! $this->projectPermission->isUserAllowed($project_id, $this->acl->getUserId())) {
+ $this->forbidden();
}
}
@@ -260,6 +257,7 @@ abstract class Base
{
$content = $this->template->load($template, $params);
$params['project_content_for_layout'] = $content;
+ $params['menu'] = 'projects';
return $this->template->layout('project_layout', $params);
}
@@ -304,4 +302,25 @@ abstract class Base
return $project;
}
+
+ /**
+ * Common method to get a project with administration rights
+ *
+ * @access protected
+ * @return array
+ */
+ protected function getProjectManagement()
+ {
+ $project = $this->project->getById($this->request->getIntegerParam('project_id'));
+
+ if (! $project) {
+ $this->notfound();
+ }
+
+ if ($this->acl->isRegularUser() && ! $this->projectPermission->adminAllowed($project['id'], $this->acl->getUserId())) {
+ $this->forbidden();
+ }
+
+ return $project;
+ }
}