From f6e2dea411246c011d3d1d21d56fda0cf8c3705f Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 6 Apr 2018 14:06:18 -0700 Subject: Make sure no empty group is submitted on project permissions page --- app/Controller/ProjectPermissionController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app/Controller/ProjectPermissionController.php') 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']))); -- cgit v1.2.3