summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDj Padzensky <djpadz@padz.net>2016-07-19 19:16:07 -0700
committerDj Padzensky <djpadz@padz.net>2016-07-19 19:16:07 -0700
commit57f66cc855458d9fd76c9a3073de2852a6e0712f (patch)
tree65e6bf1acc728b36836ff14847304da87565cc09 /app
parentd9d37882228771bca0c7f53f5ffcef90ba7ac1c5 (diff)
ProjectPermissionController: make sure groups don't exist before creating them
Adding logic to check for a group by external ID, before trying to create it.
Diffstat (limited to 'app')
-rw-r--r--app/Controller/ProjectPermissionController.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/Controller/ProjectPermissionController.php b/app/Controller/ProjectPermissionController.php
index f3ca6ed9..cbcdf77d 100644
--- a/app/Controller/ProjectPermissionController.php
+++ b/app/Controller/ProjectPermissionController.php
@@ -147,7 +147,13 @@ class ProjectPermissionController extends BaseController
$values = $this->request->getValues();
if (empty($values['group_id']) && ! empty($values['external_id'])) {
- $values['group_id'] = $this->groupModel->create($values['name'], $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']);
+ }
}
if ($this->projectGroupRoleModel->addGroup($project['id'], $values['group_id'], $values['role'])) {