From 109cb9f672a4ece79e193e834983668189cc1273 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Thu, 9 May 2024 12:36:53 +1000 Subject: [PATCH] Fix 404 error when creating users/groups (#4066) --- src/Api/AdminConsole/Controllers/GroupsController.cs | 4 +++- .../AdminConsole/Controllers/OrganizationUsersController.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Api/AdminConsole/Controllers/GroupsController.cs b/src/Api/AdminConsole/Controllers/GroupsController.cs index 9e5b8ec264..cdbbcf6200 100644 --- a/src/Api/AdminConsole/Controllers/GroupsController.cs +++ b/src/Api/AdminConsole/Controllers/GroupsController.cs @@ -137,7 +137,9 @@ public class GroupsController : Controller } // Flexible Collections - check the user has permission to grant access to the collections for the new group - if (await FlexibleCollectionsIsEnabledAsync(orgId) && _featureService.IsEnabled(FeatureFlagKeys.FlexibleCollectionsV1)) + if (await FlexibleCollectionsIsEnabledAsync(orgId) && + _featureService.IsEnabled(FeatureFlagKeys.FlexibleCollectionsV1) && + model.Collections?.Any() == true) { var collections = await _collectionRepository.GetManyByManyIdsAsync(model.Collections.Select(a => a.Id)); var authorized = diff --git a/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs b/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs index 78127cbfd2..544dbb87a7 100644 --- a/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs +++ b/src/Api/AdminConsole/Controllers/OrganizationUsersController.cs @@ -195,7 +195,9 @@ public class OrganizationUsersController : Controller } // Flexible Collections - check the user has permission to grant access to the collections for the new user - if (await FlexibleCollectionsIsEnabledAsync(orgId) && _featureService.IsEnabled(FeatureFlagKeys.FlexibleCollectionsV1)) + if (await FlexibleCollectionsIsEnabledAsync(orgId) && + _featureService.IsEnabled(FeatureFlagKeys.FlexibleCollectionsV1) && + model.Collections?.Any() == true) { var collections = await _collectionRepository.GetManyByManyIdsAsync(model.Collections.Select(a => a.Id)); var authorized =