Fix display of navbar links to admins, closes #1920

This commit is contained in:
Dane Everitt 2020-04-17 10:21:15 -07:00
parent 4193c5f664
commit e969344f3b
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
8 changed files with 67 additions and 39 deletions

View file

@ -47,7 +47,7 @@ export default ({ subuser }: Props) => {
</div>
<div className={'ml-4'}>
<p className={'font-medium text-center'}>
{subuser.permissions.filter(permission => permission !== 'websocket.*').length}
{subuser.permissions.filter(permission => permission !== 'websocket.connect').length}
</p>
<p className={'text-2xs text-neutral-500 uppercase'}>Permissions</p>
</div>

View file

@ -15,7 +15,6 @@ export const usePermissions = (action: string | string[]): boolean[] => {
// will return if the user has any permission under the file.XYZ namespace.
(
permission.endsWith('.*') &&
permission !== 'websocket.*' &&
userPermissions.filter(p => p.startsWith(permission.split('.')[0])).length > 0
) ||
// Otherwise just check if the entire permission exists in the array or not.

View file

@ -1,7 +1,7 @@
import { action, Action } from 'easy-peasy';
export type SubuserPermission =
'websocket.*' |
'websocket.connect' |
'control.console' | 'control.start' | 'control.stop' | 'control.restart' |
'user.create' | 'user.read' | 'user.update' | 'user.delete' |
'file.create' | 'file.read' | 'file.update' | 'file.delete' | 'file.archive' | 'file.sftp' |