mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-22 08:00:53 +00:00
fix: adjust container action permission checks (#12718)
This commit is contained in:
committed by
zhengkunwang223
parent
75258bb465
commit
db6e8841ec
@@ -59,7 +59,7 @@ import { computed, type PropType } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { resolveMaybeFn, type FuTableOperationButton } from './shared';
|
||||
import { hasManagePermissionAccess } from '@/utils/permission';
|
||||
import { hasManagePermissionAccess, hasPermissionAccess } from '@/utils/permission';
|
||||
|
||||
defineOptions({ name: 'FuTableOperations' });
|
||||
|
||||
@@ -205,9 +205,12 @@ const getMoreButtons = (row: any) => {
|
||||
};
|
||||
|
||||
const isButtonDisabled = (button: FuTableOperationButton, row: any) => {
|
||||
const permissionDisabled =
|
||||
button.permission !== undefined &&
|
||||
!hasManagePermissionAccess(button.permission === true ? undefined : button.permission);
|
||||
let permissionDisabled = false;
|
||||
if (button.permission === true) {
|
||||
permissionDisabled = !hasManagePermissionAccess();
|
||||
} else if (button.permission !== undefined) {
|
||||
permissionDisabled = !hasPermissionAccess(button.permission);
|
||||
}
|
||||
return permissionDisabled || Boolean(resolveMaybeFn(button.disabled ?? false, row));
|
||||
};
|
||||
|
||||
|
||||
@@ -859,7 +859,7 @@ const buttons = [
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('home.dir'),
|
||||
permission: 'host_file_view',
|
||||
permission: true,
|
||||
disabled: (row: Container.ContainerInfo) => {
|
||||
return row.state !== 'running';
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user