Skip to content

Commit

Permalink
fix: Shows "Identities" nav element as disabled for users without rel…
Browse files Browse the repository at this point in the history
…evant permission (#2813)
  • Loading branch information
novakzaballa committed Sep 29, 2023
1 parent 7c3c341 commit 3ec2f6b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 16 additions & 4 deletions frontend/web/components/Aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Permission from 'common/providers/Permission'
import Icon from './Icon'
import ProjectSelect from './ProjectSelect'
import AsideProjectButton from './AsideProjectButton'
import Constants from 'common/constants'

const Aside = class extends Component {
static displayName = 'Aside'
Expand Down Expand Up @@ -484,21 +485,32 @@ const Aside = class extends Component {
</span>
) : null}
</NavLink>
{manageIdentityPermission && (
{Utils.renderWithPermission(
manageIdentityPermission,
Constants.environmentPermissions(
'View Identities',
),
<NavLink
id='users-link'
className='aside__environment-list-item mt-1'
className={`aside__environment-list-item ${
!manageIdentityPermission &&
'disabled'
} mt-1`}
exact
to={`/project/${project.id}/environment/${environment.api_key}/users`}
>
<span className='mr-2'>
<Icon
name='people'
fill='#9DA4AE'
fill={
manageIdentityPermission
? '#9DA4AE'
: '#696969'
}
/>
</span>
Identities
</NavLink>
</NavLink>,
)}

{environmentAdmin && (
Expand Down
4 changes: 4 additions & 0 deletions frontend/web/styles/project/_utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
background-color: rgba(0,0,0,.2);
}
}
.aside__environment-list-item.disabled {
color:#696969;
pointer-events: none;
}

.justify-content-end {
justify-content: flex-end;
Expand Down

1 comment on commit 3ec2f6b

@vercel
Copy link

@vercel vercel bot commented on 3ec2f6b Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.