CREATE OR REPLACE VIEW `view_user_permissions` AS 
SELECT
    `id_user` AS `id`,
    `dkey` AS `perm`,
    CASE 
        WHEN dvalue = 1 THEN "true"
        ELSE "false"
    END AS `active`
FROM `permissoes`;
