| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 27 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 26 | public function hasAccess(string $userId, string $permissionName): bool  | 
            ||
| 27 |     { | 
            ||
| 28 | /** @var integer $permissionId */  | 
            ||
| 29 | $permissionId = $this->repositoryRegistry  | 
            ||
| 30 | ->getPermissionRepository()  | 
            ||
| 31 | ->getPermissionIdByName($permissionName);  | 
            ||
| 32 | |||
| 33 |         if ($permissionId === null) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 34 | return false;  | 
            ||
| 35 | }  | 
            ||
| 36 | |||
| 37 | /** @var integer[] $rootRoleIds */  | 
            ||
| 38 | $rootRoleIds = $this->repositoryRegistry  | 
            ||
| 39 | ->getUserRoleRepository()  | 
            ||
| 40 | ->getUserRoleIds($userId);  | 
            ||
| 41 | |||
| 42 |         if (count($rootRoleIds) == 0) { | 
            ||
| 43 | return false;  | 
            ||
| 44 | }  | 
            ||
| 45 | |||
| 46 | $allRoleIds = $this->repositoryRegistry  | 
            ||
| 47 | ->getRoleHierarchyRepository()  | 
            ||
| 48 | ->getAllRoleIdsHierarchy($rootRoleIds);  | 
            ||
| 49 | |||
| 50 | return $this->repositoryRegistry  | 
            ||
| 51 | ->getRolePermissionRepository()  | 
            ||
| 52 | ->isPermissionAssigned($permissionId, $allRoleIds);  | 
            ||
| 53 | }  | 
            ||
| 54 | }  |