PageSourceSearch

https://lakecloud.ai/assets/role-access-admin-XVuMB2jI.js

js lakecloud.ai collected 2026-10-05 14:18:55 UTC 3,661 bytes, 1 lines download raw bytes

1import{m as y,u as g,c as C,d as o,e as N,j as e,N as d,w as l,b8 as v,D as A,G as w,H as T,P,J as k,z as R,q as L,l as q}from"./index-BwCn98j3.js";import{T as I,a as O,b as m,c as u,d as S,e as x}from"./table-BNC5udZQ.js";import{S as B}from"./switch-Bk1wweoq.js";import{U as D}from"./unauthorized-redirect-B3nW8YA-.js";import{A as U}from"./arrow-left-DmCQHUpP.js";const p={can_dashboard:"Dashboard",can_student_dashboard:"Student Dashboard",can_student_course:"Student Course",can_course_preview:"Course Preview",can_optic_request:"OPTIC Request",can_optic_survey:"The OPTIC™ Assessment",can_optic_participants:"OPTIC Participants",can_optic_admin:"OPTIC Admin",can_tour_participant:"Tour Participant",can_tour_admin:"Tour Admin",can_course_builder:"Course Builder",can_content_library:"Content Library",can_api_prototype:"API Prototype",can_db_admin:"DB Admin",can_org_admin:"Org Admin",can_user_admin:"User Admin",can_community_post:"Community Post",can_community_admin:"Community Admin"};function F(){const{user:E}=y(),{toast:r}=g(),[,h]=C(),{data:n,isLoading:j}=o({queryKey:["/api/user/permissions"]}),{data:t,isLoading:_}=o({queryKey:["/api/admin/role-access"],enabled:!!(n!=null&&n.canUserAdmin)}),c=N({mutationFn:async({roleId:s,field:a,value:i})=>(await q("PATCH",`/api/admin/role-access/${s}`,{[a]:i})).json(),onSuccess:()=>{L.invalidateQueries({queryKey:["/api/admin/role-access"]}),r({title:"Access updated",description:"Role permissions have been updated"})},onError:s=>{r({title:"Error",description:s.message,variant:"destructive"})}});return j?e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx(d,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(l,{className:"h-8 w-8 animate-spin"})})]}):n!=null&&n.canUserAdmin?e.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col",children:[e.jsx(d,{}),e.jsxs("div",{className:"flex-1 max-w-full mx-auto px-4 sm:px-6 lg:px-8 py-8 w-full",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("h1",{className:"text-3xl font-bold text-gray-900 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>h("/admin/dashboard"),className:"text-gray-400 hover:text-primary transition-colors",title:"Back to Dashboard",children:e.jsx(U,{className:"h-7 w-7"})}),e.jsx(v,{className:"h-8 w-8"}),"Role Access Management"]}),e.jsx("p",{className:"text-gray-600 mt-1",children:"Configure which sections each role can access across the platform"})]}),e.jsxs(A,{children:[e.jsxs(w,{children:[e.jsx(T,{children:"Role Access Matrix"}),e.jsx(P,{children:"Toggle permissions for each role. Changes take effect immediately."})]}),e.jsx(k,{children:_?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(l,{className:"h-6 w-6 animate-spin"})}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(I,{children:[e.jsx(O,{children:e.jsxs(m,{children:[e.jsx(u,{className:"sticky left-0 bg-background min-w-[160px]",children:"Role"}),Object.entries(p).map(([s,a])=>e.jsx(u,{className:"text-center text-xs whitespace-nowrap min-w-[90px]",children:a},s))]})}),e.jsx(S,{children:t==null?void 0:t.map(s=>e.jsxs(m,{children:[e.jsx(x,{className:"sticky left-0 bg-background font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.role_name,s.is_internal&&e.jsx(R,{variant:"secondary",className:"text-xs",children:"Internal"})]})}),Object.keys(p).map(a=>e.jsx(x,{className:"text-center",children:e.jsx(B,{checked:s[a],onCheckedChange:i=>c.mutate({roleId:s.role,field:a.replace(/_([a-z])/g,(b,f)=>f.toUpperCase()),value:i}),disabled:c.isPending})},a))]},s.id))})]})})})]})]})]}):e.jsx(D,{})}export{F as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.