public function hasAccess(array $url, array $user): bool
    {
        $result = parent::hasAccess($url, $user);

        if (!$result) {
            return $result;
        }

        if (!empty($user['is_supervisor']) && $user['is_supervisor']) {
            $users = Utils::getReportToUsers($user['id']);

            foreach ($users as $userRecord) {
                $result = (new AccessFactory())->hasAccess($url, $userRecord->toArray());

                if ($result) {
                    return $result;
                }
            }
        }

        return false;
    }
public function hasAccess(array $url, array $user): bool
    {
        $result = parent::hasAccess($url, $user);

        if (!$result) {
            return $result;
        }

        if (!empty($user['is_supervisor']) && $user['is_supervisor']) {
            $users = Utils::getReportToUsers($user['id']);

            foreach ($users as $userRecord) {
                $result = (new AccessFactory())->hasAccess($url, $userRecord->toArray());

                if ($result) {
                    return $result;
                }
            }
        }

        return false;
    }
public function hasAccess ( array $ url , array $ user ) : bool { $ result = parent :: hasAccess ( $ url , $ user ) ; if ( ! $ result ) { return $ result ; } if ( ! empty ( $ user [ 'is_supervisor' ] ) && $ user [ 'is_supervisor' ] ) { $ users = Utils :: getReportToUsers ( $ user [ 'id' ] ) ; foreach ( $ users as $ userRecord ) { $ result = ( new AccessFactory ( ) ) -> hasAccess ( $ url , $ userRecord -> toArray ( ) ) ; if ( $ result ) { return $ result ; } } } return false ; }
hasAccess for superviser user

@param mixed[] $url    URL user tries to access for
@param mixed[] $user   user's session data
@return bool true in case of superuser and false if not
hasAccess for superviser user