Това е, което имам досега...
Не е идеално, но можете да определите дължината на елементите в низа с това...
(SELECT LENGTH(permissions) - LENGTH( REPLACE(permissions, ',', '') ) + 1)
По същество той отчита всички запетаи в низа и ги използва като общия брой предадени perms.
CREATE PROCEDURE has_permission( IN account_id BIGINT, IN permissions TEXT)
BEGIN
SELECT DISTINCT account_id
FROM pp_acl_user_roles ur, pp_acl_role_permissions rp
JOIN pp_acl_permissions p ON rp.permission_id=p.id
WHERE (
ur.account_id = account_id
#check for permission ids OR keys depending on what has been passed in.
AND ( FIND_IN_SET(p.id, permissions) OR FIND_IN_SET(p.key, permissions) )
AND ur.role_id = rp.role_id
)
#ensure we have ALL the permissions we asked for, not just some -makes IN() an AND not an OR.
GROUP BY ur.account_id
HAVING COUNT(DISTINCT rp.permission_id) = (SELECT LENGTH(permissions) - LENGTH( REPLACE(permissions, ',', '') ) + 1);