| @@ -4,9 +4,8 @@ | ||
| 4 | 4 | |
| 5 | 5 | namespace UserAccessManager\ObjectMembership; |
| 6 | 6 | |
| 7 | 7 | use Exception; |
| 8 | -use UserAccessManager\ObjectMembership\Exception\MissingObjectTypeException; | |
| 9 | 8 | use UserAccessManager\UserGroup\AbstractUserGroup; |
| 10 | 9 | use UserAccessManager\UserGroup\AssignmentInformation; |
| 11 | 10 | use UserAccessManager\UserGroup\AssignmentInformationFactory; |
| 12 | 11 | |
| @@ -24,9 +23,9 @@ | ||
| 24 | 23 | throw new MissingObjectTypeException('Missing general object type, Object type must be set.'); |
| 25 | 24 | } |
| 26 | 25 | } |
| 27 | 26 | |
| 28 | - abstract public function getObjectName(int|string|null $objectId, string &$typeName = ''): int|string; | |
| 27 | + abstract public function getObjectName(int|string $objectId, string &$typeName = ''): int|string; | |
| 29 | 28 | |
| 30 | 29 | public function getGeneralObjectType(): string |
| 31 | 30 | { |
| 32 | 31 | return $this->generalObjectType; |
| @@ -38,9 +37,10 @@ | ||
| 38 | 37 | } |
| 39 | 38 | |
| 40 | 39 | public function handlesObject(mixed $objectType): bool |
| 41 | 40 | { |
| 42 | - return isset($this->getHandledObjects()[$objectType]); | |
| 41 | + $objectTypes = $this->getHandledObjects(); | |
| 42 | + return isset($objectTypes[$objectType]); | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | protected function assignRecursiveMembership( |
| 46 | 46 | ?AssignmentInformation &$assignmentInformation, |
| @@ -67,11 +67,15 @@ | ||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | protected function getSimpleAssignedObjects(AbstractUserGroup $userGroup, string $objectType): array |
| 70 | 70 | { |
| 71 | + $objects = $userGroup->getAssignedObjects($objectType); | |
| 72 | + | |
| 71 | 73 | return array_map( |
| 72 | - fn(AssignmentInformation $assignmentInformation) => $assignmentInformation->getType(), | |
| 73 | - $userGroup->getAssignedObjects($objectType) | |
| 74 | + function (AssignmentInformation $element) { | |
| 75 | + return $element->getType(); | |
| 76 | + }, | |
| 77 | + $objects | |
| 74 | 78 | ); |
| 75 | 79 | } |
| 76 | 80 | |
| 77 | 81 | abstract public function isMember( |
| @@ -76,9 +80,9 @@ | ||
| 76 | 80 | |
| 77 | 81 | abstract public function isMember( |
| 78 | 82 | AbstractUserGroup $userGroup, |
| 79 | 83 | bool $lockRecursive, |
| 80 | - int|string|null $objectId, | |
| 84 | + int|string $objectId, | |
| 81 | 85 | ?AssignmentInformation &$assignmentInformation = null |
| 82 | 86 | ): bool; |
| 83 | 87 | |
| 84 | 88 | abstract public function getFullObjects( |