From 0236f648d91377ffafc361cc0e1e1025c456a395 Mon Sep 17 00:00:00 2001 From: Avris Date: Thu, 31 Dec 2020 00:15:38 +0100 Subject: [PATCH] #132 fine-grained permissions --- migrations/016-permissions.sql | 7 +++++++ server/routes/user.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 migrations/016-permissions.sql diff --git a/migrations/016-permissions.sql b/migrations/016-permissions.sql new file mode 100644 index 00000000..145eedca --- /dev/null +++ b/migrations/016-permissions.sql @@ -0,0 +1,7 @@ +-- Up + +UPDATE users SET roles = '' WHERE roles = 'user'; + +-- Down + +UPDATE users SET roles = 'user' WHERE roles = ''; diff --git a/server/routes/user.js b/server/routes/user.js index 350f0099..2668b900 100644 --- a/server/routes/user.js +++ b/server/routes/user.js @@ -72,7 +72,7 @@ const fetchOrCreateUser = async (db, user, avatarSource = 'gravatar') => { id: ulid(), username: await defaultUsername(db, user.name || user.email), email: normalise(user.email), - roles: 'user', + roles: '', avatarSource: avatarSource, } await db.get(SQL`INSERT INTO users(id, username, email, roles, avatarSource)