1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

fix: OIDC finalization and refactoring

This commit is contained in:
Maksim Eltyshev 2023-10-17 19:18:19 +02:00
parent c21e9cb60a
commit b9716c6e3a
70 changed files with 753 additions and 427 deletions

View file

@ -24,6 +24,11 @@ module.exports = {
defaultsTo: false,
columnName: 'is_admin',
},
isSso: {
type: 'boolean',
defaultsTo: false,
columnName: 'is_sso',
},
name: {
type: 'string',
required: true,
@ -67,10 +72,6 @@ module.exports = {
type: 'ref',
columnName: 'password_changed_at',
},
locked: {
type: 'boolean',
columnName: 'locked',
},
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
// ║╣ ║║║╠╩╗║╣ ║║╚═╗
@ -109,12 +110,15 @@ module.exports = {
tableName: 'user_account',
customToJSON() {
const isLockedAdmin = this.email === sails.config.custom.defaultAdminEmail;
return {
..._.omit(this, ['password', 'avatar', 'passwordChangedAt']),
..._.omit(this, ['password', 'isSso', 'avatar', 'passwordChangedAt']),
isLockedAdmin,
isLocked: this.isSso || isLockedAdmin,
avatarUrl:
this.avatar &&
`${sails.config.custom.userAvatarsUrl}/${this.avatar.dirname}/square-100.${this.avatar.extension}`,
isLocked: this.email === sails.config.custom.defaultAdminEmail,
};
},
};