Futa Arai 2 лет назад
Родитель
Сommit
6fbe3bb446

+ 5 - 4
apps/app/src/features/external-user-group/server/routes/apiv3/external-user-group.ts

@@ -323,16 +323,17 @@ module.exports = (crowi: Crowi): Router => {
 
     try {
       await crowi.ldapUserGroupSyncService?.init(req.user.name, req.body.password);
-      // Do not await for sync to finish. Result (completed, failed) will be notified to the client by socket-io.
-      crowi.ldapUserGroupSyncService?.syncExternalUserGroups();
-
-      return res.apiv3({}, 202);
     }
     catch (e) {
       return res.apiv3Err(
         new ErrorV3('LDAP group sync failed', 'external_user_group.sync_failed'), 500,
       );
     }
+
+    // Do not await for sync to finish. Result (completed, failed) will be notified to the client by socket-io.
+    crowi.ldapUserGroupSyncService?.syncExternalUserGroups();
+
+    return res.apiv3({}, 202);
   });
 
   router.put('/keycloak/sync', loginRequiredStrictly, adminRequired, async(req: AuthorizedRequest, res: ApiV3Response) => {