diff options
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Project.php | 13 | ||||
-rw-r--r-- | app/Controller/User.php | 10 |
2 files changed, 17 insertions, 6 deletions
diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 45bc2a46..9309cfae 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -141,8 +141,15 @@ class Project extends Base $project = $this->getProject(); $values = $this->request->getValues(); - if ($project['is_private'] == 1 && $this->userSession->isAdmin() && ! isset($values['is_private'])) { - $values += array('is_private' => 0); + if (isset($values['is_private'])) { + if (! $this->helper->user->isProjectAdministrationAllowed($project['id'])) { + unset($values['is_private']); + } + } + else if ($project['is_private'] == 1 && ! isset($values['is_private'])) { + if ($this->helper->user->isProjectAdministrationAllowed($project['id'])) { + $values += array('is_private' => 0); + } } list($valid, $errors) = $this->project->validateModification($values); @@ -402,7 +409,7 @@ class Project extends Base */ public function create(array $values = array(), array $errors = array()) { - $is_private = $this->request->getIntegerParam('private', $this->userSession->isAdmin() ? 0 : 1); + $is_private = $this->request->getIntegerParam('private', $this->userSession->isAdmin() || $this->userSession->isProjectAdmin() ? 0 : 1); $this->response->html($this->template->layout('project/new', array( 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), diff --git a/app/Controller/User.php b/app/Controller/User.php index 10a3a931..04e57417 100644 --- a/app/Controller/User.php +++ b/app/Controller/User.php @@ -303,12 +303,16 @@ class User extends Base $values = $this->request->getValues(); if ($this->userSession->isAdmin()) { - $values += array('is_admin' => 0); + $values += array('is_admin' => 0, 'is_project_admin' => 0); } else { - + // Regular users can't be admin if (isset($values['is_admin'])) { - unset($values['is_admin']); // Regular users can't be admin + unset($values['is_admin']); + } + + if (isset($values['is_project_admin'])) { + unset($values['is_project_admin']); } } |