Skip to content

Commit

Permalink
slightly tweak canShowOwn and use it where appropriate (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrumsnChocolate authored Sep 11, 2023
1 parent 281a73b commit d6160a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/abilities/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class User extends Ability {
}

get canShowOwn() {
return this.session.isAuthenticated;
return this.session.isAuthenticated && this.session.currentUser?.id;
}

get canCreate() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/menu-sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div class='profile-menu {{if layoutManager.profileMenuOpen "open"}}'>
<MenuSidebarItem
@link='users.user'
@hasPermission={{can 'show individual users'}}
@hasPermission={{can 'show own users'}}
@icon='user'
@title={{t 'mixin.menuItems.profile'}}
@minor={{true}}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class ProfileRoute extends AuthenticatedRoute {
@service router;

canAccess() {
return this.abilities.can('show individual users');
return this.abilities.can('show own users');
}

redirect() {
Expand Down

0 comments on commit d6160a1

Please sign in to comment.