RezinaLMS-Admin/src/lib/activityLogPermissions.ts
Yared Yemane 53cdb5060a Integrate activity logs and polish user profile audit UX.
Add global and profile-scoped activity log views with server-side actor enrichment, admin sidebar access for ADMIN/Super Admin roles, collapsible user detail sections, and horizontally scrollable account activity tables.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-20 03:59:24 -07:00

19 lines
525 B
TypeScript

const ACTIVITY_LOG_BYPASS_TEAM_ROLES = new Set(["SUPER_ADMIN", "ADMIN"])
export function getSessionTeamRole(): string {
return localStorage.getItem("role")?.trim() ?? ""
}
export function hasActivityLogRoleBypass(): boolean {
const role = getSessionTeamRole().toUpperCase()
return ACTIVITY_LOG_BYPASS_TEAM_ROLES.has(role)
}
export function hasActivityLogPermission(
permission: string,
permissions: string[],
): boolean {
if (hasActivityLogRoleBypass()) return true
return permissions.includes(permission)
}