Merge pull request #2582 from richard-cox/add-admin-logout

Ensure the user stays logged in after attempting to change roles they cannot
This commit is contained in:
Richard Cox 2021-03-31 18:39:01 +01:00 committed by GitHub
commit c44a430176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -215,7 +215,8 @@ export default {
globalRoleName: role, globalRoleName: role,
}))); })));
await Promise.all(newBindings.map(newBinding => newBinding.save())); // Save all changes (and ensure user isn't logged out if they don't have permissions to make a change)
await Promise.all(newBindings.map(newBinding => newBinding.save({ redirectUnauthorized: false })));
}, },
async saveRemovedRoles() { async saveRemovedRoles() {
const existingBindings = await Promise.all(this.roleChanges.removeBindings.map(bindingId => this.$store.dispatch('management/find', { const existingBindings = await Promise.all(this.roleChanges.removeBindings.map(bindingId => this.$store.dispatch('management/find', {
@ -223,7 +224,8 @@ export default {
id: bindingId id: bindingId
}))); })));
await Promise.all(existingBindings.map(existingBinding => existingBinding.remove())); // Save all changes (and ensure user isn't logged out if they don't have permissions to make a change)
await Promise.all(existingBindings.map(existingBinding => existingBinding.remove({ redirectUnauthorized: false })));
}, },
/** /**
* userId is optional, used when a user has just been created * userId is optional, used when a user has just been created