mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-04 01:18:20 +02:00
feat: enterprise service accounts (BE) (#2806)
https://linear.app/unleash/issue/2-537/back-end-for-service-accounts Supersedes https://github.com/Unleash/unleash/pull/2731
This commit is contained in:
parent
093156f5f5
commit
28fbcf69ec
@ -100,7 +100,7 @@ class UserStore implements IUserStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildSelectUser(q: IUserLookup): any {
|
buildSelectUser(q: IUserLookup): any {
|
||||||
const query = this.activeUsers();
|
const query = this.activeAll();
|
||||||
if (q.id) {
|
if (q.id) {
|
||||||
return query.where('id', q.id);
|
return query.where('id', q.id);
|
||||||
}
|
}
|
||||||
@ -113,8 +113,17 @@ class UserStore implements IUserStore {
|
|||||||
throw new Error('Can only find users with id, username or email.');
|
throw new Error('Can only find users with id, username or email.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activeAll(): any {
|
||||||
|
return this.db(TABLE).where({
|
||||||
|
deleted_at: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
activeUsers(): any {
|
activeUsers(): any {
|
||||||
return this.db(TABLE).where('deleted_at', null);
|
return this.db(TABLE).where({
|
||||||
|
deleted_at: null,
|
||||||
|
is_service: false,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasUser(idQuery: IUserLookup): Promise<number | undefined> {
|
async hasUser(idQuery: IUserLookup): Promise<number | undefined> {
|
||||||
|
19
src/migrations/20221221144132-service-account-users.js
Normal file
19
src/migrations/20221221144132-service-account-users.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
exports.up = function (db, cb) {
|
||||||
|
db.runSql(
|
||||||
|
`
|
||||||
|
ALTER table users
|
||||||
|
ADD COLUMN IF NOT EXISTS is_service boolean DEFAULT false
|
||||||
|
`,
|
||||||
|
cb,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (db, cb) {
|
||||||
|
db.runSql(
|
||||||
|
`
|
||||||
|
ALTER table users
|
||||||
|
DROP COLUMN is_service
|
||||||
|
`,
|
||||||
|
cb,
|
||||||
|
);
|
||||||
|
};
|
@ -41,7 +41,6 @@ process.nextTick(async () => {
|
|||||||
responseTimeWithAppName: true,
|
responseTimeWithAppName: true,
|
||||||
variantsPerEnvironment: true,
|
variantsPerEnvironment: true,
|
||||||
maintenance: false,
|
maintenance: false,
|
||||||
serviceAccounts: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
authentication: {
|
authentication: {
|
||||||
|
Loading…
Reference in New Issue
Block a user