везапно на тестовой копии со свежей базой wiki мрёт. попозже разберусь и проверю:
CREATE OR REPLACE VIEW jam_authorities AS ((((((((SELECT users.nick AS username, 'ROLE_ADMIN' AS authority FROM users WHERE (users.canmod = true) UNION SELECT users.nick AS username, 'ROLE_SYSADMIN' AS authority FROM users WHERE (users.id = 1)) UNION SELECT users.nick AS username, 'ROLE_TRANSLATE' AS authority FROM users WHERE (users.canmod = true)) UNION SELECT users.nick AS username, 'ROLE_TRANSLATE' AS authority FROM users WHERE (users.canmod = true)) UNION SELECT users.nick AS username, 'ROLE_UPLOAD' AS authority FROM users WHERE (users.id = 1)) UNION SELECT users.nick AS username, 'ROLE_MOVE' AS authority FROM users WHERE (users.id = 1)) UNION SELECT users.nick AS username, 'ROLE_IMPORT' AS authority FROM users WHERE (users.id = 1)) UNION SELECT users.nick AS username, 'ROLE_EDIT_EXISTING' AS authority FROM users WHERE ((NOT users.blocked) AND (users.score >= 0))) UNION SELECT users.nick AS username, 'ROLE_EDIT_NEW' AS authority FROM users WHERE ((NOT users.blocked) AND (users.score >= 0))) UNION SELECT users.nick AS username, 'ROLE_VIEW' AS authority FROM users WHERE ((NOT users.blocked) AND (users.score >= 0));