diff options
author | Frédéric Guillot <fred@kanboard.net> | 2018-04-06 14:06:18 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2018-04-06 14:06:18 -0700 |
commit | f6e2dea411246c011d3d1d21d56fda0cf8c3705f (patch) | |
tree | 553bea6d2c5a1fa9fbd9ab2b13d08199e07d0ad5 /app/Controller | |
parent | 0b306fa60ad84ea077111e0ff7b59208ba7bc8a3 (diff) |
Make sure no empty group is submitted on project permissions page
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/ProjectPermissionController.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/Controller/ProjectPermissionController.php b/app/Controller/ProjectPermissionController.php index 3fb6c090..1301285f 100644 --- a/app/Controller/ProjectPermissionController.php +++ b/app/Controller/ProjectPermissionController.php @@ -135,10 +135,14 @@ class ProjectPermissionController extends BaseController $values['group_id'] = $this->groupModel->getOrCreateExternalGroupId($values['name'], $values['external_id']); } - if ($this->projectGroupRoleModel->addGroup($project['id'], $values['group_id'], $values['role'])) { - $this->flash->success(t('Project updated successfully.')); + if (empty($values['group_id'])) { + $this->flash->failure(t('Unable to find this group.')); } else { - $this->flash->failure(t('Unable to update this project.')); + if ($this->projectGroupRoleModel->addGroup($project['id'], $values['group_id'], $values['role'])) { + $this->flash->success(t('Project updated successfully.')); + } else { + $this->flash->failure(t('Unable to update this project.')); + } } $this->response->redirect($this->helper->url->to('ProjectPermissionController', 'index', array('project_id' => $project['id']))); |