#132 fine-grained permissions

This commit is contained in:
Avris 2020-12-31 00:15:38 +01:00
parent 257db4099e
commit 0236f648d9
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1,7 @@
-- Up
UPDATE users SET roles = '' WHERE roles = 'user';
-- Down
UPDATE users SET roles = 'user' WHERE roles = '';

View File

@ -72,7 +72,7 @@ const fetchOrCreateUser = async (db, user, avatarSource = 'gravatar') => {
id: ulid(), id: ulid(),
username: await defaultUsername(db, user.name || user.email), username: await defaultUsername(db, user.name || user.email),
email: normalise(user.email), email: normalise(user.email),
roles: 'user', roles: '',
avatarSource: avatarSource, avatarSource: avatarSource,
} }
await db.get(SQL`INSERT INTO users(id, username, email, roles, avatarSource) await db.get(SQL`INSERT INTO users(id, username, email, roles, avatarSource)