← All changes
|
src/ObjectMembership/ObjectMembershipWithMapHandler.php
+31
-2
2.3.13
→
2.2.23
View file →
| @@ -1,5 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * MembershipWithMapHandler.php | |
| 4 | + * | |
| 5 | + * The MembershipWithMapHandler class file. | |
| 6 | + * | |
| 7 | + * PHP versions 5 | |
| 8 | + * | |
| 9 | + * @author Alexander Schneider <alexanderschneider85@gmail.com> | |
| 10 | + * @copyright 2008-2017 Alexander Schneider | |
| 11 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 | |
| 12 | + * @version SVN: $id$ | |
| 13 | + * @link http://wordpress.org/extend/plugins/user-access-manager/ | |
| 14 | + */ | |
| 2 | 15 | |
| 3 | 16 | declare(strict_types=1); |
| 4 | 17 | |
| 5 | 18 | namespace UserAccessManager\ObjectMembership; |
| @@ -8,8 +21,13 @@ | ||
| 8 | 21 | use UserAccessManager\Object\ObjectMapHandler; |
| 9 | 22 | use UserAccessManager\UserGroup\AbstractUserGroup; |
| 10 | 23 | use UserAccessManager\UserGroup\AssignmentInformation; |
| 11 | 24 | |
| 25 | +/** | |
| 26 | + * Class MembershipWithMapHandler | |
| 27 | + * | |
| 28 | + * @package UserAccessManager\UserGroup | |
| 29 | + */ | |
| 12 | 30 | abstract class ObjectMembershipWithMapHandler extends ObjectMembershipHandler |
| 13 | 31 | { |
| 14 | 32 | /** |
| 15 | 33 | * Returns the map. |
| @@ -17,15 +35,21 @@ | ||
| 17 | 35 | */ |
| 18 | 36 | abstract protected function getMap(): array; |
| 19 | 37 | |
| 20 | 38 | /** |
| 39 | + * Uses a map function to resolve the recursive membership. | |
| 40 | + * @param AbstractUserGroup $userGroup | |
| 41 | + * @param bool $lockRecursive | |
| 42 | + * @param int|string $objectId | |
| 43 | + * @param null|AssignmentInformation $assignmentInformation | |
| 44 | + * @return bool | |
| 21 | 45 | * @throws Exception |
| 22 | 46 | */ |
| 23 | 47 | protected function getMembershipByMap( |
| 24 | 48 | AbstractUserGroup $userGroup, |
| 25 | 49 | bool $lockRecursive, |
| 26 | - int|string|null $objectId, | |
| 27 | - ?AssignmentInformation &$assignmentInformation = null | |
| 50 | + $objectId, | |
| 51 | + &$assignmentInformation = null | |
| 28 | 52 | ): bool { |
| 29 | 53 | // Reset value to prevent errors |
| 30 | 54 | $recursiveMembership = []; |
| 31 | 55 | |
| @@ -52,8 +76,13 @@ | ||
| 52 | 76 | return $this->checkAccessWithRecursiveMembership($isMember, $recursiveMembership, $assignmentInformation); |
| 53 | 77 | } |
| 54 | 78 | |
| 55 | 79 | /** |
| 80 | + * Returns the objects by the given type including the children. | |
| 81 | + * @param AbstractUserGroup $userGroup | |
| 82 | + * @param bool $lockRecursive | |
| 83 | + * @param string $objectType | |
| 84 | + * @return array | |
| 56 | 85 | * @throws Exception |
| 57 | 86 | */ |
| 58 | 87 | protected function getFullObjectsByMap(AbstractUserGroup $userGroup, bool $lockRecursive, string $objectType): array |
| 59 | 88 | { |