Skip to content

Commit

Permalink
Updated test suite. Fixed use of RoleInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
visto9259 committed Aug 30, 2024
1 parent 65b524c commit 57b5cd7
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 102 deletions.
12 changes: 1 addition & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,5 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"repositories": [
{
"type": "path",
"url": "../LmcRbacMvc"
},
{
"type": "path",
"url": "../LmcRbac"
}
]
}
}
138 changes: 49 additions & 89 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/Collector/RbacCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@ private function collectGuards(array $guards): void
private function collectIdentityRolesAndPermissions(RoleService $roleService): void
{
$identityRoles = $roleService->getIdentityRoles();
foreach ($identityRoles as $role) {
$iterator = new RecursiveIteratorIterator(
new RecursiveRoleIterator($identityRoles),
RecursiveIteratorIterator::SELF_FIRST
);
foreach ($iterator as $role) {
$roleName = $role->getName();
$this->collectedRoles[] = $roleName;
$this->collectPermissions($role);
/*
if (empty($role->getChildren())) {
$this->collectedRoles[] = $roleName;
} else {
Expand All @@ -140,6 +147,7 @@ private function collectIdentityRolesAndPermissions(RoleService $roleService): v
}
$this->collectPermissions($role);
*/
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/Collector/RbacCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ public function testCanCollect(): void
],
],
'roles' => [
'member' => ['guest'],
'member', 'guest',
// 'member' => ['guest'],
],
'permissions' => [
'member' => ['write', 'delete', 'read'],
Expand Down

0 comments on commit 57b5cd7

Please sign in to comment.