@aiquants/authz-react-router 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -4
- package/dist/index.d.mts +56 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{data as Y,redirect as Z}from"react-router";import{AUTHZ_ACTIONS as F,AuthzDeniedError as E}from"@aiquants/authz-core";import{data as S,redirect as J}from"react-router";var O={title:"Authorization (RBAC)",myPermission:"Your permissions",tabs:{roles:"Roles",resources:"Resources",role_permissions:"Permissions",user_roles:"User assignments"},common:{add:"Add",save:"Save",delete:"Delete",remove:"Remove",assign:"Assign",grant:"Grant",select:"Select\u2026",active:"\u25CB Enabled",inactive:"\xD7 Disabled",optional:"optional"},roles:{heading:"Roles (TMRole)",note:"Edit name / description inline and click Save (role_key is an immutable identifier).",roleKey:"role_key",name:"name",description:"description",activeHeader:"Active",empty:"No roles",newHeading:"New role",hintRoleKey:"e.g. admin"},resources:{heading:"Resources (TMResource)",note:"Edit name / description inline and click Save (app_key / resource_key are immutable identifiers).",appKey:"app_key",resourceKey:"resource_key",name:"name",description:"description",empty:"No resources",newHeading:"New resource",hintAppKey:"e.g. quants",hintResourceKey:"e.g. daily_report",hintDailyReport:"optional"},grants:{heading:"Permissions (TDRolePermission)",note:"Empty row_scope / column_scope = all rows / all columns (NULL). JSON must satisfy the \xA73.2 contract.",role:"role",resource:"resource",action:"action",rowScope:"row_scope",columnScope:"column_scope",empty:"No permissions",newHeading:"Grant a permission",rowScopeHint:"JSON / empty = all rows",columnScopeHint:"JSON / empty = all columns",rowScopePlaceholder:"empty = all rows (NULL)",columnScopePlaceholder:"empty = all columns (NULL)",nullRows:"NULL (all rows)",nullCols:"NULL (all columns)",selectPlaceholder:"Select\u2026"},userRoles:{heading:"User assignments (TDUserRole)",user:"user",role:"role",empty:"No assignments",newHeading:"Assign a role",selectPlaceholder:"Select\u2026"},error:{forbiddenTitle:"Access denied",forbiddenBody:"You don't have permission to view this screen. Ask an administrator to grant access.",genericTitlePrefix:"Error",genericTitle:"An error occurred",genericBody:"An unexpected error occurred. Please try again later."},warn:{selfRoleDisable:"This role backs your own authorization-admin access. Disabling it may lock you out of this screen. Continue?",selfRoleDelete:"This role backs your own authorization-admin access. Deleting it may lock you out of this screen. Continue?",selfAssignmentRemove:"This assignment backs your own authorization-admin access. Removing it may lock you out of this screen. Continue?"}};function I(t){let n=O;return t?{title:t.title??n.title,myPermission:t.myPermission??n.myPermission,tabs:{...n.tabs,...t.tabs},common:{...n.common,...t.common},roles:{...n.roles,...t.roles},resources:{...n.resources,...t.resources},grants:{...n.grants,...t.grants},userRoles:{...n.userRoles,...t.userRoles},error:{...n.error,...t.error},warn:{...n.warn,...t.warn}}:n}var Q=t=>t instanceof Response;function L(t){if(Q(t))throw t;if(t instanceof E)throw new Response(t.message,{status:403});return S({error:t instanceof Error?t.message:"\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F"},{status:400})}function T(t){let n=t.store,s=t.resourceKey??"authz_admin",d=I(t.labels),o=async(u,a)=>{let{userId:g}=await t.requirePermission(u,a);if(g==null)throw new E({appKey:"",resourceKey:a.resourceKey,action:a.action,reason:"unresolved-user",userId:null});return{userId:g}};async function m(u){await t.requireUser(u);try{return await o(u,{resourceKey:s,action:"read"})}catch(a){throw a instanceof E?new Response(`Forbidden: ${s}`,{status:403}):a}}let l=u=>t.getMyPermissions(u,{resourceKeys:[s]}),y=async u=>{let[a,g]=await Promise.all([n.listRoles(),n.getSelfAdminContext(Number(u))]);return{roles:a,selfAdminRoleIds:g.selfAdminRoleIds,labels:d}},h=async()=>({resources:await n.listResources(),labels:d}),f=async()=>{let[u,a,g]=await Promise.all([n.listGrants(),n.listRoles(),n.listResources()]);return{grants:u,roles:a,resources:g,labels:d}},A=async u=>{let[a,g,p,i]=await Promise.all([n.listUserRoles(),n.listRoles(),n.listUsers(),n.getSelfAdminContext(Number(u))]);return{assignments:a,roles:g,users:p,actorUserId:i.actorUserId,selfAdminRoleIds:i.selfAdminRoleIds,labels:d}};return{labels:d,resourceKey:s,layoutGuard:m,loadMyPermissions:l,layout:{async loader({request:u}){return await m(u),{myPermissions:await l(u),labels:d,adminResourceKey:s}}},index:{loader(){throw J("/authz/roles")}},roles:{data:y,async loader({request:u}){let{userId:a}=await o(u,{resourceKey:s,action:"read"});return y(a)},async action({request:u}){let a=await u.formData(),g=String(a.get("_action"));try{switch(g){case"create":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=String(a.get("roleKey")??"").trim(),b=String(a.get("name")??"").trim();return i&&b?(await n.createRole({roleKey:i,name:b,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"role_key \u3068 name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"save":{let{userId:p}=await o(u,{resourceKey:s,action:"update"}),i=String(a.get("roleKey")??"").trim(),b=String(a.get("name")??"").trim();return i&&b?(await n.updateRole(Number(a.get("id")),{roleKey:i,name:b,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"roleKey \u3068 name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"toggle":{let{userId:p}=await o(u,{resourceKey:s,action:"update"});return await n.setRoleActive(Number(a.get("id")),a.get("isActive")==="true",String(p)),{ok:!0}}case"delete":return await o(u,{resourceKey:s,action:"delete"}),await n.deleteRole(Number(a.get("id"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return L(p)}}},resources:{data:h,async loader({request:u}){return await o(u,{resourceKey:s,action:"read"}),h()},async action({request:u}){let a=await u.formData(),g=String(a.get("_action"));try{switch(g){case"create":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=String(a.get("appKey")??"").trim(),b=String(a.get("resourceKey")??"").trim(),K=String(a.get("name")??"").trim();return i&&b&&K?(await n.createResource({appKey:i,resourceKey:b,name:K,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"app_key / resource_key / name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"save":{let{userId:p}=await o(u,{resourceKey:s,action:"update"}),i=String(a.get("name")??"").trim();return i?(await n.updateResource(Number(a.get("id")),{name:i,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"delete":return await o(u,{resourceKey:s,action:"delete"}),await n.deleteResource(Number(a.get("id"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return L(p)}}},grants:{data:f,async loader({request:u}){return await o(u,{resourceKey:s,action:"read"}),f()},async action({request:u}){let a=await u.formData(),g=String(a.get("_action"));try{switch(g){case"create":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=Number(a.get("roleId")),b=Number(a.get("resourceId"));if(!(i&&b))return S({error:"\u30ED\u30FC\u30EB\u3068\u30EA\u30BD\u30FC\u30B9\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"},{status:400});let K=String(a.get("action")??"");if(!F.includes(K))return S({error:"\u7121\u52B9\u306A action \u3067\u3059"},{status:400});let M=K;return await n.createGrant({roleId:i,resourceId:b,action:M,rowScope:String(a.get("rowScope")??""),columnScope:String(a.get("columnScope")??"")},String(p)),{ok:!0}}case"save":{let{userId:p}=await o(u,{resourceKey:s,action:"update"}),i=String(a.get("action")??"");if(!F.includes(i))return S({error:"\u7121\u52B9\u306A action \u3067\u3059"},{status:400});let b=i;return await n.updateGrant(Number(a.get("id")),{action:b,rowScope:String(a.get("rowScope")??""),columnScope:String(a.get("columnScope")??"")},String(p)),{ok:!0}}case"delete":return await o(u,{resourceKey:s,action:"delete"}),await n.deleteGrant(Number(a.get("id"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return L(p)}}},userRoles:{data:A,async loader({request:u}){let{userId:a}=await o(u,{resourceKey:s,action:"read"});return A(a)},async action({request:u}){let a=await u.formData(),g=String(a.get("_action"));try{switch(g){case"assign":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=Number(a.get("userId")),b=Number(a.get("roleId"));return i&&b?(await n.assignUserRole(i,b,String(p)),{ok:!0}):S({error:"\u30E6\u30FC\u30B6\u30FC\u3068\u30ED\u30FC\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"},{status:400})}case"remove":return await o(u,{resourceKey:s,action:"delete"}),await n.removeUserRole(Number(a.get("userId")),Number(a.get("roleId"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return L(p)}}}}}function $(t){return String(t["*"]??"").split("/")[0]}function Re(t){let n=T(t),s=t.basePath??"/authz",d=["roles","resources","role_permissions","user_roles"],o={roles:n.roles.data,resources:n.resources.data,role_permissions:n.grants.data,user_roles:n.userRoles.data},m={roles:n.roles.action,resources:n.resources.action,role_permissions:n.grants.action,user_roles:n.userRoles.action};async function l(h){let f=$(h.params);if(!d.includes(f))throw Z(`${s}/roles`);let{userId:A}=await n.layoutGuard(h.request),[u,a]=await Promise.all([n.loadMyPermissions(h.request),o[f](A)]);return{segment:f,basePath:s,myPermissions:u,adminResourceKey:n.resourceKey,...a}}async function y(h){let f=$(h.params),A=m[f];return A?A(h):Y({error:"unknown action"},{status:400})}return{loader:l,action:y,server:n}}import{jsx as j,jsxs as N}from"react/jsx-runtime";var r={page:{padding:"1.25rem",maxWidth:1280,margin:"0 auto",color:"#0f172a"},tableContainer:{width:"100%",overflowX:"auto",marginBottom:"1rem",WebkitOverflowScrolling:"touch"},table:{borderCollapse:"collapse",width:"100%",fontSize:"0.9rem"},th:{textAlign:"left",borderBottom:"2px solid #e2e8f0",padding:"0.45rem 0.65rem",fontSize:"0.78rem",color:"#475569",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em"},td:{borderBottom:"1px solid #f1f5f9",padding:"0.5rem 0.65rem",verticalAlign:"middle"},input:{padding:"0.4rem 0.55rem",border:"1px solid #cbd5e1",borderRadius:6,fontSize:"0.9rem",background:"#fff",width:"100%",boxSizing:"border-box"},select:{padding:"0.4rem 0.55rem",border:"1px solid #cbd5e1",borderRadius:6,fontSize:"0.9rem",background:"#fff",width:"100%",boxSizing:"border-box"},textarea:{padding:"0.4rem 0.55rem",border:"1px solid #cbd5e1",borderRadius:6,fontSize:"0.82rem",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",minHeight:"3.25rem",resize:"vertical",width:"100%",boxSizing:"border-box"},button:{padding:"0.3rem 0.7rem",border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:"0.82rem",color:"#334155"},save:{padding:"0.3rem 0.7rem",border:"1px solid #2563eb",borderRadius:6,background:"#eff6ff",cursor:"pointer",fontSize:"0.82rem",color:"#2563eb",fontWeight:600},danger:{padding:"0.3rem 0.7rem",border:"1px solid #fecaca",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:"0.82rem",color:"#dc2626"},primary:{padding:"0.5rem 1.25rem",border:"1px solid #2563eb",borderRadius:6,background:"#2563eb",color:"#fff",cursor:"pointer",fontSize:"0.9rem",fontWeight:600,alignSelf:"flex-start"},card:{display:"flex",flexDirection:"column",gap:"0.85rem",maxWidth:600,marginTop:"0.75rem",padding:"1rem 1.1rem",border:"1px solid #e2e8f0",borderRadius:10,background:"#f8fafc"},code:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:"0.78rem",color:"#334155",wordBreak:"break-all"},muted:{color:"#94a3b8"},h2:{fontSize:"1.05rem",margin:"0 0 0.35rem",fontWeight:700},h3:{fontSize:"0.92rem",margin:"1.25rem 0 0",color:"#334155",fontWeight:600},note:{color:"#64748b",fontSize:"0.82rem",margin:"0 0 0.75rem"},empty:{color:"#94a3b8",padding:"0.75rem 0.65rem"}};function w({label:t,hint:n,children:s}){return N("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:[N("span",{style:{fontSize:"0.8rem",color:"#475569",fontWeight:600},children:[t,n?N("span",{style:{fontWeight:400,color:"#94a3b8"},children:[" \u2014 ",n]}):null]}),s]})}function k({message:t}){return t?j("p",{role:"alert",style:{color:"#dc2626",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:8,padding:"0.55rem 0.8rem",fontSize:"0.85rem",margin:"0.25rem 0"},children:t}):null}import{AUTHZ_ACTIONS as H}from"@aiquants/authz-core";import{SelectBox as z}from"@aiquants/select-box";import{useState as P}from"react";import{Form as R,isRouteErrorResponse as te,NavLink as re,Outlet as ne,useActionData as D,useLoaderData as x,useRouteError as oe}from"react-router";function q(t){let n=t?.read?t.readPartial?"partial":"full":"none",s=t?.create&&t?.update?"full":t?.create||t?.update?"partial":"none",d=t?.delete?"full":"none";return{canRead:!!t?.read,canWrite:!!t?.write,canDelete:!!t?.delete,readState:n,writeState:s,deleteState:d}}import{jsx as v,jsxs as W}from"react/jsx-runtime";var X={full:{bg:"#ecfdf5",text:"#047857",border:"#a7f3d0"},partial:{bg:"#fffbeb",text:"#b45309",border:"#fde68a"},none:{bg:"#f8fafc",text:"#94a3b8",border:"#cbd5e1"}};function ee({state:t}){return t==="full"?v("svg",{style:{width:"0.85rem",height:"0.85rem",flexShrink:0},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):t==="partial"?v("svg",{style:{width:"0.85rem",height:"0.85rem",flexShrink:0},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}):v("svg",{style:{width:"0.85rem",height:"0.85rem",flexShrink:0},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"})})}function V({permission:t,labels:n,showScopeSummary:s=!0,className:d="authz-permission-indicator"}){let o=q(t),m={read:n?.read??"\u95B2\u89A7",write:n?.write??"\u7DE8\u96C6",delete:n?.delete??"\u524A\u9664"},l=(y,h,f)=>{let A=X[h];return W("span",{"data-perm":y,"data-state":h,title:`${f}: ${h}`,style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",padding:"0.2rem 0.5rem",borderRadius:"100px",fontSize:"0.75rem",fontWeight:600,backgroundColor:A.bg,color:A.text,border:`1px solid ${A.border}`,lineHeight:1,userSelect:"none"},children:[v(ee,{state:h}),v("span",{children:f})]})};return W("span",{className:d,"data-resource":t?.resourceKey??"",style:{display:"inline-flex",gap:"0.35rem",alignItems:"center",verticalAlign:"middle"},children:[l("read",o.readState,m.read),l("write",o.writeState,m.write),l("delete",o.deleteState,m.delete),s&&o.readState==="partial"?v("span",{"data-perm":"scope",style:{fontSize:"0.7rem",color:"#b45309",backgroundColor:"#fef3c7",padding:"0.15rem 0.35rem",borderRadius:"4px",fontWeight:600},children:"\u90E8\u5206\u5236\u9650"}):null]})}import{Fragment as ce,jsx as e,jsxs as c}from"react/jsx-runtime";var _=t=>t?.error;function G({children:t}){let{myPermissions:n,labels:s,adminResourceKey:d,basePath:o}=x(),m=o??"/authz",l=[["roles",s.tabs.roles],["resources",s.tabs.resources],["role_permissions",s.tabs.role_permissions],["user_roles",s.tabs.user_roles]];return c("div",{className:"authz-admin",style:r.page,children:[c("header",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap"},children:[e("h1",{style:{fontSize:"1.3rem",margin:0,fontWeight:700},children:s.title}),c("span",{style:{fontSize:"0.82rem",color:"#475569",display:"inline-flex",alignItems:"center",gap:"0.4rem"},children:[s.myPermission,": ",e(V,{permission:n[d]})]})]}),e("nav",{style:{display:"flex",gap:"0.25rem",borderBottom:"1px solid #e2e8f0",margin:"0.9rem 0 1.25rem"},children:l.map(([y,h])=>e(re,{to:`${m}/${y}`,style:({isActive:f})=>({padding:"0.5rem 0.9rem",textDecoration:"none",color:f?"#2563eb":"#475569",borderBottom:f?"2px solid #2563eb":"2px solid transparent",marginBottom:-1,fontWeight:f?700:500,fontSize:"0.92rem"}),children:h},y))}),t]})}function Fe(){return e(G,{children:e(ne,{})})}function se(t){let n=I(t).error;return function(){let d=oe(),o=te(d)?d:null,m=o?.status===403,l=m?n.forbiddenTitle:o?`${n.genericTitlePrefix} (${o.status})`:n.genericTitle,y=m?n.forbiddenBody:o?typeof o.data=="string"&&o.data?o.data:o.statusText:n.genericBody;return e("div",{style:r.page,children:c("div",{role:"alert",style:{maxWidth:480,margin:"3rem auto",padding:"1.5rem",border:"1px solid #fecaca",borderRadius:12,background:"#fef2f2"},children:[e("h1",{style:{fontSize:"1.1rem",fontWeight:700,color:"#b91c1c",margin:"0 0 0.5rem"},children:l}),e("p",{style:{color:"#7f1d1d",fontSize:"0.9rem",margin:0,lineHeight:1.7},children:y})]})})}}var Te=se(),U=(t,n)=>s=>{t&&!window.confirm(n)&&s.preventDefault()};function B(){let{roles:t,selfAdminRoleIds:n,labels:s}=x(),d=s.roles,o=s.common,m=new Set(n??[]);return c("section",{children:[e("h2",{style:r.h2,children:d.heading}),e(k,{message:_(D())}),e("p",{style:r.note,children:d.note}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"20%"},children:d.roleKey}),e("th",{style:{...r.th,width:"25%"},children:d.name}),e("th",{style:{...r.th,width:"35%"},children:d.description}),e("th",{style:{...r.th,width:"10%"},children:d.activeHeader}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(l=>c("tr",{children:[e("td",{style:r.td,children:l.roleKey==="@authenticated"||l.roleKey==="@anonymous"?e("span",{style:r.code,children:l.roleKey}):e("input",{name:"roleKey",defaultValue:l.roleKey,form:`save-role-${l.id}`,"aria-label":`roleKey-${l.id}`,required:!0,style:r.input})}),e("td",{style:r.td,children:e("input",{name:"name",defaultValue:l.name,form:`save-role-${l.id}`,"aria-label":`name-${l.id}`,required:!0,style:r.input})}),e("td",{style:r.td,children:e("input",{name:"description",defaultValue:l.description??"",form:`save-role-${l.id}`,"aria-label":`description-${l.id}`,style:r.input})}),e("td",{style:r.td,children:c(R,{method:"post",style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"toggle"}),e("input",{type:"hidden",name:"id",value:l.id}),e("input",{type:"hidden",name:"isActive",value:String(!l.isActive)}),e("button",{type:"submit",style:r.button,onClick:l.isActive?U(m.has(l.id),s.warn.selfRoleDisable):void 0,children:l.isActive?o.active:o.inactive})]})}),c("td",{style:{...r.td,whiteSpace:"nowrap"},children:[c(R,{method:"post",id:`save-role-${l.id}`,style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"save"}),e("input",{type:"hidden",name:"id",value:l.id}),e("button",{type:"submit",style:r.save,children:o.save})]}),c(R,{method:"post",style:{display:"inline",marginLeft:"0.4rem"},children:[e("input",{type:"hidden",name:"_action",value:"delete"}),e("input",{type:"hidden",name:"id",value:l.id}),e("button",{type:"submit",style:r.danger,onClick:U(m.has(l.id),s.warn.selfRoleDelete),children:o.delete})]})]})]},l.id)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:5,children:d.empty})}):null]})]})}),e("h3",{style:r.h3,children:d.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"create"}),e(w,{label:d.roleKey,hint:d.hintRoleKey,children:e("input",{name:"roleKey","aria-label":"role_key",required:!0,style:r.input})}),e(w,{label:d.name,children:e("input",{name:"name","aria-label":"name",required:!0,style:r.input})}),e(w,{label:d.description,hint:o.optional,children:e("input",{name:"description","aria-label":"description",style:r.input})}),e("button",{type:"submit",style:r.primary,children:o.add})]})]})}function ie(){let{resources:t,labels:n}=x(),s=n.resources,d=n.common;return c("section",{children:[e("h2",{style:r.h2,children:s.heading}),e(k,{message:_(D())}),e("p",{style:r.note,children:s.note}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"15%"},children:s.appKey}),e("th",{style:{...r.th,width:"20%"},children:s.resourceKey}),e("th",{style:{...r.th,width:"25%"},children:s.name}),e("th",{style:{...r.th,width:"30%"},children:s.description}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(o=>c("tr",{children:[e("td",{style:r.td,children:e("span",{style:r.code,children:o.appKey})}),e("td",{style:r.td,children:e("span",{style:r.code,children:o.resourceKey})}),e("td",{style:r.td,children:e("input",{name:"name",defaultValue:o.name,form:`save-res-${o.id}`,"aria-label":`name-${o.id}`,required:!0,style:r.input})}),e("td",{style:r.td,children:e("input",{name:"description",defaultValue:o.description??"",form:`save-res-${o.id}`,"aria-label":`description-${o.id}`,style:r.input})}),c("td",{style:{...r.td,whiteSpace:"nowrap"},children:[c(R,{method:"post",id:`save-res-${o.id}`,style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"save"}),e("input",{type:"hidden",name:"id",value:o.id}),e("button",{type:"submit",style:r.save,children:d.save})]}),c(R,{method:"post",style:{display:"inline",marginLeft:"0.4rem"},children:[e("input",{type:"hidden",name:"_action",value:"delete"}),e("input",{type:"hidden",name:"id",value:o.id}),e("button",{type:"submit",style:r.danger,children:d.delete})]})]})]},o.id)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:5,children:s.empty})}):null]})]})}),e("h3",{style:r.h3,children:s.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"create"}),e(w,{label:s.appKey,hint:s.hintAppKey,children:e("input",{name:"appKey","aria-label":"app_key",required:!0,style:r.input})}),e(w,{label:s.resourceKey,hint:s.hintResourceKey,children:e("input",{name:"resourceKey","aria-label":"resource_key",required:!0,style:r.input})}),e(w,{label:s.name,children:e("input",{name:"name","aria-label":"name",required:!0,style:r.input})}),e(w,{label:s.description,hint:d.optional,children:e("input",{name:"description","aria-label":"description",style:r.input})}),e("button",{type:"submit",style:r.primary,children:d.add})]})]})}function ae({g:t,labels:n}){let s=n.common,[d,o]=P({label:t.action,value:t.action});return c("tr",{children:[e("td",{style:r.td,children:e("span",{style:r.code,children:t.roleKey})}),e("td",{style:r.td,children:c("span",{style:r.code,children:[t.appKey,":",t.resourceKey]})}),e("td",{style:r.td,children:t.roleKey==="@anonymous"?e("span",{style:r.code,children:t.action}):c(ce,{children:[e("input",{type:"hidden",name:"action",value:d.value,form:`save-grant-${t.id}`}),e(z,{options:H.map(m=>({label:m,value:m})),value:d,onChange:m=>{m&&o(m)}})]})}),e("td",{style:r.td,children:e("textarea",{name:"rowScope",defaultValue:t.rowScope??"",form:`save-grant-${t.id}`,"aria-label":`row_scope-${t.id}`,rows:2,placeholder:n.grants.rowScopePlaceholder,style:r.textarea})}),e("td",{style:r.td,children:e("textarea",{name:"columnScope",defaultValue:t.columnScope??"",form:`save-grant-${t.id}`,"aria-label":`column_scope-${t.id}`,rows:2,placeholder:n.grants.columnScopePlaceholder,style:r.textarea})}),c("td",{style:{...r.td,whiteSpace:"nowrap"},children:[c(R,{method:"post",id:`save-grant-${t.id}`,style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"save"}),e("input",{type:"hidden",name:"id",value:t.id}),e("button",{type:"submit",style:r.save,children:s.save})]}),c(R,{method:"post",style:{display:"inline",marginLeft:"0.4rem"},children:[e("input",{type:"hidden",name:"_action",value:"delete"}),e("input",{type:"hidden",name:"id",value:t.id}),e("button",{type:"submit",style:r.danger,children:s.delete})]})]})]})}function le(){let{grants:t,roles:n,resources:s,labels:d}=x(),o=d.grants,m=d.common,l=n.map(i=>({label:i.roleKey,value:i.id})),y=s.map(i=>({label:`${i.appKey}:${i.resourceKey}`,value:i.id})),h=H.map(i=>({label:i,value:i})),[f,A]=P(void 0),[u,a]=P(void 0),[g,p]=P({label:"read",value:"read"});return c("section",{children:[e("h2",{style:r.h2,children:o.heading}),e("p",{style:r.note,children:o.note}),e(k,{message:_(D())}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"15%"},children:o.role}),e("th",{style:{...r.th,width:"20%"},children:o.resource}),e("th",{style:{...r.th,width:"15%"},children:o.action}),e("th",{style:{...r.th,width:"20%"},children:o.rowScope}),e("th",{style:{...r.th,width:"20%"},children:o.columnScope}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(i=>e(ae,{g:i,labels:d},i.id)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:6,children:o.empty})}):null]})]})}),e("h3",{style:r.h3,children:o.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"create"}),e("input",{type:"hidden",name:"roleId",value:f?.value??""}),e("input",{type:"hidden",name:"resourceId",value:u?.value??""}),e("input",{type:"hidden",name:"action",value:g?.value??""}),e(w,{label:o.role,children:e(z,{options:l,value:f,onChange:i=>A(i||void 0),placeholder:o.selectPlaceholder})}),e(w,{label:o.resource,children:e(z,{options:y,value:u,onChange:i=>a(i||void 0),placeholder:o.selectPlaceholder})}),e(w,{label:o.action,children:e(z,{options:h,value:g,onChange:i=>p(i||void 0)})}),e(w,{label:o.rowScope,hint:o.rowScopeHint,children:e("textarea",{name:"rowScope","aria-label":"row_scope",rows:2,style:r.textarea,placeholder:'{"filters":[{"field":"\u90E8\u9580CD","op":"in","values":["A"]}]}'})}),e(w,{label:o.columnScope,hint:o.columnScopeHint,children:e("textarea",{name:"columnScope","aria-label":"column_scope",rows:2,style:r.textarea,placeholder:'{"mode":"deny","columns":["\u91D1\u984D"]}'})}),e("button",{type:"submit",style:r.primary,children:m.grant})]})]})}function de(){let{assignments:t,roles:n,users:s,actorUserId:d,selfAdminRoleIds:o,labels:m}=x(),l=m.userRoles,y=m.common,h=new Set(o??[]),f=s.map(i=>({label:`${i.email}\uFF08${i.displayName}\uFF09`,value:i.id})),A=n.filter(i=>i.roleKey!=="@authenticated"&&i.roleKey!=="@anonymous").map(i=>({label:i.roleKey,value:i.id})),[u,a]=P(void 0),[g,p]=P(void 0);return c("section",{children:[e("h2",{style:r.h2,children:l.heading}),e(k,{message:_(D())}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"45%"},children:l.user}),e("th",{style:{...r.th,width:"45%"},children:l.role}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(i=>c("tr",{children:[c("td",{style:r.td,children:[i.email,c("span",{style:r.muted,children:["\uFF08",i.displayName,"\uFF09"]})]}),e("td",{style:r.td,children:i.roleKey}),e("td",{style:r.td,children:c(R,{method:"post",style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"remove"}),e("input",{type:"hidden",name:"userId",value:i.userId}),e("input",{type:"hidden",name:"roleId",value:i.roleId}),e("button",{type:"submit",style:r.danger,onClick:U(i.userId===d&&h.has(i.roleId),m.warn.selfAssignmentRemove),children:y.remove})]})})]},`${i.userId}-${i.roleId}`)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:3,children:l.empty})}):null]})]})}),e("h3",{style:r.h3,children:l.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"assign"}),e("input",{type:"hidden",name:"userId",value:u?.value??""}),e("input",{type:"hidden",name:"roleId",value:g?.value??""}),e(w,{label:l.user,children:e(z,{options:f,value:u,onChange:i=>a(i||void 0),placeholder:l.selectPlaceholder})}),e(w,{label:l.role,children:e(z,{options:A,value:g,onChange:i=>p(i||void 0),placeholder:l.selectPlaceholder})}),e("button",{type:"submit",style:r.primary,children:y.assign})]})]})}var ue={roles:B,resources:ie,role_permissions:le,user_roles:de};function $e(){let{segment:t}=x(),n=ue[t]??B;return e(G,{children:e(n,{})})}import{can as C,createRequirePermission as me}from"@aiquants/authz-core";import{redirect as pe}from"react-router";function ye(t,n){let s=C(n,"read"),d=C(n,"create"),o=C(n,"update"),m=C(n,"delete"),l=n?.scopeByAction.read,y=s&&!!l&&(l.rowScope!==null||l.columnScope!==null);return{resourceKey:t,read:s,create:d,update:o,delete:m,write:d||o,readPartial:y,actions:n?Array.from(n.actions):[]}}function Ge(t){async function n(d,o,m){let l=m?.failureRedirect?()=>{throw pe(m.failureRedirect)}:t.onDeny;return me({resolveUserId:t.resolveUserId,getEffectivePermissions:t.getEffectivePermissions,onDeny:l})(d,{appKey:t.appKey,resourceKey:o.resourceKey,action:o.action})}async function s(d,o){let m=await t.resolveUserId(d),l={};for(let y of o.resourceKeys){let h=await t.getEffectivePermissions({userId:m??null,appKey:t.appKey,resourceKey:y});l[y]=ye(y,h)}return l}return{requirePermission:n,getMyPermissions:s}}export{$e as AuthzAdminAppView,Te as AuthzErrorBoundary,le as AuthzGrantsView,Fe as AuthzLayout,ie as AuthzResourcesView,B as AuthzRolesView,de as AuthzUserRolesView,k as ErrorAlert,w as Field,V as MyPermissionIndicator,Ge as createAuthz,Re as createAuthzAdminApp,T as createAuthzAdminServer,O as defaultAuthzAdminLabels,se as makeAuthzErrorBoundary,I as resolveLabels,ye as toPermissionView,r as ui,q as usePermission};
|
|
1
|
+
import{data as Z,redirect as j}from"react-router";import{AUTHZ_ACTIONS as F,AuthzDeniedError as T}from"@aiquants/authz-core";import{data as S,redirect as Q}from"react-router";var J={title:"Authorization (RBAC)",myPermission:"Your permissions",tabs:{roles:"Roles",resources:"Resources",role_permissions:"Permissions",user_roles:"User assignments"},common:{add:"Add",save:"Save",delete:"Delete",remove:"Remove",assign:"Assign",grant:"Grant",select:"Select\u2026",active:"\u25CB Enabled",inactive:"\xD7 Disabled",optional:"optional"},roles:{heading:"Roles (TMRole)",note:"Edit name / description inline and click Save (role_key is an immutable identifier).",roleKey:"role_key",name:"name",description:"description",activeHeader:"Active",empty:"No roles",newHeading:"New role",hintRoleKey:"e.g. admin"},resources:{heading:"Resources (TMResource)",note:"Edit name / description inline and click Save (app_key / resource_key are immutable identifiers).",appKey:"app_key",resourceKey:"resource_key",name:"name",description:"description",empty:"No resources",newHeading:"New resource",hintAppKey:"e.g. quants",hintResourceKey:"e.g. daily_report",hintDailyReport:"optional"},grants:{heading:"Permissions (TDRolePermission)",note:"Empty row_scope / column_scope = all rows / all columns (NULL). JSON must satisfy the \xA73.2 contract.",role:"role",resource:"resource",action:"action",rowScope:"row_scope",columnScope:"column_scope",empty:"No permissions",newHeading:"Grant a permission",rowScopeHint:"JSON / empty = all rows",columnScopeHint:"JSON / empty = all columns",rowScopePlaceholder:"empty = all rows (NULL)",columnScopePlaceholder:"empty = all columns (NULL)",nullRows:"NULL (all rows)",nullCols:"NULL (all columns)",selectPlaceholder:"Select\u2026"},userRoles:{heading:"User assignments (TDUserRole)",note:"Assign active roles to specific users.",user:"user",role:"role",empty:"No assignments",newHeading:"Assign a role",selectPlaceholder:"Select\u2026"},error:{forbiddenTitle:"Access denied",forbiddenBody:"You don't have permission to view this screen. Ask an administrator to grant access.",genericTitlePrefix:"Error",genericTitle:"An error occurred",genericBody:"An unexpected error occurred. Please try again later."},warn:{selfRoleDisable:"This role backs your own authorization-admin access. Disabling it may lock you out of this screen. Continue?",selfRoleDelete:"This role backs your own authorization-admin access. Deleting it may lock you out of this screen. Continue?",selfAssignmentRemove:"This assignment backs your own authorization-admin access. Removing it may lock you out of this screen. Continue?"}};function L(t){let n=J;return t?{title:t.title??n.title,myPermission:t.myPermission??n.myPermission,tabs:{...n.tabs,...t.tabs},common:{...n.common,...t.common},roles:{...n.roles,...t.roles},resources:{...n.resources,...t.resources},grants:{...n.grants,...t.grants},userRoles:{...n.userRoles,...t.userRoles},error:{...n.error,...t.error},warn:{...n.warn,...t.warn}}:n}var Y=t=>t instanceof Response;function D(t){if(Y(t))throw t;if(t instanceof T)throw new Response(t.message,{status:403});return S({error:t instanceof Error?t.message:"\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F"},{status:400})}function q(t){let n=t.store,s=t.resourceKey??"authz_admin",d=L(t.labels),o=async(u,a)=>{let{userId:f}=await t.requirePermission(u,a);if(f==null)throw new T({appKey:"",resourceKey:a.resourceKey,action:a.action,reason:"unresolved-user",userId:null});return{userId:f}};async function m(u){await t.requireUser(u);try{return await o(u,{resourceKey:s,action:"read"})}catch(a){throw a instanceof T?new Response(`Forbidden: ${s}`,{status:403}):a}}let l=u=>t.getMyPermissions(u,{resourceKeys:[s]}),y=async u=>{let[a,f]=await Promise.all([n.listRoles(),n.getSelfAdminContext(Number(u))]);return{roles:a,selfAdminRoleIds:f.selfAdminRoleIds,labels:d}},h=async()=>({resources:await n.listResources(),labels:d}),g=async()=>{let[u,a,f]=await Promise.all([n.listGrants(),n.listRoles(),n.listResources()]);return{grants:u,roles:a,resources:f,labels:d}},A=async u=>{let[a,f,p,i]=await Promise.all([n.listUserRoles(),n.listRoles(),n.listUsers(),n.getSelfAdminContext(Number(u))]);return{assignments:a,roles:f,users:p,actorUserId:i.actorUserId,selfAdminRoleIds:i.selfAdminRoleIds,labels:d}};return{labels:d,resourceKey:s,layoutGuard:m,loadMyPermissions:l,layout:{async loader({request:u}){return await m(u),{myPermissions:await l(u),labels:d,adminResourceKey:s}}},index:{loader(){throw Q("/authz/roles")}},roles:{data:y,async loader({request:u}){let{userId:a}=await o(u,{resourceKey:s,action:"read"});return y(a)},async action({request:u}){let a=await u.formData(),f=String(a.get("_action"));try{switch(f){case"create":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=String(a.get("roleKey")??"").trim(),b=String(a.get("name")??"").trim();return i&&b?(await n.createRole({roleKey:i,name:b,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"role_key \u3068 name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"save":{let{userId:p}=await o(u,{resourceKey:s,action:"update"}),i=String(a.get("roleKey")??"").trim(),b=String(a.get("name")??"").trim();return i&&b?(await n.updateRole(Number(a.get("id")),{roleKey:i,name:b,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"roleKey \u3068 name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"toggle":{let{userId:p}=await o(u,{resourceKey:s,action:"update"});return await n.setRoleActive(Number(a.get("id")),a.get("isActive")==="true",String(p)),{ok:!0}}case"delete":return await o(u,{resourceKey:s,action:"delete"}),await n.deleteRole(Number(a.get("id"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return D(p)}}},resources:{data:h,async loader({request:u}){return await o(u,{resourceKey:s,action:"read"}),h()},async action({request:u}){let a=await u.formData(),f=String(a.get("_action"));try{switch(f){case"create":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=String(a.get("appKey")??"").trim(),b=String(a.get("resourceKey")??"").trim(),P=String(a.get("name")??"").trim();return i&&b&&P?(await n.createResource({appKey:i,resourceKey:b,name:P,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"app_key / resource_key / name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"save":{let{userId:p}=await o(u,{resourceKey:s,action:"update"}),i=String(a.get("name")??"").trim();return i?(await n.updateResource(Number(a.get("id")),{name:i,description:String(a.get("description")??"").trim()||null},String(p)),{ok:!0}):S({error:"name \u306F\u5FC5\u9808\u3067\u3059"},{status:400})}case"delete":return await o(u,{resourceKey:s,action:"delete"}),await n.deleteResource(Number(a.get("id"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return D(p)}}},grants:{data:g,async loader({request:u}){return await o(u,{resourceKey:s,action:"read"}),g()},async action({request:u}){let a=await u.formData(),f=String(a.get("_action"));try{switch(f){case"create":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=Number(a.get("roleId")),b=Number(a.get("resourceId"));if(!(i&&b))return S({error:"\u30ED\u30FC\u30EB\u3068\u30EA\u30BD\u30FC\u30B9\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"},{status:400});let P=String(a.get("action")??"");if(!F.includes(P))return S({error:"\u7121\u52B9\u306A action \u3067\u3059"},{status:400});let E=P;return await n.createGrant({roleId:i,resourceId:b,action:E,rowScope:String(a.get("rowScope")??""),columnScope:String(a.get("columnScope")??"")},String(p)),{ok:!0}}case"save":{let{userId:p}=await o(u,{resourceKey:s,action:"update"}),i=String(a.get("action")??"");if(!F.includes(i))return S({error:"\u7121\u52B9\u306A action \u3067\u3059"},{status:400});let b=i;return await n.updateGrant(Number(a.get("id")),{action:b,rowScope:String(a.get("rowScope")??""),columnScope:String(a.get("columnScope")??"")},String(p)),{ok:!0}}case"delete":return await o(u,{resourceKey:s,action:"delete"}),await n.deleteGrant(Number(a.get("id"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return D(p)}}},userRoles:{data:A,async loader({request:u}){let{userId:a}=await o(u,{resourceKey:s,action:"read"});return A(a)},async action({request:u}){let a=await u.formData(),f=String(a.get("_action"));try{switch(f){case"assign":{let{userId:p}=await o(u,{resourceKey:s,action:"create"}),i=Number(a.get("userId")),b=Number(a.get("roleId"));return i&&b?(await n.assignUserRole(i,b,String(p)),{ok:!0}):S({error:"\u30E6\u30FC\u30B6\u30FC\u3068\u30ED\u30FC\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"},{status:400})}case"remove":return await o(u,{resourceKey:s,action:"delete"}),await n.removeUserRole(Number(a.get("userId")),Number(a.get("roleId"))),{ok:!0};default:return S({error:"unknown action"},{status:400})}}catch(p){return D(p)}}}}}function W(t){return String(t["*"]??"").split("/")[0]}function Pe(t){let n=q(t),s=t.basePath??"/authz",d=["roles","resources","role_permissions","user_roles"],o={roles:n.roles.data,resources:n.resources.data,role_permissions:n.grants.data,user_roles:n.userRoles.data},m={roles:n.roles.action,resources:n.resources.action,role_permissions:n.grants.action,user_roles:n.userRoles.action};async function l(h){let g=W(h.params);if(!d.includes(g))throw j(`${s}/roles`);let{userId:A}=await n.layoutGuard(h.request),[u,a]=await Promise.all([n.loadMyPermissions(h.request),o[g](A)]);return{segment:g,basePath:s,myPermissions:u,adminResourceKey:n.resourceKey,...a}}async function y(h){let g=W(h.params),A=m[g];return A?A(h):Z({error:"unknown action"},{status:400})}return{loader:l,action:y,server:n}}import{jsx as X,jsxs as $}from"react/jsx-runtime";var r={page:{padding:"1.25rem",maxWidth:1280,margin:"0 auto",color:"#0f172a"},tableContainer:{width:"100%",overflowX:"auto",marginBottom:"1rem",WebkitOverflowScrolling:"touch"},table:{borderCollapse:"collapse",width:"100%",fontSize:"0.9rem",tableLayout:"fixed"},th:{textAlign:"left",borderBottom:"2px solid #e2e8f0",padding:"0.45rem 0.65rem",fontSize:"0.78rem",color:"#475569",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.03em"},td:{borderBottom:"1px solid #f1f5f9",padding:"0.5rem 0.65rem",verticalAlign:"middle",wordBreak:"break-all"},input:{padding:"0.4rem 0.55rem",border:"1px solid #cbd5e1",borderRadius:6,fontSize:"0.9rem",background:"#fff",width:"100%",boxSizing:"border-box"},select:{padding:"0.4rem 0.55rem",border:"1px solid #cbd5e1",borderRadius:6,fontSize:"0.9rem",background:"#fff",width:"100%",boxSizing:"border-box"},textarea:{padding:"0.4rem 0.55rem",border:"1px solid #cbd5e1",borderRadius:6,fontSize:"0.82rem",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",minHeight:"3.25rem",resize:"vertical",width:"100%",boxSizing:"border-box"},button:{padding:"0.3rem 0.7rem",border:"1px solid #cbd5e1",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:"0.82rem",color:"#334155"},save:{padding:"0.3rem 0.7rem",border:"1px solid #2563eb",borderRadius:6,background:"#eff6ff",cursor:"pointer",fontSize:"0.82rem",color:"#2563eb",fontWeight:600},danger:{padding:"0.3rem 0.7rem",border:"1px solid #fecaca",borderRadius:6,background:"#fff",cursor:"pointer",fontSize:"0.82rem",color:"#dc2626"},primary:{padding:"0.5rem 1.25rem",border:"1px solid #2563eb",borderRadius:6,background:"#2563eb",color:"#fff",cursor:"pointer",fontSize:"0.9rem",fontWeight:600,alignSelf:"flex-start"},card:{display:"flex",flexDirection:"column",gap:"0.85rem",maxWidth:600,marginTop:"0.75rem",padding:"1rem 1.1rem",border:"1px solid #e2e8f0",borderRadius:10,background:"#f8fafc"},code:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:"0.78rem",color:"#334155",wordBreak:"break-all"},muted:{color:"#94a3b8"},h2:{fontSize:"1.05rem",margin:"0 0 0.35rem",fontWeight:700},h3:{fontSize:"0.92rem",margin:"1.25rem 0 0",color:"#334155",fontWeight:600},note:{color:"#64748b",fontSize:"0.82rem",margin:"0 0 0.75rem"},empty:{color:"#94a3b8",padding:"0.75rem 0.65rem"}};function w({label:t,hint:n,children:s}){return $("div",{style:{display:"flex",flexDirection:"column",gap:"0.3rem"},children:[$("span",{style:{fontSize:"0.8rem",color:"#475569",fontWeight:600},children:[t,n?$("span",{style:{fontWeight:400,color:"#94a3b8"},children:[" \u2014 ",n]}):null]}),s]})}function k({message:t}){return t?X("p",{role:"alert",style:{color:"#dc2626",background:"#fef2f2",border:"1px solid #fecaca",borderRadius:8,padding:"0.55rem 0.8rem",fontSize:"0.85rem",margin:"0.25rem 0"},children:t}):null}import{AUTHZ_ACTIONS as H}from"@aiquants/authz-core";import{SelectBox as z}from"@aiquants/select-box";import{useState as x}from"react";import{Form as R,isRouteErrorResponse as ne,NavLink as oe,Outlet as se,useActionData as _,useLoaderData as K,useRouteError as ie}from"react-router";function M(t){let n=t?.read?t.readPartial?"partial":"full":"none",s=t?.create&&t?.update?"full":t?.create||t?.update?"partial":"none",d=t?.delete?"full":"none";return{canRead:!!t?.read,canWrite:!!t?.write,canDelete:!!t?.delete,readState:n,writeState:s,deleteState:d}}import{jsx as v,jsxs as I}from"react/jsx-runtime";var ee={full:{bg:"#ecfdf5",text:"#047857",border:"#a7f3d0"},partial:{bg:"#fffbeb",text:"#b45309",border:"#fde68a"},none:{bg:"#f8fafc",text:"#94a3b8",border:"#cbd5e1"}};function V(t,n){let s=t?.trim(),d=n?.trim();if(d&&s&&d!==s)return`\u5BFE\u8C61\u30EA\u30BD\u30FC\u30B9: ${d} (${s})`;if(d||s)return`\u5BFE\u8C61\u30EA\u30BD\u30FC\u30B9: ${d||s}`}function te({state:t}){return t==="full"?v("svg",{style:{width:"0.85rem",height:"0.85rem",flexShrink:0},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):t==="partial"?v("svg",{style:{width:"0.85rem",height:"0.85rem",flexShrink:0},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}):v("svg",{style:{width:"0.85rem",height:"0.85rem",flexShrink:0},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,"aria-hidden":"true",children:v("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"})})}function re({permission:t,resourceName:n,expectedResourceKey:s,showResourceTooltip:d=!0,labels:o,showScopeSummary:m=!0,className:l="authz-permission-indicator"}){let y=M(t),h={read:o?.read??"\u95B2\u89A7",write:o?.write??"\u7DE8\u96C6",delete:o?.delete??"\u524A\u9664"},g=t?.resourceKey,A=n||g,u=d?V(g,n):void 0,a=!!(s&&g&&g!==s);a&&typeof console<"u"&&typeof console.error=="function"&&console.error(`[Authz Warning] Resource key mismatch in MyPermissionIndicator! Expected: "${s}", but received permission for: "${g}".`);let f=(p,i,b)=>{let P=ee[i],E=u?`${b}: ${i}
|
|
2
|
+
${u}`:`${b}: ${i}`;return I("span",{"data-perm":p,"data-state":i,title:E,style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",padding:"0.2rem 0.5rem",borderRadius:"100px",fontSize:"0.75rem",fontWeight:600,backgroundColor:P.bg,color:P.text,border:`1px solid ${P.border}`,lineHeight:1,userSelect:"none"},children:[v(te,{state:i}),v("span",{children:b})]})};return I("span",{className:l,title:u,"data-resource":g??"","data-resource-name":A??"","data-mismatch":a?"true":void 0,style:{display:"inline-flex",gap:"0.35rem",alignItems:"center",verticalAlign:"middle"},children:[f("read",y.readState,h.read),f("write",y.writeState,h.write),f("delete",y.deleteState,h.delete),m&&y.readState==="partial"?v("span",{"data-perm":"scope",title:u,style:{fontSize:"0.7rem",color:"#b45309",backgroundColor:"#fef3c7",padding:"0.15rem 0.35rem",borderRadius:"4px",fontWeight:600},children:"\u90E8\u5206\u5236\u9650"}):null,a?I("span",{"data-testid":"resource-mismatch-warning",title:`expected: "${s}", actual: "${g}"`,style:{fontSize:"0.7rem",color:"#991b1b",backgroundColor:"#fee2e2",border:"1px solid #fca5a5",padding:"0.15rem 0.35rem",borderRadius:"4px",fontWeight:700},children:["\u26A0\uFE0F \u30EA\u30BD\u30FC\u30B9\u4E0D\u4E00\u81F4 (",g," \u2260 ",s,")"]}):null]})}function G({permission:t,resourceName:n,expectedResourceKey:s,prefixLabel:d="\u3042\u306A\u305F\u306E\u6A29\u9650",showPrefixLabel:o=!0,showResourceTooltip:m=!0,labels:l,showScopeSummary:y=!0,className:h="authz-permission-status",style:g}){let A=t?.resourceKey,u=n||A,a=m?V(A,n):void 0;return I("span",{className:h,title:a,"data-testid":"my-permission-status","data-resource":A??"","data-resource-name":u??"",style:{fontSize:"0.82rem",color:"#475569",display:"inline-flex",alignItems:"center",gap:"0.4rem",...g},children:[o&&I("span",{"data-testid":"prefix-label",children:[d,":"]}),v(re,{permission:t,resourceName:n,expectedResourceKey:s,showResourceTooltip:m,labels:l,showScopeSummary:y})]})}import{Fragment as pe,jsx as e,jsxs as c}from"react/jsx-runtime";var C=t=>t?.error;function B({children:t}){let{myPermissions:n,labels:s,adminResourceKey:d,basePath:o}=K(),m=o??"/authz",l=[["roles",s.tabs.roles],["resources",s.tabs.resources],["role_permissions",s.tabs.role_permissions],["user_roles",s.tabs.user_roles]];return c("div",{className:"authz-admin",style:r.page,children:[c("header",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap"},children:[e("h1",{style:{fontSize:"1.3rem",margin:0,fontWeight:700},children:s.title}),e(G,{prefixLabel:s.myPermission,permission:n[d],resourceName:d})]}),e("nav",{style:{display:"flex",gap:"0.25rem",borderBottom:"1px solid #e2e8f0",margin:"0.9rem 0 1.25rem"},children:l.map(([y,h])=>e(oe,{to:`${m}/${y}`,style:({isActive:g})=>({padding:"0.5rem 0.9rem",textDecoration:"none",color:g?"#2563eb":"#475569",borderBottom:g?"2px solid #2563eb":"2px solid transparent",marginBottom:-1,fontWeight:g?700:500,fontSize:"0.92rem"}),children:h},y))}),t]})}function qe(){return e(B,{children:e(se,{})})}function ae(t){let n=L(t).error;return function(){let d=ie(),o=ne(d)?d:null,m=o?.status===403,l=m?n.forbiddenTitle:o?`${n.genericTitlePrefix} (${o.status})`:n.genericTitle,y=m?n.forbiddenBody:o?typeof o.data=="string"&&o.data?o.data:o.statusText:n.genericBody;return e("div",{style:r.page,children:c("div",{role:"alert",style:{maxWidth:480,margin:"3rem auto",padding:"1.5rem",border:"1px solid #fecaca",borderRadius:12,background:"#fef2f2"},children:[e("h1",{style:{fontSize:"1.1rem",fontWeight:700,color:"#b91c1c",margin:"0 0 0.5rem"},children:l}),e("p",{style:{color:"#7f1d1d",fontSize:"0.9rem",margin:0,lineHeight:1.7},children:y})]})})}}var We=ae(),U=(t,n)=>s=>{t&&!window.confirm(n)&&s.preventDefault()};function O(){let{roles:t,selfAdminRoleIds:n,labels:s}=K(),d=s.roles,o=s.common,m=new Set(n??[]);return c("section",{children:[e("h2",{style:r.h2,children:d.heading}),e(k,{message:C(_())}),e("p",{style:r.note,children:d.note}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"20%"},children:d.roleKey}),e("th",{style:{...r.th,width:"25%"},children:d.name}),e("th",{style:{...r.th,width:"35%"},children:d.description}),e("th",{style:{...r.th,width:"10%"},children:d.activeHeader}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(l=>c("tr",{children:[e("td",{style:r.td,children:l.roleKey==="@authenticated"||l.roleKey==="@anonymous"?e("span",{style:r.code,children:l.roleKey}):e("input",{name:"roleKey",defaultValue:l.roleKey,form:`save-role-${l.id}`,"aria-label":`roleKey-${l.id}`,required:!0,style:r.input})}),e("td",{style:r.td,children:e("input",{name:"name",defaultValue:l.name,form:`save-role-${l.id}`,"aria-label":`name-${l.id}`,required:!0,style:r.input})}),e("td",{style:r.td,children:e("input",{name:"description",defaultValue:l.description??"",form:`save-role-${l.id}`,"aria-label":`description-${l.id}`,style:r.input})}),e("td",{style:r.td,children:c(R,{method:"post",style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"toggle"}),e("input",{type:"hidden",name:"id",value:l.id}),e("input",{type:"hidden",name:"isActive",value:String(!l.isActive)}),e("button",{type:"submit",style:r.button,onClick:l.isActive?U(m.has(l.id),s.warn.selfRoleDisable):void 0,children:l.isActive?o.active:o.inactive})]})}),c("td",{style:{...r.td,whiteSpace:"nowrap"},children:[c(R,{method:"post",id:`save-role-${l.id}`,style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"save"}),e("input",{type:"hidden",name:"id",value:l.id}),e("button",{type:"submit",style:r.save,children:o.save})]}),c(R,{method:"post",style:{display:"inline",marginLeft:"0.4rem"},children:[e("input",{type:"hidden",name:"_action",value:"delete"}),e("input",{type:"hidden",name:"id",value:l.id}),e("button",{type:"submit",style:r.danger,onClick:U(m.has(l.id),s.warn.selfRoleDelete),children:o.delete})]})]})]},l.id)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:5,children:d.empty})}):null]})]})}),e("h3",{style:r.h3,children:d.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"create"}),e(w,{label:d.roleKey,hint:d.hintRoleKey,children:e("input",{name:"roleKey","aria-label":"role_key",required:!0,style:r.input})}),e(w,{label:d.name,children:e("input",{name:"name","aria-label":"name",required:!0,style:r.input})}),e(w,{label:d.description,hint:o.optional,children:e("input",{name:"description","aria-label":"description",style:r.input})}),e("button",{type:"submit",style:r.primary,children:o.add})]})]})}function le(){let{resources:t,labels:n}=K(),s=n.resources,d=n.common;return c("section",{children:[e("h2",{style:r.h2,children:s.heading}),e(k,{message:C(_())}),e("p",{style:r.note,children:s.note}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"15%"},children:s.appKey}),e("th",{style:{...r.th,width:"20%"},children:s.resourceKey}),e("th",{style:{...r.th,width:"25%"},children:s.name}),e("th",{style:{...r.th,width:"30%"},children:s.description}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(o=>c("tr",{children:[e("td",{style:r.td,children:e("span",{style:r.code,children:o.appKey})}),e("td",{style:r.td,children:e("span",{style:r.code,children:o.resourceKey})}),e("td",{style:r.td,children:e("input",{name:"name",defaultValue:o.name,form:`save-res-${o.id}`,"aria-label":`name-${o.id}`,required:!0,style:r.input})}),e("td",{style:r.td,children:e("input",{name:"description",defaultValue:o.description??"",form:`save-res-${o.id}`,"aria-label":`description-${o.id}`,style:r.input})}),c("td",{style:{...r.td,whiteSpace:"nowrap"},children:[c(R,{method:"post",id:`save-res-${o.id}`,style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"save"}),e("input",{type:"hidden",name:"id",value:o.id}),e("button",{type:"submit",style:r.save,children:d.save})]}),c(R,{method:"post",style:{display:"inline",marginLeft:"0.4rem"},children:[e("input",{type:"hidden",name:"_action",value:"delete"}),e("input",{type:"hidden",name:"id",value:o.id}),e("button",{type:"submit",style:r.danger,children:d.delete})]})]})]},o.id)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:5,children:s.empty})}):null]})]})}),e("h3",{style:r.h3,children:s.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"create"}),e(w,{label:s.appKey,hint:s.hintAppKey,children:e("input",{name:"appKey","aria-label":"app_key",required:!0,style:r.input})}),e(w,{label:s.resourceKey,hint:s.hintResourceKey,children:e("input",{name:"resourceKey","aria-label":"resource_key",required:!0,style:r.input})}),e(w,{label:s.name,children:e("input",{name:"name","aria-label":"name",required:!0,style:r.input})}),e(w,{label:s.description,hint:d.optional,children:e("input",{name:"description","aria-label":"description",style:r.input})}),e("button",{type:"submit",style:r.primary,children:d.add})]})]})}function de({g:t,labels:n}){let s=n.common,[d,o]=x({label:t.action,value:t.action});return c("tr",{children:[e("td",{style:r.td,children:e("span",{style:r.code,children:t.roleKey})}),e("td",{style:r.td,children:c("span",{style:r.code,children:[t.appKey,":",t.resourceKey]})}),e("td",{style:r.td,children:t.roleKey==="@anonymous"?e("span",{style:r.code,children:t.action}):c(pe,{children:[e("input",{type:"hidden",name:"action",value:d.value,form:`save-grant-${t.id}`}),e(z,{options:H.map(m=>({label:m,value:m})),value:d,onChange:m=>{m&&o(m)}})]})}),e("td",{style:r.td,children:e("textarea",{name:"rowScope",defaultValue:t.rowScope??"",form:`save-grant-${t.id}`,"aria-label":`row_scope-${t.id}`,rows:2,placeholder:n.grants.rowScopePlaceholder,style:r.textarea})}),e("td",{style:r.td,children:e("textarea",{name:"columnScope",defaultValue:t.columnScope??"",form:`save-grant-${t.id}`,"aria-label":`column_scope-${t.id}`,rows:2,placeholder:n.grants.columnScopePlaceholder,style:r.textarea})}),c("td",{style:{...r.td,whiteSpace:"nowrap"},children:[c(R,{method:"post",id:`save-grant-${t.id}`,style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"save"}),e("input",{type:"hidden",name:"id",value:t.id}),e("button",{type:"submit",style:r.save,children:s.save})]}),c(R,{method:"post",style:{display:"inline",marginLeft:"0.4rem"},children:[e("input",{type:"hidden",name:"_action",value:"delete"}),e("input",{type:"hidden",name:"id",value:t.id}),e("button",{type:"submit",style:r.danger,children:s.delete})]})]})]})}function ue(){let{grants:t,roles:n,resources:s,labels:d}=K(),o=d.grants,m=d.common,l=n.map(i=>({label:i.roleKey,value:i.id})),y=s.map(i=>({label:`${i.appKey}:${i.resourceKey}`,value:i.id})),h=H.map(i=>({label:i,value:i})),[g,A]=x(void 0),[u,a]=x(void 0),[f,p]=x({label:"read",value:"read"});return c("section",{children:[e("h2",{style:r.h2,children:o.heading}),e("p",{style:r.note,children:o.note}),e(k,{message:C(_())}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"15%"},children:o.role}),e("th",{style:{...r.th,width:"20%"},children:o.resource}),e("th",{style:{...r.th,width:"15%"},children:o.action}),e("th",{style:{...r.th,width:"20%"},children:o.rowScope}),e("th",{style:{...r.th,width:"20%"},children:o.columnScope}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(i=>e(de,{g:i,labels:d},i.id)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:6,children:o.empty})}):null]})]})}),e("h3",{style:r.h3,children:o.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"create"}),e("input",{type:"hidden",name:"roleId",value:g?.value??""}),e("input",{type:"hidden",name:"resourceId",value:u?.value??""}),e("input",{type:"hidden",name:"action",value:f?.value??""}),e(w,{label:o.role,children:e(z,{options:l,value:g,onChange:i=>A(i||void 0),placeholder:o.selectPlaceholder})}),e(w,{label:o.resource,children:e(z,{options:y,value:u,onChange:i=>a(i||void 0),placeholder:o.selectPlaceholder})}),e(w,{label:o.action,children:e(z,{options:h,value:f,onChange:i=>p(i||void 0)})}),e(w,{label:o.rowScope,hint:o.rowScopeHint,children:e("textarea",{name:"rowScope","aria-label":"row_scope",rows:2,style:r.textarea,placeholder:'{"filters":[{"field":"\u90E8\u9580CD","op":"in","values":["A"]}]}'})}),e(w,{label:o.columnScope,hint:o.columnScopeHint,children:e("textarea",{name:"columnScope","aria-label":"column_scope",rows:2,style:r.textarea,placeholder:'{"mode":"deny","columns":["\u91D1\u984D"]}'})}),e("button",{type:"submit",style:r.primary,children:m.grant})]})]})}function ce(){let{assignments:t,roles:n,users:s,actorUserId:d,selfAdminRoleIds:o,labels:m}=K(),l=m.userRoles,y=m.common,h=new Set(o??[]),g=s.map(i=>({label:`${i.email}\uFF08${i.displayName}\uFF09`,value:i.id})),A=n.filter(i=>i.roleKey!=="@authenticated"&&i.roleKey!=="@anonymous").map(i=>({label:i.roleKey,value:i.id})),[u,a]=x(void 0),[f,p]=x(void 0);return c("section",{children:[e("h2",{style:r.h2,children:l.heading}),e(k,{message:C(_())}),e("p",{style:r.note,children:l.note}),e("div",{style:r.tableContainer,children:c("table",{style:r.table,children:[e("thead",{children:c("tr",{children:[e("th",{style:{...r.th,width:"45%"},children:l.user}),e("th",{style:{...r.th,width:"45%"},children:l.role}),e("th",{style:{...r.th,width:"10%"}})]})}),c("tbody",{children:[t.map(i=>c("tr",{children:[c("td",{style:r.td,children:[i.email,c("span",{style:r.muted,children:["\uFF08",i.displayName,"\uFF09"]})]}),e("td",{style:r.td,children:i.roleKey}),e("td",{style:r.td,children:c(R,{method:"post",style:{display:"inline"},children:[e("input",{type:"hidden",name:"_action",value:"remove"}),e("input",{type:"hidden",name:"userId",value:i.userId}),e("input",{type:"hidden",name:"roleId",value:i.roleId}),e("button",{type:"submit",style:r.danger,onClick:U(i.userId===d&&h.has(i.roleId),m.warn.selfAssignmentRemove),children:y.remove})]})})]},`${i.userId}-${i.roleId}`)),t.length===0?e("tr",{children:e("td",{style:r.empty,colSpan:3,children:l.empty})}):null]})]})}),e("h3",{style:r.h3,children:l.newHeading}),c(R,{method:"post",style:r.card,children:[e("input",{type:"hidden",name:"_action",value:"assign"}),e("input",{type:"hidden",name:"userId",value:u?.value??""}),e("input",{type:"hidden",name:"roleId",value:f?.value??""}),e(w,{label:l.user,children:e(z,{options:g,value:u,onChange:i=>a(i||void 0),placeholder:l.selectPlaceholder})}),e(w,{label:l.role,children:e(z,{options:A,value:f,onChange:i=>p(i||void 0),placeholder:l.selectPlaceholder})}),e("button",{type:"submit",style:r.primary,children:y.assign})]})]})}var me={roles:O,resources:le,role_permissions:ue,user_roles:ce};function Me(){let{segment:t}=K(),n=me[t]??O;return e(B,{children:e(n,{})})}function He(t){return t}import{can as N,createRequirePermission as ye}from"@aiquants/authz-core";import{redirect as ge}from"react-router";function he(t,n){let s=N(n,"read"),d=N(n,"create"),o=N(n,"update"),m=N(n,"delete"),l=n?.scopeByAction.read,y=s&&!!l&&(l.rowScope!==null||l.columnScope!==null);return{resourceKey:t,read:s,create:d,update:o,delete:m,write:d||o,readPartial:y,actions:n?Array.from(n.actions):[]}}function Qe(t){async function n(o,m,l){let y=l?.failureRedirect?()=>{throw ge(l.failureRedirect)}:t.onDeny;return ye({resolveUserId:t.resolveUserId,getEffectivePermissions:t.getEffectivePermissions,onDeny:y})(o,{appKey:t.appKey,resourceKey:m.resourceKey,action:m.action})}async function s(o,m){let l=await t.resolveUserId(o),y={};for(let h of m.resourceKeys){let g=await t.getEffectivePermissions({userId:l??null,appKey:t.appKey,resourceKey:h});y[h]=he(h,g)}return y}async function d(o,m,l){let y=await n(o,m,l),h=await s(o,{resourceKeys:[m.resourceKey]});return{...y,permission:h[m.resourceKey]}}return{requirePermission:n,getMyPermissions:s,requireAndGetPermission:d}}export{Me as AuthzAdminAppView,We as AuthzErrorBoundary,ue as AuthzGrantsView,qe as AuthzLayout,le as AuthzResourcesView,O as AuthzRolesView,ce as AuthzUserRolesView,k as ErrorAlert,w as Field,re as MyPermissionIndicator,G as MyPermissionStatus,Qe as createAuthz,Pe as createAuthzAdminApp,q as createAuthzAdminServer,J as defaultAuthzAdminLabels,He as defineResources,V as formatResourceTooltip,ae as makeAuthzErrorBoundary,L as resolveLabels,he as toPermissionView,r as ui,M as usePermission};
|
|
2
3
|
//# sourceMappingURL=index.mjs.map
|