I have a situation where each of the clients has users and each user can access to information about one or more branches.
We also have sys admins who can see everything and in database don't have any sites assigned to them. It just says the user is sys admin, so our system does not restrict the access.

I need to make a database query where I extract the list of branches the user has access to, but if the user is sys admin, I want to extract the list of all branches in the system.

I was trying something like this, but it does not work:

```sql
Select sites.name, sites.id
FROM sites
WHERE
sites.id IN (
    CASE 
      WHEN (select u.level FROM users "u" WHERE u.username = 'JohnBrown') ='ROLE_SYSTEM_ADMIN'
    THEN
       (select id FROM sites)
    ELSE
       (select s2.id FROM users_have_sites uhs2
                            left join users u2 ON u2.id = uhs2.user_id
                            left join sites s2 ON s2.id = uhs2.site_id
                            where u2.username = 'JonhBrown')
    END
)

```

I am getting this error: 
`ERROR: more than one row returned by a subquery used as an expression`