public function filterUsers($users)
    {
        if ($this->access->hasSuperUserAccess()) {
            return $users;
        }

        if (!$this->access->isUserHasSomeAdminAccess()) {
            // keep only own user if it is in the list
            foreach ($users as $user) {
                if ($this->isOwnLogin($user['login'])) {
                    return array($user);
                }
            }

            return array();
        }

        foreach ($users as $index => $user) {
            if (!$this->isNonSuperUserAllowedToSeeThisLogin($user['login'])) {
                unset($users[$index]);
            }
        }

        return array_values($users);
    }
public function filterUsers($users)
    {
        if ($this->access->hasSuperUserAccess()) {
            return $users;
        }

        if (!$this->access->isUserHasSomeAdminAccess()) {
            // keep only own user if it is in the list
            foreach ($users as $user) {
                if ($this->isOwnLogin($user['login'])) {
                    return array($user);
                }
            }

            return array();
        }

        foreach ($users as $index => $user) {
            if (!$this->isNonSuperUserAllowedToSeeThisLogin($user['login'])) {
                unset($users[$index]);
            }
        }

        return array_values($users);
    }
public function filterUsers ( $ users ) { if ( $ this -> access -> hasSuperUserAccess ( ) ) { return $ users ; } if ( ! $ this -> access -> isUserHasSomeAdminAccess ( ) ) { // keep only own user if it is in the list foreach ( $ users as $ user ) { if ( $ this -> isOwnLogin ( $ user [ 'login' ] ) ) { return array ( $ user ) ; } } return array ( ) ; } foreach ( $ users as $ index => $ user ) { if ( ! $ this -> isNonSuperUserAllowedToSeeThisLogin ( $ user [ 'login' ] ) ) { unset ( $ users [ $ index ] ) ; } } return array_values ( $ users ) ; }
Removes all users from the list of the given users where the current user has no permission to see the existence
of that other user.
@param array $users  An array of arrays. Each inner array must have a key 'login'. Eg:
array(array('login' => 'username1'), array('login' => 'username2'), ...)
@return array
Removes all users from the list of the given users where the current user has no permission to see the existence of that other user .