"SELECT name FROM users WHERE users.name = 'Ivan' AND permissions.name= 'auth-site'"
SELECT users.name FROM users
LEFT JOIN user_roles ON user_roles.user_fk = users.user_id
LEFT JOIN role_permissions ON user_roles.role_fk = role_permissions.permission_fk, permissions
WHERE users.name='Ivan' AND permissions.name= 'auth-site'
SELECT users.name, permissions.name perm from users
inner join user_roles
on users.user_id=user_roles.user_fk
inner join roles
on roles.role_id=user_roles.role_fk
inner join role_permissions
on roles.role_id=role_permissions.role_fk
inner join permissions
on permissions.permission_id=role_permissions.permission_fk
having users.name='Ivan' and perm='auth-site'
SELECT
users.name
FROM users
INNER JOIN user_roles
ON user_roles.user_fk = users.user_id
INNER JOIN role_permissions
ON user_roles.role_fk = role_permissions.permission_fk
INNER JOIN permissions
ON user_roles.role_permission_id = permissions.id
WHERE
users.name='Ivan' AND permissions.name= 'auth-site'