From 7b100cc57b58a1ef5c2c6cef28904e1ba79f0c49 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Wed, 20 Jul 2016 21:40:27 -0400 Subject: Move logic of PR #2496 to GroupModel --- app/Controller/ProjectPermissionController.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'app/Controller/ProjectPermissionController.php') diff --git a/app/Controller/ProjectPermissionController.php b/app/Controller/ProjectPermissionController.php index cbcdf77d..99f556e8 100644 --- a/app/Controller/ProjectPermissionController.php +++ b/app/Controller/ProjectPermissionController.php @@ -147,13 +147,7 @@ class ProjectPermissionController extends BaseController $values = $this->request->getValues(); if (empty($values['group_id']) && ! empty($values['external_id'])) { - $group = $this->groupModel->getByExternalId($values['external_id']); - if ($group) { - $values['group_id'] = $group['id']; - } - else { - $values['group_id'] = $this->groupModel->create($values['name'], $values['external_id']); - } + $values['group_id'] = $this->groupModel->getOrCreateExternalGroupId($values['name'], $values['external_id']); } if ($this->projectGroupRoleModel->addGroup($project['id'], $values['group_id'], $values['role'])) { -- cgit v1.2.3