summaryrefslogtreecommitdiff
path: root/db/rest/user/api_user.sql
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--db/rest/user/api_user.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/db/rest/user/api_user.sql b/db/rest/user/api_user.sql
new file mode 100644
index 0000000..e45768a
--- /dev/null
+++ b/db/rest/user/api_user.sql
@@ -0,0 +1,23 @@
+CREATE VIEW api.user AS
+ SELECT
+ u.id,
+ u.username,
+ NULL AS password,
+ u.role,
+ u.first_name,
+ u.last_name,
+ u.middle_name,
+ u.email,
+ u.gender,
+ u.join_date,
+ u.birth_date,
+ u.profile_avatar,
+ u.profile_banner,
+ u.profile_bio
+ FROM
+ admin.user u;
+
+GRANT SELECT ON TABLE api.user
+ TO rest_anon, rest_user;
+GRANT SELECT ON TABLE admin.user
+ TO rest_anon, rest_user;