MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / changePermission

Function changePermission

frontend/src/hooks/useFileManager.ts:1044–1105  ·  view source on GitHub ↗
(name: string, mode: number)

Source from the content-addressed store, hash-verified

1042 });
1043
1044 const changePermission = async (name: string, mode: number) => {
1045 permission.loading = true;
1046 permission.data = number2permission(mode);
1047 permission.loading = false;
1048 await openDialog(t("TXT_CODE_16853efe"), "", "", "permission", {
1049 maxWidth: "400px"
1050 });
1051 try {
1052 const chmod = permission2number(
1053 permission.data.owner,
1054 permission.data.usergroup,
1055 permission.data.everyone
1056 );
1057 if (isMultiple.value) {
1058 if (!selectionData.value || selectionData.value.length === 0)
1059 return reportErrorMsg(t("TXT_CODE_b152cd75"));
1060 const { state, execute } = changePermissionBatchApi();
1061 await execute({
1062 params: {
1063 daemonId: daemonId || "",
1064 uuid: instanceId || ""
1065 },
1066 data: {
1067 chmod,
1068 deep: permission.deep,
1069 targets: selectionData.value.map((item) => currentPath.value + item.name)
1070 }
1071 });
1072 const summary = state.value;
1073 if (!summary || summary.failed === 0) {
1074 message.success(t("TXT_CODE_b05948d1"));
1075 } else if (summary.success === 0) {
1076 message.error(t("TXT_CODE_6f8ce7f1", { total: summary.total }));
1077 } else {
1078 message.warning(
1079 t("TXT_CODE_31b8fbd5", {
1080 success: summary.success,
1081 failed: summary.failed
1082 })
1083 );
1084 }
1085 } else {
1086 const { execute } = changePermissionApi();
1087 await execute({
1088 params: {
1089 daemonId: daemonId || "",
1090 uuid: instanceId || ""
1091 },
1092 data: {
1093 chmod,
1094 deep: permission.deep,
1095 target: currentPath.value + name
1096 }
1097 });
1098 message.success(t("TXT_CODE_b05948d1"));
1099 }
1100 await getFileList();
1101 } catch (err: any) {

Callers

nothing calls this directly

Calls 8

number2permissionFunction · 0.90
permission2numberFunction · 0.90
reportErrorMsgFunction · 0.90
executeFunction · 0.85
getFileListFunction · 0.85
errorMethod · 0.80
warningMethod · 0.80
openDialogFunction · 0.70

Tested by

no test coverage detected