PageSourceSearch

https://ocsef.org/_app/immutable/nodes/84.BhBGYSZm.js

js ocsef.org collected 2026-10-06 20:06:25 UTC 6,085 bytes, 31 lines download raw bytes

1import"../chunks/DQfRr7yB.js";import"../chunks/CWj6FrbW.js";import"../chunks/BJbVj7NA.js";import{p as be,t as ge,l as _e,a as xe,i as ye,c as $e,h as Ae,f as Ee,b as j,d as g,e as De,s as Se,g as o,j as we,m as E,n as x,$ as Re,k as e,o as a,w as d,r as n,y as Ce,u as I,F as P,x as C,z as _,v as J,A as ke,C as Oe}from"../chunks/Dny-RSuS.js";import{g as Fe}from"../chunks/v8ff2ilO.js";import{d as D,c as ze,b as Ne,a as H,f as K}from"../chunks/dZSp_tBd.js";import{u as Te}from"../chunks/vDIXpj8a.js";async function je({url:M}){return{}}const We=Object.freeze(Object.defineProperty({__proto__:null,load:je},Symbol.toStringTag,{value:"Module"}));var Ie=x('<meta name="robots" content="noindex, nofollow"/>'),Pe=x('<div class="min-h-screen bg-base-200 flex items-center justify-center"><div class="text-center"><h1 class="text-2xl font-bold text-error mb-4">Access Denied</h1> <p>Only Super Admins can access this tool.</p></div></div>'),Je=x("<button> </button>"),Me=x('<tr><td class="font-mono text-xs"> </td><td> </td><td> </td><td> </td><td class="font-mono text-xs"> </td></tr>'),qe=x('<div class="mt-6"><h3 class="font-bold mb-2">All Admin Collection Documents:</h3> <div class="overflow-x-auto"><table class="table table-xs"><thead><tr><th>Document ID</th><th>Email</th><th>Type</th><th>Super Admin</th><th>Roles</th></tr></thead><tbody></tbody></table></div></div>'),Be=x('<div class="min-h-screen bg-base-200 p-6"><div class="max-w-4xl mx-auto"><div class="bg-base-100 rounded-lg shadow-lg p-6"><h1 class="text-2xl font-bold text-base-content mb-4">🧹 Remove Editor from Admin Collection</h1> <div class="alert alert-warning mb-6"><div><h3 class="font-bold">⚠️ Critical Permission Fix</h3> <p>This tool will remove Editor users from the admin collection. Editor users should get permissions through their role assignment, not by being stored in the admin collection.</p></div></div> <div class="flex gap-4 mb-6"><button>🔍 Scan Admin Collection</button> <button>🎯 Remove Specific Editor Doc</button> <!></div> <div class="bg-base-200 rounded-lg p-4"><h3 class="font-bold mb-2">Results:</h3> <pre class="text-sm whitespace-pre-wrap"> </pre></div> <!> <div class="mt-6"><a href="/admin" class="btn btn-ghost">← Back to Dashboard</a></div></div></div></div>');function Ze(M,L){be(L,!1);const[U,V]=Se(),q=()=>we(Te,"$userClaims",U),k=E();let i=E(!1),t=E(""),y=E([]),c=E([]);ge(()=>{e(k)||Fe("/admin")});async function W(){if(!D){o(t,"Error: Firestore not initialized");return}o(i,!0),o(t,`Scanning admin collection...
2`);try{const s=ze(D,"admin"),r=await Ne(s);o(y,[]),o(c,[]),r.docs.forEach(m=>{var h,$,p;const u=m.data(),v={id:m.id,data:u,email:u.email||((h=u.userData)==null?void 0:h.email)||"N/A",roles:u.roles||(($=u.userData)==null?void 0:$.roles)||[],type:u.type||"unknown",isSuperAdmin:u.isSuperAdmin||((p=u.userData)==null?void 0:p.isSuperAdmin)||!1};e(y).push(v),(v.email==="[email protected]"||v.email.includes("editor"))&&!v.isSuperAdmin&&e(c).push(v)}),o(t,e(t)+`Found ${e(y).length} total documents in admin collection
3`),o(t,e(t)+`Found ${e(c).length} Editor user documents
4
5`),e(c).length>0?(o(t,e(t)+`Editor documents found:
6`),e(c).forEach(m=>{o(t,e(t)+`- Document ID: ${m.id}
7`),o(t,e(t)+`  Email: ${m.email}
8`),o(t,e(t)+`  Type: ${m.type}
9`),o(t,e(t)+`  Super Admin: ${m.isSuperAdmin}
10`),o(t,e(t)+`  Roles: ${JSON.stringify(m.roles)}
11
12`)})):o(t,e(t)+`No Editor documents found in admin collection.
13`)}catch(s){o(t,e(t)+`Error: ${s.message}
14`)}o(i,!1)}async function Z(){if(!D||e(c).length===0){o(t,e(t)+`No Editor documents to remove.
15`);return}if(confirm(`Are you sure you want to remove ${e(c).length} Editor document(s) from the admin collection?`)){o(i,!0),o(t,e(t)+`
16Removing Editor documents...
17`);try{for(const s of e(c)){const r=H(D,"admin",s.id);await K(r),o(t,e(t)+`✅ Removed document: ${s.id} (${s.email})
18`)}o(t,e(t)+`
19✅ All Editor documents removed successfully!
20`),o(t,e(t)+`
21Please refresh the page and test the Editor permissions again.
22`),o(c,[])}catch(s){o(t,e(t)+`❌ Error removing documents: ${s.message}
23`)}o(i,!1)}}async function ee(){const s="Y0JivXMc95OurqzBQase8kTe7rG3";if(confirm(`Are you sure you want to remove document ${s} from the admin collection?`)){o(i,!0),o(t,e(t)+`
24Removing specific document: ${s}...
25`);try{const r=H(D,"admin",s);await K(r),o(t,e(t)+`✅ Removed document: ${s}
26`),o(t,e(t)+`
27✅ Document removed successfully!
28`),o(t,e(t)+`
29Please refresh the page and test the Editor permissions again.
30`)}catch(r){o(t,e(t)+`❌ Error removing document: ${r.message}
31`)}o(i,!1)}}_e(()=>q(),()=>{var s;o(k,(s=q())==null?void 0:s.isSuperAdmin)}),xe(),ye();var B=$e();Ae(s=>{var r=Ie();Re.title="Remove Editor from Admin Collection - OCSEF Admin",g(s,r)});var te=Ee(B);{var oe=s=>
31{var r=Pe();g(s,r)},se=s=>{var r=Be(),m=a(r),u=a(m),v=d(a(u),4),h=a(v);let $;var p=d(h,2);let G;var ne=d(p,2);{var ae=f=>{var l=Je();let A;var S=a(l);n(l),I(w=>{A=C(l,1,"btn btn-warning",null,A,w),l.disabled=e(i),_(S,`🗑️ Remove All Editor Docs (${e(c).length??""})`)},[()=>({loading:e(i)})],P),J("click",l,Z),g(f,l)};j(ne,f=>{e(c).length>0&&f(ae)})}n(v);var O=d(v,2),Q=d(a(O),2),re=a(Q,!0);n(Q),n(O);var ie=d(O,2);{var le=f=>{var l=qe(),A=d(a(l),2),S=a(A),w=d(a(S));ke(w,5,()=>e(y),Oe,(de,b,Ge,Qe)=>{var R=Me();let X;var F=a(R),ce=a(F,!0);n(F);var z=d(F),me=a(z,!0);n(z);var N=d(z),ue=a(N,!0);n(N);var T=d(N),ve=a(T,!0);n(T);var Y=d(T),fe=a(Y,!0);n(Y),n(R),I((he,pe)=>{X=C(R,1,"",null,X,he),_(ce,e(b).id),_(me,e(b).email),_(ue,e(b).type),_(ve,e(b).isSuperAdmin?"✅":"❌"),_(fe,pe)},[()=>({"bg-error":e(b).email.includes("editor")&&!e(b).isSuperAdmin}),()=>JSON.stringify(e(b).roles)],P),g(de,R)}),n(w),n(S),n(A),n(l),g(f,l)};j(ie,f=>{e(y).length>0&&f(le)})}Ce(2),n(u),n(m),n(r),I((f,l)=>{$=C(h,1,"btn btn-primary",null,$,f),h.disabled=e(i),G=C(p,1,"btn btn-error",null,G,l),p.disabled=e(i),_(re,e(t)||'Click "Scan Admin Collection" to start...')},[()=>({loading:e(i)}),()=>({loading:e(i)})],P),J("click",h,W),J("click",p,ee),g(s,r)};j(te,s=>{e(k)?s(se,!1):s(oe)})}g(M,B),De(),V()}export{Ze as component,We as universal};

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.