Built motion from commit bab6f49e.|2.6.17
[motion2.git] / server / api / cloudProvider / cloudProvider.controller.js
index 6bead48..be59f07 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d6e=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','map','CloudProvider','rawAttributes','fieldName','type','model','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x4de271,_0x21977c){var _0x5071c9=function(_0x50bc92){while(--_0x50bc92){_0x4de271['push'](_0x4de271['shift']());}};_0x5071c9(++_0x21977c);}(_0x2d6e,0x163));var _0xe2d6=function(_0x4d7933,_0x3e362d){_0x4d7933=_0x4d7933-0x0;var _0x2879a3=_0x2d6e[_0x4d7933];return _0x2879a3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe2d6('0x0'));var zipdir=require(_0xe2d6('0x1'));var jsonpatch=require(_0xe2d6('0x2'));var rp=require(_0xe2d6('0x3'));var moment=require('moment');var BPromise=require(_0xe2d6('0x4'));var Mustache=require('mustache');var util=require(_0xe2d6('0x5'));var path=require(_0xe2d6('0x6'));var sox=require(_0xe2d6('0x7'));var csv=require(_0xe2d6('0x8'));var ejs=require(_0xe2d6('0x9'));var fs=require('fs');var _=require(_0xe2d6('0xa'));var squel=require('squel');var crypto=require(_0xe2d6('0xb'));var jsforce=require(_0xe2d6('0xc'));var deskjs=require(_0xe2d6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe2d6('0xe'));var Papa=require(_0xe2d6('0xf'));var Redis=require(_0xe2d6('0x10'));var authService=require(_0xe2d6('0x11'));var qs=require(_0xe2d6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2d6('0x13'))(_0xe2d6('0x14'));var utils=require(_0xe2d6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe2d6('0x16'));var db=require(_0xe2d6('0x17'))['db'];function respondWithStatusCode(_0x23652a,_0x5cd000){_0x5cd000=_0x5cd000||0xcc;return function(_0x26edb5){if(_0x26edb5){return _0x23652a[_0xe2d6('0x18')](_0x5cd000);}return _0x23652a[_0xe2d6('0x19')](_0x5cd000)['end']();};}function respondWithResult(_0xbdfa0f,_0x5ae21d){_0x5ae21d=_0x5ae21d||0xc8;return function(_0x4a00ca){if(_0x4a00ca){return _0xbdfa0f[_0xe2d6('0x19')](_0x5ae21d)[_0xe2d6('0x1a')](_0x4a00ca);}};}function respondWithFilteredResult(_0x50978d,_0x140e02){return function(_0x25ca09){if(_0x25ca09){var _0x5dfb40=_0x25ca09[_0xe2d6('0x1b')],_0x32aec7=_0x140e02[_0xe2d6('0x1c')],_0x4461c3=_0x140e02[_0xe2d6('0x1c')]+_0x140e02[_0xe2d6('0x1d')],_0x276d90;if(_0x4461c3>=_0x5dfb40){_0x4461c3=_0x5dfb40;_0x276d90=0xc8;}else{_0x276d90=0xce;}_0x50978d[_0xe2d6('0x19')](_0x276d90);return _0x50978d[_0xe2d6('0x1e')]('Content-Range',_0x32aec7+'-'+_0x4461c3+'/'+_0x5dfb40)[_0xe2d6('0x1a')](_0x25ca09);}return null;};}function patchUpdates(_0x3db714){return function(_0x1b8cde){try{jsonpatch['apply'](_0x1b8cde,_0x3db714,!![]);}catch(_0x1b513e){return BPromise[_0xe2d6('0x1f')](_0x1b513e);}return _0x1b8cde[_0xe2d6('0x20')]();};}function saveUpdates(_0x1e1a87,_0x55f730){return function(_0x5e3e1d){if(_0x5e3e1d){return _0x5e3e1d[_0xe2d6('0x21')](_0x1e1a87)[_0xe2d6('0x22')](function(_0x50c2cb){return _0x50c2cb;});}return null;};}function removeEntity(_0x43b13d,_0x3820ce){return function(_0x1115e2){if(_0x1115e2){return _0x1115e2[_0xe2d6('0x23')]()[_0xe2d6('0x22')](function(){_0x43b13d[_0xe2d6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2c39,_0x1543cd){return function(_0x39c49f){if(!_0x39c49f){_0x1c2c39['sendStatus'](0x194);}return _0x39c49f;};}function handleError(_0x5055f7,_0x541bbd){_0x541bbd=_0x541bbd||0x1f4;return function(_0x3fdc26){logger[_0xe2d6('0x24')](_0x3fdc26[_0xe2d6('0x25')]);if(_0x3fdc26[_0xe2d6('0x26')]){delete _0x3fdc26[_0xe2d6('0x26')];}_0x5055f7[_0xe2d6('0x19')](_0x541bbd)[_0xe2d6('0x27')](_0x3fdc26);};}exports['index']=function(_0x1129a5,_0x32360d){var _0x37a722={},_0x28a1b0={},_0x117859={'count':0x0,'rows':[]};var _0x59747b=_[_0xe2d6('0x28')](db[_0xe2d6('0x29')][_0xe2d6('0x2a')],function(_0x2a043f){return{'name':_0x2a043f[_0xe2d6('0x2b')],'type':_0x2a043f[_0xe2d6('0x2c')]['key']};});_0x28a1b0[_0xe2d6('0x2d')]=_['map'](_0x59747b,_0xe2d6('0x26'));_0x28a1b0['query']=_['keys'](_0x1129a5['query']);_0x28a1b0['filters']=_[_0xe2d6('0x2e')](_0x28a1b0['model'],_0x28a1b0[_0xe2d6('0x2f')]);_0x37a722['attributes']=_[_0xe2d6('0x2e')](_0x28a1b0[_0xe2d6('0x2d')],qs[_0xe2d6('0x30')](_0x1129a5[_0xe2d6('0x2f')][_0xe2d6('0x30')]));_0x37a722[_0xe2d6('0x31')]=_0x37a722[_0xe2d6('0x31')]['length']?_0x37a722[_0xe2d6('0x31')]:_0x28a1b0[_0xe2d6('0x2d')];if(!_0x1129a5['query'][_0xe2d6('0x32')](_0xe2d6('0x33'))){_0x37a722['limit']=qs[_0xe2d6('0x1d')](_0x1129a5[_0xe2d6('0x2f')]['limit']);_0x37a722[_0xe2d6('0x1c')]=qs[_0xe2d6('0x1c')](_0x1129a5[_0xe2d6('0x2f')][_0xe2d6('0x1c')]);}_0x37a722[_0xe2d6('0x34')]=qs[_0xe2d6('0x35')](_0x1129a5[_0xe2d6('0x2f')][_0xe2d6('0x35')]);_0x37a722[_0xe2d6('0x36')]=qs[_0xe2d6('0x37')](_[_0xe2d6('0x38')](_0x1129a5[_0xe2d6('0x2f')],_0x28a1b0[_0xe2d6('0x37')]),_0x59747b);if(_0x1129a5['query'][_0xe2d6('0x39')]){_0x37a722[_0xe2d6('0x36')]=_['merge'](_0x37a722['where'],{'$or':_[_0xe2d6('0x28')](_0x59747b,function(_0x47bef1){if(_0x47bef1[_0xe2d6('0x2c')]!==_0xe2d6('0x3a')){var _0x1774fd={};_0x1774fd[_0x47bef1[_0xe2d6('0x26')]]={'$like':'%'+_0x1129a5[_0xe2d6('0x2f')][_0xe2d6('0x39')]+'%'};return _0x1774fd;}})});}_0x37a722=_[_0xe2d6('0x3b')]({},_0x37a722,_0x1129a5[_0xe2d6('0x3c')]);var _0x101767={'where':_0x37a722[_0xe2d6('0x36')]};return db['CloudProvider'][_0xe2d6('0x1b')](_0x101767)[_0xe2d6('0x22')](function(_0x294882){_0x117859[_0xe2d6('0x1b')]=_0x294882;if(_0x1129a5[_0xe2d6('0x2f')][_0xe2d6('0x3d')]){_0x37a722['include']=[{'all':!![]}];}return db['CloudProvider'][_0xe2d6('0x3e')](_0x37a722);})[_0xe2d6('0x22')](function(_0x2df975){_0x117859[_0xe2d6('0x3f')]=_0x2df975;return _0x117859;})[_0xe2d6('0x22')](respondWithFilteredResult(_0x32360d,_0x37a722))[_0xe2d6('0x40')](handleError(_0x32360d,null));};exports[_0xe2d6('0x41')]=function(_0xefe9a2,_0x3d07a2){var _0x188b69={'raw':!![],'where':{'id':_0xefe9a2[_0xe2d6('0x42')]['id']}},_0x5fd4fa={};_0x5fd4fa[_0xe2d6('0x2d')]=_[_0xe2d6('0x43')](db[_0xe2d6('0x29')][_0xe2d6('0x2a')]);_0x5fd4fa[_0xe2d6('0x2f')]=_[_0xe2d6('0x43')](_0xefe9a2[_0xe2d6('0x2f')]);_0x5fd4fa[_0xe2d6('0x37')]=_[_0xe2d6('0x2e')](_0x5fd4fa[_0xe2d6('0x2d')],_0x5fd4fa['query']);_0x188b69[_0xe2d6('0x31')]=_[_0xe2d6('0x2e')](_0x5fd4fa[_0xe2d6('0x2d')],qs[_0xe2d6('0x30')](_0xefe9a2['query'][_0xe2d6('0x30')]));_0x188b69[_0xe2d6('0x31')]=_0x188b69[_0xe2d6('0x31')]['length']?_0x188b69[_0xe2d6('0x31')]:_0x5fd4fa[_0xe2d6('0x2d')];if(_0xefe9a2[_0xe2d6('0x2f')]['includeAll']){_0x188b69[_0xe2d6('0x44')]=[{'all':!![]}];}_0x188b69=_[_0xe2d6('0x3b')]({},_0x188b69,_0xefe9a2['options']);return db[_0xe2d6('0x29')][_0xe2d6('0x45')](_0x188b69)['then'](handleEntityNotFound(_0x3d07a2,null))[_0xe2d6('0x22')](respondWithResult(_0x3d07a2,null))[_0xe2d6('0x40')](handleError(_0x3d07a2,null));};exports[_0xe2d6('0x46')]=function(_0x242f61,_0x83709a){return db['CloudProvider'][_0xe2d6('0x46')](_0x242f61['body'],{})['then'](respondWithResult(_0x83709a,0xc9))[_0xe2d6('0x40')](handleError(_0x83709a,null));};exports[_0xe2d6('0x21')]=function(_0x1369ee,_0x50ab58){if(_0x1369ee[_0xe2d6('0x47')]['id']){delete _0x1369ee[_0xe2d6('0x47')]['id'];}return db[_0xe2d6('0x29')][_0xe2d6('0x45')]({'where':{'id':_0x1369ee[_0xe2d6('0x42')]['id']}})[_0xe2d6('0x22')](handleEntityNotFound(_0x50ab58,null))[_0xe2d6('0x22')](saveUpdates(_0x1369ee[_0xe2d6('0x47')],null))[_0xe2d6('0x22')](respondWithResult(_0x50ab58,null))['catch'](handleError(_0x50ab58,null));};exports[_0xe2d6('0x23')]=function(_0x5ab816,_0x14995d){return db[_0xe2d6('0x29')][_0xe2d6('0x45')]({'where':{'id':_0x5ab816[_0xe2d6('0x42')]['id']}})[_0xe2d6('0x22')](handleEntityNotFound(_0x14995d,null))['then'](removeEntity(_0x14995d,null))['catch'](handleError(_0x14995d,null));};
\ No newline at end of file
+var _0x3d3a=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','includeAll','create','body','Service\x20parameter\x20not\x20specified','values','includes','encryptString','destroy','find','findOne','error','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','refresh_token','startRefreshInterval','emit','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','set','update','then','end','stack','name','send','index','map','CloudProvider','fieldName','type','key','query'];(function(_0x3bc3b4,_0x5acff4){var _0x4c546b=function(_0x158717){while(--_0x158717){_0x3bc3b4['push'](_0x3bc3b4['shift']());}};_0x4c546b(++_0x5acff4);}(_0x3d3a,0x1a3));var _0xa3d3=function(_0x503c5a,_0x269d5d){_0x503c5a=_0x503c5a-0x0;var _0x2b92b3=_0x3d3a[_0x503c5a];return _0x2b92b3;};'use strict';var _=require(_0xa3d3('0x0'));var Redis=require(_0xa3d3('0x1'));var qs=require(_0xa3d3('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xa3d3('0x3'));var logger=require('../../config/logger')('api');var db=require(_0xa3d3('0x4'))['db'];var oauth=require(_0xa3d3('0x5'));config[_0xa3d3('0x6')]=_[_0xa3d3('0x7')](config['redis'],{'host':_0xa3d3('0x8'),'port':0x18eb});var socket=require(_0xa3d3('0x9'))(new Redis(config[_0xa3d3('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x113465,_0x15e168){_0x15e168=_0x15e168||0xcc;return function(_0x40615f){if(_0x40615f){return _0x113465[_0xa3d3('0xa')](_0x15e168);}return _0x113465[_0xa3d3('0xb')](_0x15e168)['end']();};}function respondWithResult(_0x17cba0,_0x54ed2b){_0x54ed2b=_0x54ed2b||0xc8;return function(_0x39f7f2){if(_0x39f7f2){return _0x17cba0[_0xa3d3('0xb')](_0x54ed2b)[_0xa3d3('0xc')](_0x39f7f2);}};}function respondWithFilteredResult(_0x4d55e5,_0x3dd3fc){return function(_0x3893da){if(_0x3893da){var _0x520e55=typeof _0x3dd3fc['offset']===_0xa3d3('0xd')&&typeof _0x3dd3fc[_0xa3d3('0xe')]===_0xa3d3('0xd');var _0x1b1f08=_0x3893da[_0xa3d3('0xf')];var _0x5d4335=_0x520e55?0x0:_0x3dd3fc[_0xa3d3('0x10')];var _0xd4c759=_0x520e55?_0x3893da['count']:_0x3dd3fc[_0xa3d3('0x10')]+_0x3dd3fc[_0xa3d3('0xe')];var _0x5d25dc;if(_0xd4c759>=_0x1b1f08){_0xd4c759=_0x1b1f08;_0x5d25dc=0xc8;}else{_0x5d25dc=0xce;}_0x4d55e5[_0xa3d3('0xb')](_0x5d25dc);return _0x4d55e5[_0xa3d3('0x11')]('Content-Range',_0x5d4335+'-'+_0xd4c759+'/'+_0x1b1f08)['json'](_0x3893da);}return null;};}function saveUpdates(_0x225e08){return function(_0x25d372){if(_0x25d372){return _0x25d372[_0xa3d3('0x12')](_0x225e08)[_0xa3d3('0x13')](function(_0x1a757c){return _0x1a757c;});}return null;};}function removeEntity(_0x44dc90){return function(_0x367fb8){if(_0x367fb8){return _0x367fb8['destroy']()['then'](function(){_0x44dc90['status'](0xcc)[_0xa3d3('0x14')]();});}};}function handleEntityNotFound(_0x393e1f){return function(_0xd4ced2){if(!_0xd4ced2){_0x393e1f[_0xa3d3('0xa')](0x194);}return _0xd4ced2;};}function handleError(_0x115e99,_0x4834b5){_0x4834b5=_0x4834b5||0x1f4;return function(_0x399716){logger['error'](_0x399716[_0xa3d3('0x15')]);if(_0x399716['name']){delete _0x399716[_0xa3d3('0x16')];}_0x115e99['status'](_0x4834b5)[_0xa3d3('0x17')](_0x399716);};}function maskClientSecret(_0x2c6433){return _['padEnd'](_0x2c6433['slice'](0x0,0x3),0x14,'*');}exports[_0xa3d3('0x18')]=function(_0xf8f357,_0x3f76cb){var _0x187c37={},_0x3ed52d={},_0x5834e5={'count':0x0,'rows':[]};var _0xb8e84c=_[_0xa3d3('0x19')](db[_0xa3d3('0x1a')]['rawAttributes'],function(_0x23c2d1){return{'name':_0x23c2d1[_0xa3d3('0x1b')],'type':_0x23c2d1[_0xa3d3('0x1c')][_0xa3d3('0x1d')]};});_0x3ed52d['model']=_[_0xa3d3('0x19')](_0xb8e84c,_0xa3d3('0x16'));_0x3ed52d[_0xa3d3('0x1e')]=_[_0xa3d3('0x1f')](_0xf8f357[_0xa3d3('0x1e')]);_0x3ed52d[_0xa3d3('0x20')]=_[_0xa3d3('0x21')](_0x3ed52d[_0xa3d3('0x22')],_0x3ed52d[_0xa3d3('0x1e')]);_0x187c37[_0xa3d3('0x23')]=_[_0xa3d3('0x21')](_0x3ed52d['model'],qs[_0xa3d3('0x24')](_0xf8f357['query']['fields']));_0x187c37[_0xa3d3('0x23')]=_0x187c37[_0xa3d3('0x23')][_0xa3d3('0x25')]?_0x187c37[_0xa3d3('0x23')]:_0x3ed52d['model'];if(!_0xf8f357[_0xa3d3('0x1e')]['hasOwnProperty'](_0xa3d3('0x26'))){_0x187c37['limit']=qs[_0xa3d3('0xe')](_0xf8f357[_0xa3d3('0x1e')][_0xa3d3('0xe')]);_0x187c37[_0xa3d3('0x10')]=qs[_0xa3d3('0x10')](_0xf8f357['query'][_0xa3d3('0x10')]);}_0x187c37[_0xa3d3('0x27')]=qs[_0xa3d3('0x28')](_0xf8f357[_0xa3d3('0x1e')][_0xa3d3('0x28')]);_0x187c37[_0xa3d3('0x29')]=qs['filters'](_[_0xa3d3('0x2a')](_0xf8f357['query'],_0x3ed52d['filters']),_0xb8e84c);if(_0xf8f357['query'][_0xa3d3('0x2b')]){_0x187c37[_0xa3d3('0x29')]=_[_0xa3d3('0x2c')](_0x187c37[_0xa3d3('0x29')],{'$or':_[_0xa3d3('0x19')](_0xb8e84c,function(_0xa4b43){if(_0xa4b43[_0xa3d3('0x1c')]!==_0xa3d3('0x2d')){var _0xb2ac29={};_0xb2ac29[_0xa4b43[_0xa3d3('0x16')]]={'$like':'%'+_0xf8f357[_0xa3d3('0x1e')][_0xa3d3('0x2b')]+'%'};return _0xb2ac29;}})});}_0x187c37=_['merge']({},_0x187c37,_0xf8f357[_0xa3d3('0x2e')]);var _0x2903cc={'where':_0x187c37['where']};return db['CloudProvider'][_0xa3d3('0xf')](_0x2903cc)[_0xa3d3('0x13')](function(_0x21b3df){_0x5834e5[_0xa3d3('0xf')]=_0x21b3df;if(_0xf8f357[_0xa3d3('0x1e')]['includeAll']){_0x187c37[_0xa3d3('0x2f')]=[{'all':!![]}];}return db[_0xa3d3('0x1a')][_0xa3d3('0x30')](_0x187c37);})[_0xa3d3('0x13')](function(_0x20ad4b){_0x5834e5['rows']=_[_0xa3d3('0x19')](_0x20ad4b,function(_0x4417b4){if(_0x4417b4[_0xa3d3('0x31')]===_0xa3d3('0x32')){var _0x3f9f2d=encryptor[_0xa3d3('0x33')](_0x4417b4[_0xa3d3('0x34')]);_0x4417b4[_0xa3d3('0x34')]=maskClientSecret(_0x3f9f2d);}return _0x4417b4;});return _0x5834e5;})['then'](respondWithFilteredResult(_0x3f76cb,_0x187c37))[_0xa3d3('0x35')](handleError(_0x3f76cb,null));};exports[_0xa3d3('0x36')]=function(_0x1138bc,_0x2c54c7){var _0x47d682={'raw':!![],'where':{'id':_0x1138bc[_0xa3d3('0x37')]['id']}},_0x4da036={};_0x4da036['model']=_[_0xa3d3('0x1f')](db[_0xa3d3('0x1a')][_0xa3d3('0x38')]);_0x4da036['query']=_[_0xa3d3('0x1f')](_0x1138bc[_0xa3d3('0x1e')]);_0x4da036[_0xa3d3('0x20')]=_[_0xa3d3('0x21')](_0x4da036[_0xa3d3('0x22')],_0x4da036[_0xa3d3('0x1e')]);_0x47d682['attributes']=_[_0xa3d3('0x21')](_0x4da036['model'],qs[_0xa3d3('0x24')](_0x1138bc[_0xa3d3('0x1e')][_0xa3d3('0x24')]));_0x47d682[_0xa3d3('0x23')]=_0x47d682[_0xa3d3('0x23')]['length']?_0x47d682['attributes']:_0x4da036[_0xa3d3('0x22')];if(_0x1138bc[_0xa3d3('0x1e')][_0xa3d3('0x39')]){_0x47d682[_0xa3d3('0x2f')]=[{'all':!![]}];}_0x47d682=_[_0xa3d3('0x2c')]({},_0x47d682,_0x1138bc[_0xa3d3('0x2e')]);return db[_0xa3d3('0x1a')]['find'](_0x47d682)[_0xa3d3('0x13')](handleEntityNotFound(_0x2c54c7,null))[_0xa3d3('0x13')](function(_0x555a09){if(_0x555a09[_0xa3d3('0x31')]===_0xa3d3('0x32')){var _0x44a35e=encryptor[_0xa3d3('0x33')](_0x555a09[_0xa3d3('0x34')]);_0x555a09[_0xa3d3('0x34')]=maskClientSecret(_0x44a35e);}return _0x555a09;})[_0xa3d3('0x13')](respondWithResult(_0x2c54c7,null))['catch'](handleError(_0x2c54c7,null));};exports[_0xa3d3('0x3a')]=function(_0x4a3fb3,_0x160fe3){if(!_0x4a3fb3[_0xa3d3('0x3b')][_0xa3d3('0x16')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4a3fb3[_0xa3d3('0x3b')]['service'])throw new Error(_0xa3d3('0x3c'));var _0x1658ec=db[_0xa3d3('0x1a')][_0xa3d3('0x38')]['service'][_0xa3d3('0x3d')];if(!_0x1658ec[_0xa3d3('0x3e')](_0x4a3fb3[_0xa3d3('0x3b')][_0xa3d3('0x31')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x1658ec['join'](',\x20'));if(_0x4a3fb3['body'][_0xa3d3('0x31')]==='MicrosoftAzure'&&_0x4a3fb3['body']['data3']){_0x4a3fb3[_0xa3d3('0x3b')]['data3']=encryptor['encryptString'](_0x4a3fb3[_0xa3d3('0x3b')]['data3']);}return db['CloudProvider'][_0xa3d3('0x3a')](_0x4a3fb3[_0xa3d3('0x3b')],{})[_0xa3d3('0x13')](respondWithResult(_0x160fe3,0xc9))['catch'](handleError(_0x160fe3,null));};exports['update']=function(_0x4f874c,_0x451f08){if(_0x4f874c['body']['id']){delete _0x4f874c[_0xa3d3('0x3b')]['id'];}return db[_0xa3d3('0x1a')]['find']({'where':{'id':_0x4f874c[_0xa3d3('0x37')]['id']}})['then'](handleEntityNotFound(_0x451f08,null))[_0xa3d3('0x13')](function(_0x38c697){if(_0x38c697[_0xa3d3('0x31')]==='MicrosoftAzure'&&_0x4f874c['body'][_0xa3d3('0x34')]){_0x4f874c[_0xa3d3('0x3b')][_0xa3d3('0x34')]=encryptor[_0xa3d3('0x3f')](_0x4f874c['body'][_0xa3d3('0x34')]);}return _0x38c697;})[_0xa3d3('0x13')](saveUpdates(_0x4f874c[_0xa3d3('0x3b')],null))[_0xa3d3('0x13')](respondWithResult(_0x451f08,null))[_0xa3d3('0x35')](handleError(_0x451f08,null));};exports[_0xa3d3('0x40')]=function(_0x1d70d7,_0x434b7e){return db[_0xa3d3('0x1a')][_0xa3d3('0x41')]({'where':{'id':_0x1d70d7[_0xa3d3('0x37')]['id']}})[_0xa3d3('0x13')](handleEntityNotFound(_0x434b7e,null))[_0xa3d3('0x13')](removeEntity(_0x434b7e,null))[_0xa3d3('0x35')](handleError(_0x434b7e,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4de710,_0x1a286b){return db[_0xa3d3('0x1a')][_0xa3d3('0x42')]({'where':{'id':_0x4de710[_0xa3d3('0x37')]['id']},'raw':!![]})['then'](function(_0x977597){if(!_0x977597)return _0x1a286b[_0xa3d3('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x977597,_0x4de710['user']['id'])};})['then'](respondWithResult(_0x1a286b,null))['catch'](handleError(_0x1a286b,null));};exports['oauth2MicrosoftCallback']=function(_0x37025f,_0x136fb5){var _0x56177f=_0x37025f[_0xa3d3('0x3b')];var _0x243928;var _0x37be6f;if(_0x56177f[_0xa3d3('0x43')])throw _0x56177f;redis[_0xa3d3('0x44')](_0x56177f[_0xa3d3('0x45')])['then'](function(_0x59d008){if(!_0x59d008)throw new Error(_0xa3d3('0x46'));_0x243928=JSON['parse'](_0x59d008);var _0x56d57a=Buffer[_0xa3d3('0x47')](_0x56177f['state'],_0xa3d3('0x48'))[_0xa3d3('0x49')](_0xa3d3('0x4a'));_0x37be6f=JSON['parse'](_0x56d57a);if(!oauth[_0xa3d3('0x4b')](_0x56177f[_0xa3d3('0x4c')],_0x243928[_0xa3d3('0x4d')]))throw new Error(_0xa3d3('0x4e'));redis[_0xa3d3('0x4f')](_0x56177f[_0xa3d3('0x45')]);return oauth[_0xa3d3('0x50')](_0x56177f['code'],_0x243928);})[_0xa3d3('0x13')](function(_0x11cad2){_0x243928[_0xa3d3('0x51')]=_0x11cad2[_0xa3d3('0x52')];_0x243928[_0xa3d3('0x53')]=_0x11cad2[_0xa3d3('0x54')];return db[_0xa3d3('0x1a')][_0xa3d3('0x12')]({'data5':_0x243928[_0xa3d3('0x51')],'data6':_0x243928['data6']},{'where':{'id':_0x243928['id']}});})[_0xa3d3('0x13')](function(){oauth[_0xa3d3('0x55')](_0x243928);socket['emit']('microsoftAuthorization:success',{'id':_0x37be6f['id']});return;})['then'](respondWithStatusCode(_0x136fb5,null))[_0xa3d3('0x35')](function(_0x1fead8){if(_0x37be6f){socket[_0xa3d3('0x56')]('microsoftAuthorization:error',{'id':_0x37be6f['id']});}if(!_0x243928){logger[_0xa3d3('0x43')](_0xa3d3('0x57'),_0x1fead8);return _0x136fb5['status'](0x1f4)[_0xa3d3('0x17')](_0x1fead8[_0xa3d3('0x58')]);}logger[_0xa3d3('0x43')](_0xa3d3('0x59'),_0x243928['id'],JSON['stringify'](_0x1fead8));});};
\ No newline at end of file