create or replace view "user_rigths_per_channel" as
select distinct
  "u"."id" as "user_id",
  "c"."id" as "channel_id",
  "c"."name" as "channel_name",
  "c"."description" as "channel_description",
  "r"."rights"
from
  "user" "u"
join
  "role_binding" "rb" on "u"."id" = "rb"."user_id"
join
  "role" "ro" on "rb"."role_id" = "ro"."id"
join
  "right" "r" on "ro"."id" = "r"."role_id"
join
  "channel" "c" on "r"."channel_id" = "c"."id"
order by "user_id";