diff --git a/keyserver/src/creators/role-creator.js b/keyserver/src/creators/role-creator.js --- a/keyserver/src/creators/role-creator.js +++ b/keyserver/src/creators/role-creator.js @@ -1,5 +1,6 @@ // @flow +import { defaultSpecialRoles } from 'lib/permissions/special-roles.js'; import { getRolePermissionBlobs, getThreadPermissionBlobFromUserSurfacedPermissions, @@ -50,11 +51,13 @@ const id = ids.shift(); namesToIDs[name] = id; const permissionsBlob = JSON.stringify(rolePermissions[name]); - newRows.push([id, threadID, name, permissionsBlob, time]); + const specialRole = defaultSpecialRoles[name] ?? null; + newRows.push([id, threadID, name, permissionsBlob, time, specialRole]); } const query = SQL` - INSERT INTO roles (id, thread, name, permissions, creation_time) + INSERT INTO roles (id, thread, name, + permissions, creation_time, special_role) VALUES ${newRows} `; await dbQuery(query); diff --git a/lib/permissions/special-roles.js b/lib/permissions/special-roles.js --- a/lib/permissions/special-roles.js +++ b/lib/permissions/special-roles.js @@ -3,3 +3,7 @@ export const specialRoles = Object.freeze({ DEFAULT_ROLE: 1, }); + +export const defaultSpecialRoles = Object.freeze({ + Members: specialRoles.DEFAULT_ROLE, +});