Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add another system user for admin tokens #5915

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/lib/types/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,14 @@ export const SYSTEM_USER: Omit<IUser, 'email'> = {
permissions: [],
username: 'unleash_system_user',
};

export const ADMIN_TOKEN_USER: Omit<IUser, 'email'> = {
id: -42,
imageUrl: '',
isAPI: true,
name: 'Unleash Admin Token',
permissions: [],
username: 'unleash_admin_token',
};

export const SYSTEM_USER_ID: number = SYSTEM_USER.id;
22 changes: 22 additions & 0 deletions src/migrations/20240116154700-unleash-admin-token-user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(
`
INSERT INTO users
(id, name, username, created_by_user_id, is_system)
VALUES
(-42, 'Unleash Admin Token User', 'unleash_admin_token', -1337, true);
`,
callback,
);
};

exports.down = function (db, callback) {
db.runSql(
`
DELETE FROM users WHERE id = -42;
`,
callback,
);
};
Loading