postgresql7.1 select user_id from users where acs_permission__permission_p(:context_root_id, user_id, 'admin') = 't' limit 1 select u.user_id, aa.authority_id, u.username from users u, auth_authorities aa where u.authority_id = aa.authority_id and aa.short_name = 'local' limit 1