dsql-admin/dsql-app/.local_dist/server/pages/api/updateAdminUserAccess.js
Benjamin Toby 81cf010cb5 Updates
2025-01-14 16:27:08 +01:00

1 line
1.8 KiB
JavaScript

"use strict";(()=>{var e={};e.id=294,e.ids=[294],e.modules={39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},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")},55511:e=>{e.exports=require("crypto")},7522:(e,r,s)=>{s.r(r),s.d(r,{config:()=>c,default:()=>p,routeModule:()=>m});var a={};s.r(a),s.d(a,{default:()=>n});var t=s(89947),i=s(2706),d=s(96762),u=s(48786),l=s(69842),o=s(98e3);async function n(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let s=await (0,l.A)(e,r,!0);if(!s)return r.json({success:!1,msg:"Unauthorized"});let{userObject:a,database_access:t,user_priviledge:i,db_tables:d,inv_user_id:n}=e.body,p=await (0,u.A)("UPDATE user_users SET database_access = ? ,user_priviledge = ? WHERE user_id = ? AND email = ?",[t,i,s.id,a.email]),c=d.split("|");await (0,u.A)(`DELETE FROM delegated_user_tables WHERE root_user_id='${s.id}' AND delegated_user_id='${n}'`);for(let e=0;e<c.length;e++){let[r,a]=c[e].split("-");await (0,o.A)({dbFullName:"datasquirel",tableName:"delegated_user_tables",data:{delegated_user_id:n,root_user_id:s.id,database:r,table:a,priviledge:i}})}r.json({success:!!p?.affectedRows})}let p=(0,d.M)(a,"default"),c=(0,d.M)(a,"config"),m=new t.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/updateAdminUserAccess",pathname:"/api/updateAdminUserAccess",bundlePath:"",filename:""},userland:a})},69842:(e,r,s)=>{s.d(r,{A:()=>i});var a=s(39908),t=s.n(a);async function i(e,r,s){let a=t()({req:e,level:s?"deep":void 0});return console.log(a),a.payload}}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),a=r.X(0,[1251],()=>s(7522));module.exports=a})();