Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / cloudProvider / cloudProvider.controller.js
index 9847314..4b71ef0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c9b=['rawAttributes','fieldName','type','map','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','merge','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','CloudProvider'];(function(_0x5a3d93,_0xadb12c){var _0x3d278b=function(_0x4aae16){while(--_0x4aae16){_0x5a3d93['push'](_0x5a3d93['shift']());}};_0x3d278b(++_0xadb12c);}(_0x0c9b,0x109));var _0xb0c9=function(_0x1b102d,_0x49499f){_0x1b102d=_0x1b102d-0x0;var _0x4f2910=_0x0c9b[_0x1b102d];return _0x4f2910;};'use strict';var pdf=require(_0xb0c9('0x0'));var emlformat=require(_0xb0c9('0x1'));var rimraf=require(_0xb0c9('0x2'));var zipdir=require(_0xb0c9('0x3'));var jsonpatch=require(_0xb0c9('0x4'));var rp=require(_0xb0c9('0x5'));var moment=require(_0xb0c9('0x6'));var BPromise=require(_0xb0c9('0x7'));var Mustache=require(_0xb0c9('0x8'));var util=require(_0xb0c9('0x9'));var path=require(_0xb0c9('0xa'));var sox=require(_0xb0c9('0xb'));var csv=require(_0xb0c9('0xc'));var ejs=require(_0xb0c9('0xd'));var fs=require('fs');var _=require(_0xb0c9('0xe'));var squel=require('squel');var crypto=require(_0xb0c9('0xf'));var jsforce=require(_0xb0c9('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb0c9('0xc'));var querystring=require(_0xb0c9('0x11'));var Papa=require(_0xb0c9('0x12'));var Redis=require(_0xb0c9('0x13'));var authService=require(_0xb0c9('0x14'));var qs=require(_0xb0c9('0x15'));var as=require(_0xb0c9('0x16'));var hardwareService=require(_0xb0c9('0x17'));var logger=require(_0xb0c9('0x18'))(_0xb0c9('0x19'));var utils=require(_0xb0c9('0x1a'));var config=require(_0xb0c9('0x1b'));var licenseUtil=require(_0xb0c9('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147b0,_0x22be17){_0x22be17=_0x22be17||0xcc;return function(_0x5a285e){if(_0x5a285e){return _0x147b0[_0xb0c9('0x1d')](_0x22be17);}return _0x147b0[_0xb0c9('0x1e')](_0x22be17)['end']();};}function respondWithResult(_0x3c84d7,_0xa497f8){_0xa497f8=_0xa497f8||0xc8;return function(_0x3050f1){if(_0x3050f1){return _0x3c84d7['status'](_0xa497f8)['json'](_0x3050f1);}};}function respondWithFilteredResult(_0x268818,_0x3a27fc){return function(_0xd1c1f2){if(_0xd1c1f2){var _0xbd6865=_0xd1c1f2[_0xb0c9('0x1f')],_0x273a69=_0x3a27fc[_0xb0c9('0x20')],_0x330639=_0x3a27fc['offset']+_0x3a27fc['limit'],_0x19a4f1;if(_0x330639>=_0xbd6865){_0x330639=_0xbd6865;_0x19a4f1=0xc8;}else{_0x19a4f1=0xce;}_0x268818['status'](_0x19a4f1);return _0x268818[_0xb0c9('0x21')](_0xb0c9('0x22'),_0x273a69+'-'+_0x330639+'/'+_0xbd6865)['json'](_0xd1c1f2);}return null;};}function patchUpdates(_0x29bfa6){return function(_0x5b540d){try{jsonpatch[_0xb0c9('0x23')](_0x5b540d,_0x29bfa6,!![]);}catch(_0xb8eaac){return BPromise[_0xb0c9('0x24')](_0xb8eaac);}return _0x5b540d[_0xb0c9('0x25')]();};}function saveUpdates(_0x7e1148,_0x29316b){return function(_0x33345e){if(_0x33345e){return _0x33345e[_0xb0c9('0x26')](_0x7e1148)[_0xb0c9('0x27')](function(_0x50b706){return _0x50b706;});}return null;};}function removeEntity(_0x493c40,_0x596c93){return function(_0x1e2e4b){if(_0x1e2e4b){return _0x1e2e4b[_0xb0c9('0x28')]()['then'](function(){_0x493c40[_0xb0c9('0x1e')](0xcc)[_0xb0c9('0x29')]();});}};}function handleEntityNotFound(_0xd3f7aa,_0x2691f4){return function(_0x45667e){if(!_0x45667e){_0xd3f7aa[_0xb0c9('0x1d')](0x194);}return _0x45667e;};}function handleError(_0x45be22,_0x3d020b){_0x3d020b=_0x3d020b||0x1f4;return function(_0x2a99f5){logger[_0xb0c9('0x2a')](_0x2a99f5['stack']);if(_0x2a99f5[_0xb0c9('0x2b')]){delete _0x2a99f5[_0xb0c9('0x2b')];}_0x45be22['status'](_0x3d020b)[_0xb0c9('0x2c')](_0x2a99f5);};}exports[_0xb0c9('0x2d')]=function(_0x4dd894,_0x1c166d){var _0x5355c2={},_0x3c9c07={},_0x58bfe0={'count':0x0,'rows':[]};var _0x20b8fb=_['map'](db[_0xb0c9('0x2e')][_0xb0c9('0x2f')],function(_0x5520b4){return{'name':_0x5520b4[_0xb0c9('0x30')],'type':_0x5520b4[_0xb0c9('0x31')]['key']};});_0x3c9c07['model']=_[_0xb0c9('0x32')](_0x20b8fb,'name');_0x3c9c07[_0xb0c9('0x33')]=_[_0xb0c9('0x34')](_0x4dd894[_0xb0c9('0x33')]);_0x3c9c07['filters']=_['intersection'](_0x3c9c07['model'],_0x3c9c07[_0xb0c9('0x33')]);_0x5355c2[_0xb0c9('0x35')]=_[_0xb0c9('0x36')](_0x3c9c07[_0xb0c9('0x37')],qs[_0xb0c9('0x38')](_0x4dd894[_0xb0c9('0x33')][_0xb0c9('0x38')]));_0x5355c2[_0xb0c9('0x35')]=_0x5355c2[_0xb0c9('0x35')][_0xb0c9('0x39')]?_0x5355c2[_0xb0c9('0x35')]:_0x3c9c07[_0xb0c9('0x37')];if(!_0x4dd894[_0xb0c9('0x33')][_0xb0c9('0x3a')](_0xb0c9('0x3b'))){_0x5355c2['limit']=qs[_0xb0c9('0x3c')](_0x4dd894[_0xb0c9('0x33')]['limit']);_0x5355c2['offset']=qs[_0xb0c9('0x20')](_0x4dd894['query'][_0xb0c9('0x20')]);}_0x5355c2['order']=qs[_0xb0c9('0x3d')](_0x4dd894[_0xb0c9('0x33')][_0xb0c9('0x3d')]);_0x5355c2['where']=qs[_0xb0c9('0x3e')](_[_0xb0c9('0x3f')](_0x4dd894[_0xb0c9('0x33')],_0x3c9c07[_0xb0c9('0x3e')]),_0x20b8fb);if(_0x4dd894[_0xb0c9('0x33')][_0xb0c9('0x40')]){_0x5355c2['where']=_[_0xb0c9('0x41')](_0x5355c2['where'],{'$or':_[_0xb0c9('0x32')](_0x20b8fb,function(_0x5a2987){if(_0x5a2987[_0xb0c9('0x31')]!=='VIRTUAL'){var _0x3f21f2={};_0x3f21f2[_0x5a2987[_0xb0c9('0x2b')]]={'$like':'%'+_0x4dd894[_0xb0c9('0x33')][_0xb0c9('0x40')]+'%'};return _0x3f21f2;}})});}_0x5355c2=_['merge']({},_0x5355c2,_0x4dd894[_0xb0c9('0x42')]);var _0x3c4bb2={'where':_0x5355c2[_0xb0c9('0x43')]};return db[_0xb0c9('0x2e')]['count'](_0x3c4bb2)['then'](function(_0x3f7368){_0x58bfe0[_0xb0c9('0x1f')]=_0x3f7368;if(_0x4dd894['query'][_0xb0c9('0x44')]){_0x5355c2[_0xb0c9('0x45')]=[{'all':!![]}];}return db['CloudProvider'][_0xb0c9('0x46')](_0x5355c2);})[_0xb0c9('0x27')](function(_0x3f4d26){_0x58bfe0[_0xb0c9('0x47')]=_0x3f4d26;return _0x58bfe0;})[_0xb0c9('0x27')](respondWithFilteredResult(_0x1c166d,_0x5355c2))[_0xb0c9('0x48')](handleError(_0x1c166d,null));};exports[_0xb0c9('0x49')]=function(_0x2a4c44,_0x103402){var _0x49d9f7={'raw':!![],'where':{'id':_0x2a4c44[_0xb0c9('0x4a')]['id']}},_0x2e2840={};_0x2e2840[_0xb0c9('0x37')]=_[_0xb0c9('0x34')](db[_0xb0c9('0x2e')][_0xb0c9('0x2f')]);_0x2e2840[_0xb0c9('0x33')]=_['keys'](_0x2a4c44[_0xb0c9('0x33')]);_0x2e2840[_0xb0c9('0x3e')]=_[_0xb0c9('0x36')](_0x2e2840[_0xb0c9('0x37')],_0x2e2840[_0xb0c9('0x33')]);_0x49d9f7[_0xb0c9('0x35')]=_['intersection'](_0x2e2840[_0xb0c9('0x37')],qs[_0xb0c9('0x38')](_0x2a4c44[_0xb0c9('0x33')][_0xb0c9('0x38')]));_0x49d9f7[_0xb0c9('0x35')]=_0x49d9f7['attributes'][_0xb0c9('0x39')]?_0x49d9f7[_0xb0c9('0x35')]:_0x2e2840[_0xb0c9('0x37')];if(_0x2a4c44[_0xb0c9('0x33')][_0xb0c9('0x44')]){_0x49d9f7[_0xb0c9('0x45')]=[{'all':!![]}];}_0x49d9f7=_[_0xb0c9('0x41')]({},_0x49d9f7,_0x2a4c44[_0xb0c9('0x42')]);return db[_0xb0c9('0x2e')][_0xb0c9('0x4b')](_0x49d9f7)[_0xb0c9('0x27')](handleEntityNotFound(_0x103402,null))[_0xb0c9('0x27')](respondWithResult(_0x103402,null))[_0xb0c9('0x48')](handleError(_0x103402,null));};exports[_0xb0c9('0x4c')]=function(_0x2f4cad,_0x4be803){return db[_0xb0c9('0x2e')][_0xb0c9('0x4c')](_0x2f4cad[_0xb0c9('0x4d')],{})[_0xb0c9('0x27')](respondWithResult(_0x4be803,0xc9))[_0xb0c9('0x48')](handleError(_0x4be803,null));};exports[_0xb0c9('0x26')]=function(_0x1961fb,_0x52cf77){if(_0x1961fb['body']['id']){delete _0x1961fb[_0xb0c9('0x4d')]['id'];}return db['CloudProvider'][_0xb0c9('0x4b')]({'where':{'id':_0x1961fb['params']['id']}})[_0xb0c9('0x27')](handleEntityNotFound(_0x52cf77,null))['then'](saveUpdates(_0x1961fb[_0xb0c9('0x4d')],null))['then'](respondWithResult(_0x52cf77,null))[_0xb0c9('0x48')](handleError(_0x52cf77,null));};exports[_0xb0c9('0x28')]=function(_0x1babf0,_0x2362f0){return db[_0xb0c9('0x2e')][_0xb0c9('0x4b')]({'where':{'id':_0x1babf0[_0xb0c9('0x4a')]['id']}})[_0xb0c9('0x27')](handleEntityNotFound(_0x2362f0,null))[_0xb0c9('0x27')](removeEntity(_0x2362f0,null))[_0xb0c9('0x48')](handleError(_0x2362f0,null));};
\ No newline at end of file
+var _0xe7aa=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','includeAll','find','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','body','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','update','then','destroy','end','error','name','send','padEnd','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3d8d0a,_0x11bb87){var _0x5b9df5=function(_0x3ecba2){while(--_0x3ecba2){_0x3d8d0a['push'](_0x3d8d0a['shift']());}};_0x5b9df5(++_0x11bb87);}(_0xe7aa,0x159));var _0xae7a=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xe7aa[_0x521929];return _0x632436;};'use strict';var _=require(_0xae7a('0x0'));var Redis=require(_0xae7a('0x1'));var qs=require(_0xae7a('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xae7a('0x3'));var logger=require(_0xae7a('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0xae7a('0x5'));config[_0xae7a('0x6')]=_[_0xae7a('0x7')](config[_0xae7a('0x6')],{'host':_0xae7a('0x8'),'port':0x18eb});var socket=require(_0xae7a('0x9'))(new Redis(config[_0xae7a('0x6')]));var redis=new Redis(config[_0xae7a('0x6')]);function respondWithStatusCode(_0x156809,_0x2ebf4b){_0x2ebf4b=_0x2ebf4b||0xcc;return function(_0x3f39d7){if(_0x3f39d7){return _0x156809[_0xae7a('0xa')](_0x2ebf4b);}return _0x156809[_0xae7a('0xb')](_0x2ebf4b)['end']();};}function respondWithResult(_0xb103bc,_0x8335a){_0x8335a=_0x8335a||0xc8;return function(_0x40da80){if(_0x40da80){return _0xb103bc[_0xae7a('0xb')](_0x8335a)[_0xae7a('0xc')](_0x40da80);}};}function respondWithFilteredResult(_0x11c4ab,_0x4d8c51){return function(_0x1cb9c0){if(_0x1cb9c0){var _0x11c8b3=typeof _0x4d8c51['offset']===_0xae7a('0xd')&&typeof _0x4d8c51[_0xae7a('0xe')]===_0xae7a('0xd');var _0x4f31a5=_0x1cb9c0[_0xae7a('0xf')];var _0x520025=_0x11c8b3?0x0:_0x4d8c51[_0xae7a('0x10')];var _0x4e96db=_0x11c8b3?_0x1cb9c0['count']:_0x4d8c51[_0xae7a('0x10')]+_0x4d8c51[_0xae7a('0xe')];var _0x2d8c9c;if(_0x4e96db>=_0x4f31a5){_0x4e96db=_0x4f31a5;_0x2d8c9c=0xc8;}else{_0x2d8c9c=0xce;}_0x11c4ab[_0xae7a('0xb')](_0x2d8c9c);return _0x11c4ab['set']('Content-Range',_0x520025+'-'+_0x4e96db+'/'+_0x4f31a5)['json'](_0x1cb9c0);}return null;};}function saveUpdates(_0x39e999){return function(_0x736ce8){if(_0x736ce8){return _0x736ce8[_0xae7a('0x11')](_0x39e999)[_0xae7a('0x12')](function(_0x444e21){return _0x444e21;});}return null;};}function removeEntity(_0x576fc6){return function(_0x254894){if(_0x254894){return _0x254894[_0xae7a('0x13')]()['then'](function(){_0x576fc6[_0xae7a('0xb')](0xcc)[_0xae7a('0x14')]();});}};}function handleEntityNotFound(_0x477abe){return function(_0x2525a7){if(!_0x2525a7){_0x477abe[_0xae7a('0xa')](0x194);}return _0x2525a7;};}function handleError(_0x101a97,_0x5ad11e){_0x5ad11e=_0x5ad11e||0x1f4;return function(_0x263844){logger[_0xae7a('0x15')](_0x263844['stack']);if(_0x263844[_0xae7a('0x16')]){delete _0x263844[_0xae7a('0x16')];}_0x101a97[_0xae7a('0xb')](_0x5ad11e)[_0xae7a('0x17')](_0x263844);};}function maskClientSecret(_0x48e79c){return _[_0xae7a('0x18')](_0x48e79c['slice'](0x0,0x3),0x14,'*');}exports[_0xae7a('0x19')]=function(_0x509dfc,_0x8075f5){var _0x10372f={},_0x895f9e={},_0x27ee05={'count':0x0,'rows':[]};var _0x22f996=_[_0xae7a('0x1a')](db[_0xae7a('0x1b')][_0xae7a('0x1c')],function(_0x3eb3c4){return{'name':_0x3eb3c4['fieldName'],'type':_0x3eb3c4[_0xae7a('0x1d')][_0xae7a('0x1e')]};});_0x895f9e[_0xae7a('0x1f')]=_['map'](_0x22f996,_0xae7a('0x16'));_0x895f9e[_0xae7a('0x20')]=_[_0xae7a('0x21')](_0x509dfc[_0xae7a('0x20')]);_0x895f9e[_0xae7a('0x22')]=_[_0xae7a('0x23')](_0x895f9e[_0xae7a('0x1f')],_0x895f9e[_0xae7a('0x20')]);_0x10372f[_0xae7a('0x24')]=_[_0xae7a('0x23')](_0x895f9e[_0xae7a('0x1f')],qs['fields'](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x25')]));_0x10372f[_0xae7a('0x24')]=_0x10372f[_0xae7a('0x24')][_0xae7a('0x26')]?_0x10372f[_0xae7a('0x24')]:_0x895f9e['model'];if(!_0x509dfc['query'][_0xae7a('0x27')](_0xae7a('0x28'))){_0x10372f[_0xae7a('0xe')]=qs['limit'](_0x509dfc['query'][_0xae7a('0xe')]);_0x10372f[_0xae7a('0x10')]=qs['offset'](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x10')]);}_0x10372f[_0xae7a('0x29')]=qs[_0xae7a('0x2a')](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2a')]);_0x10372f[_0xae7a('0x2b')]=qs[_0xae7a('0x22')](_[_0xae7a('0x2c')](_0x509dfc[_0xae7a('0x20')],_0x895f9e[_0xae7a('0x22')]),_0x22f996);if(_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2d')]){_0x10372f[_0xae7a('0x2b')]=_[_0xae7a('0x2e')](_0x10372f['where'],{'$or':_[_0xae7a('0x1a')](_0x22f996,function(_0x8768ad){if(_0x8768ad[_0xae7a('0x1d')]!==_0xae7a('0x2f')){var _0x4e942a={};_0x4e942a[_0x8768ad['name']]={'$like':'%'+_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2d')]+'%'};return _0x4e942a;}})});}_0x10372f=_['merge']({},_0x10372f,_0x509dfc[_0xae7a('0x30')]);var _0x4b3593={'where':_0x10372f[_0xae7a('0x2b')]};return db[_0xae7a('0x1b')][_0xae7a('0xf')](_0x4b3593)[_0xae7a('0x12')](function(_0x5ce046){_0x27ee05[_0xae7a('0xf')]=_0x5ce046;if(_0x509dfc[_0xae7a('0x20')]['includeAll']){_0x10372f[_0xae7a('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0xae7a('0x32')](_0x10372f);})['then'](function(_0x3d11c6){_0x27ee05[_0xae7a('0x33')]=_['map'](_0x3d11c6,function(_0x517be3){if(_0x517be3[_0xae7a('0x34')]===_0xae7a('0x35')){var _0x32a8f0=encryptor[_0xae7a('0x36')](_0x517be3[_0xae7a('0x37')]);_0x517be3[_0xae7a('0x37')]=maskClientSecret(_0x32a8f0);}return _0x517be3;});return _0x27ee05;})[_0xae7a('0x12')](respondWithFilteredResult(_0x8075f5,_0x10372f))[_0xae7a('0x38')](handleError(_0x8075f5,null));};exports[_0xae7a('0x39')]=function(_0x2fd633,_0xb501c7){var _0x3c49bc={'raw':!![],'where':{'id':_0x2fd633[_0xae7a('0x3a')]['id']}},_0x3fb126={};_0x3fb126[_0xae7a('0x1f')]=_[_0xae7a('0x21')](db[_0xae7a('0x1b')][_0xae7a('0x1c')]);_0x3fb126[_0xae7a('0x20')]=_[_0xae7a('0x21')](_0x2fd633['query']);_0x3fb126[_0xae7a('0x22')]=_[_0xae7a('0x23')](_0x3fb126[_0xae7a('0x1f')],_0x3fb126[_0xae7a('0x20')]);_0x3c49bc[_0xae7a('0x24')]=_[_0xae7a('0x23')](_0x3fb126['model'],qs[_0xae7a('0x25')](_0x2fd633['query'][_0xae7a('0x25')]));_0x3c49bc[_0xae7a('0x24')]=_0x3c49bc[_0xae7a('0x24')]['length']?_0x3c49bc[_0xae7a('0x24')]:_0x3fb126['model'];if(_0x2fd633[_0xae7a('0x20')][_0xae7a('0x3b')]){_0x3c49bc[_0xae7a('0x31')]=[{'all':!![]}];}_0x3c49bc=_[_0xae7a('0x2e')]({},_0x3c49bc,_0x2fd633[_0xae7a('0x30')]);return db[_0xae7a('0x1b')][_0xae7a('0x3c')](_0x3c49bc)[_0xae7a('0x12')](handleEntityNotFound(_0xb501c7,null))[_0xae7a('0x12')](function(_0x352666){if(_0x352666[_0xae7a('0x34')]==='MicrosoftAzure'){var _0x206366=encryptor[_0xae7a('0x36')](_0x352666['data3']);_0x352666[_0xae7a('0x37')]=maskClientSecret(_0x206366);}return _0x352666;})['then'](respondWithResult(_0xb501c7,null))[_0xae7a('0x38')](handleError(_0xb501c7,null));};exports[_0xae7a('0x3d')]=function(_0xd9193b,_0x223982){if(!_0xd9193b['body'][_0xae7a('0x16')])throw new Error(_0xae7a('0x3e'));if(!_0xd9193b['body']['service'])throw new Error(_0xae7a('0x3f'));var _0xd17e0f=db['CloudProvider'][_0xae7a('0x1c')]['service'][_0xae7a('0x40')];if(!_0xd17e0f['includes'](_0xd9193b['body']['service']))throw new Error(_0xae7a('0x41')+_0xd17e0f[_0xae7a('0x42')](',\x20'));if(_0xd9193b['body'][_0xae7a('0x34')]==='MicrosoftAzure'&&_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]){_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]=encryptor[_0xae7a('0x44')](_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]);}return db['CloudProvider']['create'](_0xd9193b[_0xae7a('0x43')],{})[_0xae7a('0x12')](respondWithResult(_0x223982,0xc9))['catch'](handleError(_0x223982,null));};exports[_0xae7a('0x11')]=function(_0x1ac0bf,_0x9666bd){if(_0x1ac0bf[_0xae7a('0x43')]['id']){delete _0x1ac0bf[_0xae7a('0x43')]['id'];}return db[_0xae7a('0x1b')][_0xae7a('0x3c')]({'where':{'id':_0x1ac0bf['params']['id']}})[_0xae7a('0x12')](handleEntityNotFound(_0x9666bd,null))[_0xae7a('0x12')](function(_0x1c0cf9){if(_0x1c0cf9['service']===_0xae7a('0x35')&&_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]){_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]=encryptor['encryptString'](_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]);}return _0x1c0cf9;})[_0xae7a('0x12')](saveUpdates(_0x1ac0bf['body'],null))[_0xae7a('0x12')](respondWithResult(_0x9666bd,null))[_0xae7a('0x38')](handleError(_0x9666bd,null));};exports[_0xae7a('0x13')]=function(_0x2b5f1f,_0x2d3c56){return db[_0xae7a('0x1b')][_0xae7a('0x3c')]({'where':{'id':_0x2b5f1f[_0xae7a('0x3a')]['id']}})[_0xae7a('0x12')](handleEntityNotFound(_0x2d3c56,null))[_0xae7a('0x12')](removeEntity(_0x2d3c56,null))[_0xae7a('0x38')](handleError(_0x2d3c56,null));};exports[_0xae7a('0x45')]=function(_0x11f053,_0x47cd94){return db[_0xae7a('0x1b')]['findOne']({'where':{'id':_0x11f053['params']['id']},'raw':!![]})[_0xae7a('0x12')](function(_0x667b7e){if(!_0x667b7e)return _0x47cd94[_0xae7a('0xa')](0x194);return{'url':oauth[_0xae7a('0x46')](_0x667b7e,_0x11f053[_0xae7a('0x47')]['id'])};})['then'](respondWithResult(_0x47cd94,null))[_0xae7a('0x38')](handleError(_0x47cd94,null));};exports['oauth2MicrosoftCallback']=function(_0x2c4533,_0x22900c){var _0x1f4fa4=_0x2c4533[_0xae7a('0x43')];var _0x196c50;var _0x851d51;if(_0x1f4fa4[_0xae7a('0x15')])throw _0x1f4fa4;redis['get'](_0x1f4fa4[_0xae7a('0x48')])[_0xae7a('0x12')](function(_0x615ce0){if(!_0x615ce0)throw new Error(_0xae7a('0x49'));_0x196c50=JSON[_0xae7a('0x4a')](_0x615ce0);var _0x46b256=Buffer[_0xae7a('0x4b')](_0x1f4fa4['state'],_0xae7a('0x4c'))[_0xae7a('0x4d')](_0xae7a('0x4e'));_0x851d51=JSON[_0xae7a('0x4a')](_0x46b256);if(!oauth[_0xae7a('0x4f')](_0x1f4fa4[_0xae7a('0x50')],_0x196c50[_0xae7a('0x51')]))throw new Error(_0xae7a('0x52'));redis['del'](_0x1f4fa4['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x1f4fa4['code'],_0x196c50);})[_0xae7a('0x12')](function(_0x2c7a6c){_0x196c50[_0xae7a('0x53')]=_0x2c7a6c[_0xae7a('0x54')];_0x196c50[_0xae7a('0x55')]=_0x2c7a6c[_0xae7a('0x56')];return db['CloudProvider']['update']({'data5':_0x196c50[_0xae7a('0x53')],'data6':_0x196c50[_0xae7a('0x55')]},{'where':{'id':_0x196c50['id']}});})[_0xae7a('0x12')](function(){oauth[_0xae7a('0x57')](_0x196c50);socket[_0xae7a('0x58')](_0xae7a('0x59'),{'id':_0x851d51['id']});return;})['then'](respondWithStatusCode(_0x22900c,null))[_0xae7a('0x38')](function(_0x221a4e){if(_0x851d51){socket['emit'](_0xae7a('0x5a'),{'id':_0x851d51['id']});}if(!_0x196c50){logger[_0xae7a('0x15')](_0xae7a('0x5b'),_0x221a4e);return _0x22900c[_0xae7a('0xb')](0x1f4)['send'](_0x221a4e[_0xae7a('0x5c')]);}logger['error'](_0xae7a('0x5d'),_0x196c50['id'],JSON[_0xae7a('0x5e')](_0x221a4e));});};
\ No newline at end of file