Skip to content

Commit

Permalink
fix: don't fetch ACLs when user doesn't exist yet (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
czosel authored Jan 26, 2022
1 parent 3884c5e commit b407b5e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
70 changes: 40 additions & 30 deletions addon/templates/users/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -178,40 +178,50 @@
{{t "emeis.acl-table.headings.scope"}}
</th>
<th class="uk-table-shrink uk-text-nowrap">
<UkButton
data-test-add-acl
@color="primary"
{{on "click" (fn (set this.showAclWizzard true))}}
>
{{t "emeis.acl-table.headings.add-entry"}}
</UkButton>
{{#unless @model.isNew}}
<UkButton
data-test-add-acl
@color="primary"
{{on "click" (fn (set this.showAclWizzard true))}}
>
{{t "emeis.acl-table.headings.add-entry"}}
</UkButton>
{{/unless}}
</th>
</table.head>
<table.body as |body|>
<body.row>
{{#let body.model as |aclEntry|}}
<td data-test-acl-role={{aclEntry.id}}>
{{aclEntry.role.name}}
</td>
{{#if @model.isNew}}
<tbody>
<tr>
<td colspan="99" class="uk-text-center">You can add ACLs once the new user has been saved.</td>
</tr>
</tbody>
{{else}}
<table.body as |body|>
<body.row>
{{#let body.model as |aclEntry|}}
<td data-test-acl-role={{aclEntry.id}}>
{{aclEntry.role.name}}
</td>

<td data-test-acl-scope={{aclEntry.id}}>
{{aclEntry.scope.name}}
</td>
<td data-test-acl-scope={{aclEntry.id}}>
{{aclEntry.scope.name}}
</td>

<td data-test-acl-delete={{aclEntry.id}}>
<span class="uk-flex uk-flex-center">
<button
type="button"
class="uk-icon-button uk-margin-small-right"
uk-icon="trash"
tooltip="hey there"
{{on "click" (perform this.deleteAclEntry aclEntry table.refresh)}}
></button>
</span>
</td>
{{/let}}
</body.row>
</table.body>
<td data-test-acl-delete={{aclEntry.id}}>
<span class="uk-flex uk-flex-center">
<button
type="button"
class="uk-icon-button uk-margin-small-right"
uk-icon="trash"
tooltip="hey there"
{{on "click" (perform this.deleteAclEntry aclEntry table.refresh)}}
></button>
</span>
</td>
{{/let}}
</body.row>
</table.body>
{{/if}}
</DataTable>
{{/if}}
</div>
Expand Down
3 changes: 2 additions & 1 deletion translations/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ emeis:
scope: "Berechtigungsbereich"
role: "Rolle"
add-entry: "Eintrag hinzufügen"
new-user-hint: "Berechtigungen können erst hinzugefügt werden, sobald der neue Benutzer gespeichert wurde."

acl-wizzard:
add-entry: "Berechtigung hinzufügen"
Expand All @@ -105,4 +106,4 @@ emeis:
label-1: "Schinken"
label-2: "Käse"
label-3: "Zwiebeln"
meta-example-2: "Beispiel für benutzerdefiniertes Textfeld"
meta-example-2: "Beispiel für benutzerdefiniertes Textfeld"
3 changes: 2 additions & 1 deletion translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ emeis:
scope: "Scope"
role: "Role"
add-entry: "Add entry"
new-user-hint: "You can add ACLs once the new user has been saved."

acl-wizzard:
add-entry: "Add ACL Entry"
Expand All @@ -105,4 +106,4 @@ emeis:
label-1: "Ham"
label-2: "Cheese"
label-3: "Onions"
meta-example-2: "Example for custom text field"
meta-example-2: "Example for custom text field"

0 comments on commit b407b5e

Please sign in to comment.