mirror of
https://github.com/plankanban/planka.git
synced 2025-07-22 06:39:44 +02:00
feat: Add ability to map OIDC attributes and ignore username
Some checks failed
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm/v7) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm64) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted x64], linux/amd64) (push) Has been cancelled
Build and push Docker DEV image / merge (push) Has been cancelled
Build and push Docker DEV image / rerun-failed-jobs (push) Has been cancelled
Some checks failed
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm/v7) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted arm64], linux/arm64) (push) Has been cancelled
Build and push Docker DEV image / build ([self-hosted x64], linux/amd64) (push) Has been cancelled
Build and push Docker DEV image / merge (push) Has been cancelled
Build and push Docker DEV image / rerun-failed-jobs (push) Has been cancelled
Closes #554
This commit is contained in:
parent
31d4d5f38d
commit
634d6ceab1
13 changed files with 112 additions and 72 deletions
|
@ -53,11 +53,7 @@ module.exports = {
|
|||
async fn(inputs) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
if (inputs.id === currentUser.id) {
|
||||
if (!inputs.currentPassword) {
|
||||
throw Errors.INVALID_CURRENT_PASSWORD;
|
||||
}
|
||||
} else if (!currentUser.isAdmin) {
|
||||
if (inputs.id !== currentUser.id && !currentUser.isAdmin) {
|
||||
throw Errors.USER_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
|
@ -67,15 +63,18 @@ module.exports = {
|
|||
throw Errors.USER_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (user.email === sails.config.custom.defaultAdminEmail || user.isSso) {
|
||||
if (user.email === sails.config.custom.defaultAdminEmail) {
|
||||
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||
}
|
||||
|
||||
if (
|
||||
inputs.id === currentUser.id &&
|
||||
!bcrypt.compareSync(inputs.currentPassword, user.password)
|
||||
) {
|
||||
throw Errors.INVALID_CURRENT_PASSWORD;
|
||||
if (user.isSso) {
|
||||
if (!sails.config.custom.oidcIgnoreUsername) {
|
||||
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||
}
|
||||
} else if (inputs.id === currentUser.id) {
|
||||
if (!inputs.currentPassword || !bcrypt.compareSync(inputs.currentPassword, user.password)) {
|
||||
throw Errors.INVALID_CURRENT_PASSWORD;
|
||||
}
|
||||
}
|
||||
|
||||
const values = _.pick(inputs, ['username']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue