Sfoglia il codice sorgente

Merge branch 'hotfix/multi_editor_fix'

Olivier Massot 9 mesi fa
parent
commit
99aa9d1696
1 ha cambiato i file con 15 aggiunte e 6 eliminazioni
  1. 15 6
      ot_connect/Classes/Service/OtAuthenticationService.php

+ 15 - 6
ot_connect/Classes/Service/OtAuthenticationService.php

@@ -33,6 +33,8 @@ class OtAuthenticationService extends AbstractAuthenticationService
     CONST GROUP_FE_ALL_UID = 18076;
     CONST GROUP_ADMIN_STANDARD_UID = 1;
     CONST GROUP_ADMIN_PREMIUM_UID = 3;
+    CONST GROUP_EDITOR_STANDARD_UID = 6;
+    CONST GROUP_EDITOR_PREMIUM_UID = 7;
 
     // Cookies' domain needs to be the same that the api's cookies, or guzzle will ignore them.
     CONST COOKIE_DOMAIN = 'opentalent.fr';
@@ -374,12 +376,19 @@ class OtAuthenticationService extends AbstractAuthenticationService
                     continue;
                 }
 
-                if ($isBackend && $accessData['admin_access']) {
-                    $adminGroupUid = $accessData['product'] === 'artist_premium' ?
-                        self::GROUP_ADMIN_PREMIUM_UID :
-                        self::GROUP_ADMIN_STANDARD_UID;
-                    if (!in_array($adminGroupUid, $groupsUid)) {
-                        $groupsUid[] = $adminGroupUid;
+                if ($isBackend) {
+                    if ($accessData['admin_access']) {
+                        $mainGroupUid = $accessData['product'] === 'artist_premium' ?
+                            self::GROUP_ADMIN_PREMIUM_UID :
+                            self::GROUP_ADMIN_STANDARD_UID;
+                    } else {
+                        $mainGroupUid = $accessData['product'] === 'artist_premium' ?
+                            self::GROUP_EDITOR_PREMIUM_UID :
+                            self::GROUP_EDITOR_STANDARD_UID;
+                    }
+
+                    if (!in_array($mainGroupUid, $groupsUid)) {
+                        $groupsUid[] = $mainGroupUid;
                     }
                 }