"use strict";(()=>{vare={};e.id=294,e.ids=[294],e.modules={27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},79646:e=>{e.exports=require("child_process")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},98397:(e,t,r)=>{r.r(t),r.d(t,{config:()=>h,default:()=>E,routeModule:()=>m});vars={};r.r(s),r.d(s,{default:()=>f});vara=r(89947),i=r(2706),u=r(96762),l=r(51348),d=r.n(l),n=r(6420),o=r.n(n),c=r(47670),p=r.n(c);r(29021),r(33873);let{execSync:_}=r(79646);asyncfunctionf(e,t){if("POST"!==e.method)returnt.json({msg:"Failed!"});letr=awaito()(e,t,!0);if(!r)returnt.json({success:!1,msg:"Unauthorized"});let{userObject:s,database_access:a,user_priviledge:i,db_tables:u,inv_user_id:l}=e.body,n=awaitd()("UPDATE user_users SET database_access = ? ,user_priviledge = ? WHERE user_id = ? AND email = ?",[a,i,r.id,s.email]),c=u.split("|");awaitd()(`DELETE FROM delegated_user_tables WHERE root_user_id='${r.id}' AND delegated_user_id='${l}'`);for(lete=0;e<c.length;e++){let[t,s]=c[e].split("-");awaitp()({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:l,root_user_id:r.id,database:t,table:s,priviledge:i}})}t.json({success:!!n?.affectedRows})}letE=(0,u.M)(s,"default"),h=(0,u.M)(s,"config"),m=newa.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/updateAdminUserAccess",pathname:"/api/updateAdminUserAccess",bundlePath:"",filename:""},userland:s})},6420:(e,t,r)=>{r(81630);lets=r(51348),a=r(72907),i=r(29021);asyncfunctionu(e,t,r,u){if(!e.cookies?.datasquirelAuthKey?.match(/./))returnnull;letl=a(e.cookies.datasquirelAuthKey);if(!l)returnnull;letd=JSON.parse(l);if(!d.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))returnnull;letn=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!n)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!i.existsSync(`${n}/${d.csrf_k}`))returnnull;if(0==d.verification_status&&!r){lete=awaits(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}returnd?.date&&Date.now()-d.date>6048e5?null:d}e.exports=u},72907:(e,t,r)=>{let{scryptSync:s,createDecipheriv:a}=r(55511),{Buffer:i}=r(79428);e.exports=e=>{lett=a("aes-192-cbc",s(process.env.DSQL_ENCRYPTION_PASSWORD||"",process.env.DSQL_ENCRYPTION_SALT||"",24),i.alloc(16,0));try{letr=t.update(e,"hex","utf8");returnr+=t.final("utf8")}catch(e){returnnull}}}};vart=require("../../webpack-api-runtime.js");t.C(e);varr=e=>t(t.s=e),s=t.X(0,[4050],()=>r(98397));module.exports=s})();