diff --git a/postgres/40-views.sql b/postgres/40-views.sql new file mode 100644 index 0000000..4c3e839 --- /dev/null +++ b/postgres/40-views.sql @@ -0,0 +1,18 @@ +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"; \ No newline at end of file