Skip to content

Commit

Permalink
Fix admin accounts in user management (fixes #354)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Jan 15, 2024
1 parent 02b3ecd commit 469e1e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/GrampsjsFormUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const userRoles = {
2: 'Contributor',
3: 'Editor',
4: 'Owner',
5: 'Administrator',
}

class GrampsjsFormUser extends GrampsjsTranslateMixin(LitElement) {
Expand All @@ -44,6 +45,7 @@ class GrampsjsFormUser extends GrampsjsTranslateMixin(LitElement) {
static get properties() {
return {
data: {type: Object},
ismulti: {type: Boolean},
isFormValid: {type: Boolean},
newUser: {type: Boolean},
}
Expand All @@ -52,6 +54,7 @@ class GrampsjsFormUser extends GrampsjsTranslateMixin(LitElement) {
constructor() {
super()
this.data = {}
this.ismulti = false
this.isFormValid = false
this.newUser = false
}
Expand Down Expand Up @@ -115,6 +118,7 @@ class GrampsjsFormUser extends GrampsjsTranslateMixin(LitElement) {
${Object.keys(userRoles)
.map(Number)
.sort((a, b) => a - b)
.filter(x => x <= 4 || this.ismulti)
.map(
role => html`
<mwc-list-item
Expand Down
3 changes: 2 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,6 @@
"Largest Segment": "Largest Segment",
"Bookmark this": "Bookmark this",
"Remove bookmark": "Remove bookmark",
"Ancestor frequency": "Ancestor frequency"
"Ancestor frequency": "Ancestor frequency",
"Administrator": "Administrator"
}
1 change: 1 addition & 0 deletions src/views/GrampsjsViewSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export class GrampsjsViewSettings extends GrampsjsViewSettingsOnboarding {
<grampsjs-users
.strings="${this.strings}"
.data="${this.userData}"
?ismulti="${!!this.dbInfo?.server?.multi_tree}"
@user:updated="${this._handleUserChanged}"
@user:added="${this._handleUserAdded}"
@user:added-multiple="${this._handleUsersAdded}"
Expand Down

0 comments on commit 469e1e4

Please sign in to comment.