Olivier Massot пре 2 година
родитељ
комит
22dc488e3f

+ 1 - 1
src/ApiResources/Profile/OrganizationProfile.php

@@ -40,7 +40,7 @@ class OrganizationProfile implements ApiResourcesInterface
     #[Groups('access_profile_read')]
     private ?string $website = null;
 
-    /** @var list<string>|null $modules  */
+    /** @var list<string> $modules  */
     #[Groups('access_profile_read')]
     private ?array $modules = [];
 

+ 8 - 6
src/Service/Access/AccessProfileCreator.php

@@ -73,13 +73,14 @@ class AccessProfileCreator
             ->setIsAdminAccess($access->getAdminAccess())
             ->setRoles($this->accessUtils->getAllRoles($access))
             ->setHistorical($access->getHistorical())
-            ->setOrganization($this->organizationProfileCreator->createCompleteOrganizationProfile($access->getOrganization()))
+            ->setOrganization(
+                $this->organizationProfileCreator->createCompleteOrganizationProfile($access->getOrganization())
+            )
             ->setIsGuardian(!$access->getChildren()->isEmpty())
             ->setIsPayor(
                 !$access->getBillingPayers()->isEmpty() ||
                 ($access->getBillingReceivers()->isEmpty() && $access->getChildren()->isEmpty() && !$access->getAccessIntangibles()->isEmpty())
-            )
-            ;
+            );
     }
 
     /**
@@ -99,7 +100,8 @@ class AccessProfileCreator
             ->setActivityYear($access->getActivityYear())
             ->setAvatarId($access->getPerson()->getImage()?->getId())
             ->setIsSuperAdminAccess($access->getSuperAdminAccess())
-            ->setOrganization($this->organizationProfileCreator->createLightOrganizationProfile($access->getOrganization()))
-            ;
+            ->setOrganization(
+                $this->organizationProfileCreator->createLightOrganizationProfile($access->getOrganization())
+            );
     }
-}
+}

+ 2 - 1
src/Service/Organization/Utils.php

@@ -211,6 +211,7 @@ class Utils
      * @return bool
      */
     public function hasModule(Organization $organization, string $module): bool {
-        return (($organization->getSettings()->getModules() ?? [])[$module]) ?? false === true;
+        $modules = $organization->getSettings()->getModules();
+        return !empty($modules) && in_array($module, $modules);
     }
 }