auto commit
This commit is contained in:
parent
88f5fab09c
commit
dafc234ecf
@ -1,70 +1,70 @@
|
||||
// // src/hooks/usePermissions.ts
|
||||
// import { useAuth } from "./useAuth";
|
||||
|
||||
// export function usePermissions() {
|
||||
// const { user } = useAuth();
|
||||
// const permissions = user?.permissions || {};
|
||||
|
||||
// const hasPermission = (permission: string): boolean => {
|
||||
// return !!permissions[permission];
|
||||
// };
|
||||
|
||||
// const hasAnyPermission = (requiredPermissions: string[]): boolean => {
|
||||
// return requiredPermissions.some((permission) => hasPermission(permission));
|
||||
// };
|
||||
|
||||
// const hasAllPermissions = (requiredPermissions: string[]): boolean => {
|
||||
// return requiredPermissions.every((permission) => hasPermission(permission));
|
||||
// };
|
||||
|
||||
// return {
|
||||
// permissions,
|
||||
// hasPermission,
|
||||
// hasAnyPermission,
|
||||
// hasAllPermissions,
|
||||
// };
|
||||
// }
|
||||
|
||||
// src/hooks/usePermissions.ts
|
||||
import { useAuth } from "./useAuth";
|
||||
import { PATH_PERMISSIONS } from "@/config/permissions";
|
||||
|
||||
export function usePermissions() {
|
||||
const { user } = useAuth();
|
||||
const permissions = user?.permissions || {};
|
||||
|
||||
const hasPermission = (permission: string): boolean => {
|
||||
if (!user) return false;
|
||||
|
||||
// 슈퍼 관리자는 모든 권한을 가짐
|
||||
if (user.role === "super_admin") return true;
|
||||
|
||||
// 회사 관리자는 회사 관련 모든 권한을 가짐
|
||||
if (user.role === "company_admin") {
|
||||
if (
|
||||
permission.startsWith("company:") ||
|
||||
permission.startsWith("branches:") ||
|
||||
permission.startsWith("users:") ||
|
||||
permission.startsWith("departments:")
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return !!permissions[permission];
|
||||
};
|
||||
|
||||
const hasPathPermission = (path: string): boolean => {
|
||||
const requiredPermissions = PATH_PERMISSIONS[path];
|
||||
if (!requiredPermissions) return true;
|
||||
const hasAnyPermission = (requiredPermissions: string[]): boolean => {
|
||||
return requiredPermissions.some((permission) => hasPermission(permission));
|
||||
};
|
||||
|
||||
const hasAllPermissions = (requiredPermissions: string[]): boolean => {
|
||||
return requiredPermissions.every((permission) => hasPermission(permission));
|
||||
};
|
||||
|
||||
return {
|
||||
permissions,
|
||||
hasPermission,
|
||||
hasPathPermission,
|
||||
hasAnyPermission: (perms: string[]) => perms.some(hasPermission),
|
||||
hasAllPermissions: (perms: string[]) => perms.every(hasPermission),
|
||||
hasAnyPermission,
|
||||
hasAllPermissions,
|
||||
};
|
||||
}
|
||||
|
||||
// // src/hooks/usePermissions.ts
|
||||
// import { useAuth } from "./useAuth";
|
||||
// import { PATH_PERMISSIONS } from "@/config/permissions";
|
||||
|
||||
// export function usePermissions() {
|
||||
// const { user } = useAuth();
|
||||
// const permissions = user?.permissions || {};
|
||||
|
||||
// const hasPermission = (permission: string): boolean => {
|
||||
// if (!user) return false;
|
||||
|
||||
// // 슈퍼 관리자는 모든 권한을 가짐
|
||||
// if (user.role === "super_admin") return true;
|
||||
|
||||
// // 회사 관리자는 회사 관련 모든 권한을 가짐
|
||||
// if (user.role === "company_admin") {
|
||||
// if (
|
||||
// permission.startsWith("company:") ||
|
||||
// permission.startsWith("branches:") ||
|
||||
// permission.startsWith("users:") ||
|
||||
// permission.startsWith("departments:")
|
||||
// ) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return !!permissions[permission];
|
||||
// };
|
||||
|
||||
// const hasPathPermission = (path: string): boolean => {
|
||||
// const requiredPermissions = PATH_PERMISSIONS[path];
|
||||
// if (!requiredPermissions) return true;
|
||||
// return requiredPermissions.some((permission) => hasPermission(permission));
|
||||
// };
|
||||
|
||||
// return {
|
||||
// permissions,
|
||||
// hasPermission,
|
||||
// hasPathPermission,
|
||||
// hasAnyPermission: (perms: string[]) => perms.some(hasPermission),
|
||||
// hasAllPermissions: (perms: string[]) => perms.every(hasPermission),
|
||||
// };
|
||||
// }
|
||||
|
7
fems-mqtt/log/mosquitto.log
Normal file → Executable file
7
fems-mqtt/log/mosquitto.log
Normal file → Executable file
@ -14610,3 +14610,10 @@ To fix this, use `chmod 0700 /mosquitto/config/passwd`.
|
||||
1732323831: Config loaded from /mosquitto/config/mosquitto.conf.
|
||||
1732323831: Error: Unable to open pwfile "/mosquitto/data/passwd".
|
||||
1732323831: Error opening password file "/mosquitto/data/passwd".
|
||||
1732324055: mosquitto version 2.0.20 starting
|
||||
1732324055: Config loaded from /mosquitto/config/mosquitto.conf.
|
||||
1732324055: Warning: Invalid line in password file '/mosquitto/data/passwd': :$7$101$+omPiJyjoneCLJX8$SFwcxEvfGOoPsL9unluq4VcNKxorCZVm5o5qpN+QHg9LCsuL2Rky9Dw/OukmGfVRTw58hKOo5bwx9OTsslUmSg==
|
||||
1732324055: Warning: ACL pattern 'fems/#' does not contain '%c' or '%u'.
|
||||
1732324055: Opening ipv4 listen socket on port 1884.
|
||||
1732324055: Opening ipv6 listen socket on port 1884.
|
||||
1732324055: mosquitto version 2.0.20 running
|
||||
|
Loading…
Reference in New Issue
Block a user