Built motion from commit ffdca78c.|2.6.24
[motion2.git] / server / api / cloudProvider / cloudProvider.controller.js
index 4379238..8f2d3d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ff8=['data3','catch','show','params','keys','length','find','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','ascii','Unable\x20to\x20validate\x20id_token','code','data5','data6','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy','then','error','name','send','slice','index','map','CloudProvider','rawAttributes','fieldName','model','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','service','decryptString'];(function(_0x434e05,_0x243a35){var _0x422b3c=function(_0x702507){while(--_0x702507){_0x434e05['push'](_0x434e05['shift']());}};_0x422b3c(++_0x243a35);}(_0x1ff8,0x86));var _0x81ff=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x1ff8[_0x65c903];return _0x23e1d7;};'use strict';var _=require(_0x81ff('0x0'));var Redis=require(_0x81ff('0x1'));var qs=require(_0x81ff('0x2'));var encryptor=require(_0x81ff('0x3'));var config=require('../../config/environment');var logger=require(_0x81ff('0x4'))(_0x81ff('0x5'));var db=require(_0x81ff('0x6'))['db'];var oauth=require(_0x81ff('0x7'));config[_0x81ff('0x8')]=_[_0x81ff('0x9')](config[_0x81ff('0x8')],{'host':_0x81ff('0xa'),'port':0x18eb});var socket=require(_0x81ff('0xb'))(new Redis(config[_0x81ff('0x8')]));var redis=new Redis(config[_0x81ff('0x8')]);function respondWithStatusCode(_0x33bb82,_0x416ebd){_0x416ebd=_0x416ebd||0xcc;return function(_0x3c7d38){if(_0x3c7d38){return _0x33bb82[_0x81ff('0xc')](_0x416ebd);}return _0x33bb82[_0x81ff('0xd')](_0x416ebd)[_0x81ff('0xe')]();};}function respondWithResult(_0x239050,_0x31be77){_0x31be77=_0x31be77||0xc8;return function(_0x1fa1fc){if(_0x1fa1fc){return _0x239050[_0x81ff('0xd')](_0x31be77)[_0x81ff('0xf')](_0x1fa1fc);}};}function respondWithFilteredResult(_0x15a3df,_0x305a46){return function(_0x45b154){if(_0x45b154){var _0x521ad1=typeof _0x305a46[_0x81ff('0x10')]==='undefined'&&typeof _0x305a46[_0x81ff('0x11')]==='undefined';var _0x3f591c=_0x45b154[_0x81ff('0x12')];var _0x4f4804=_0x521ad1?0x0:_0x305a46[_0x81ff('0x10')];var _0xf3cb54=_0x521ad1?_0x45b154[_0x81ff('0x12')]:_0x305a46[_0x81ff('0x10')]+_0x305a46[_0x81ff('0x11')];var _0x261f35;if(_0xf3cb54>=_0x3f591c){_0xf3cb54=_0x3f591c;_0x261f35=0xc8;}else{_0x261f35=0xce;}_0x15a3df[_0x81ff('0xd')](_0x261f35);return _0x15a3df[_0x81ff('0x13')](_0x81ff('0x14'),_0x4f4804+'-'+_0xf3cb54+'/'+_0x3f591c)[_0x81ff('0xf')](_0x45b154);}return null;};}function saveUpdates(_0x3a6a17){return function(_0x1564e1){if(_0x1564e1){return _0x1564e1[_0x81ff('0x15')](_0x3a6a17)['then'](function(_0x3284ff){return _0x3284ff;});}return null;};}function removeEntity(_0x4f6795){return function(_0x3febc8){if(_0x3febc8){return _0x3febc8[_0x81ff('0x16')]()[_0x81ff('0x17')](function(){_0x4f6795['status'](0xcc)[_0x81ff('0xe')]();});}};}function handleEntityNotFound(_0x2aedb9){return function(_0x19698d){if(!_0x19698d){_0x2aedb9[_0x81ff('0xc')](0x194);}return _0x19698d;};}function handleError(_0x4177eb,_0x49c7b8){_0x49c7b8=_0x49c7b8||0x1f4;return function(_0xc2dc05){logger[_0x81ff('0x18')](_0xc2dc05['stack']);if(_0xc2dc05[_0x81ff('0x19')]){delete _0xc2dc05[_0x81ff('0x19')];}_0x4177eb[_0x81ff('0xd')](_0x49c7b8)[_0x81ff('0x1a')](_0xc2dc05);};}function maskClientSecret(_0x42dc92){return _['padEnd'](_0x42dc92[_0x81ff('0x1b')](0x0,0x3),0x14,'*');}exports[_0x81ff('0x1c')]=function(_0xa382a9,_0x2c14ad){var _0x4f4576={},_0x74e4e5={},_0x153a1e={'count':0x0,'rows':[]};var _0x427939=_[_0x81ff('0x1d')](db[_0x81ff('0x1e')][_0x81ff('0x1f')],function(_0x2be28d){return{'name':_0x2be28d[_0x81ff('0x20')],'type':_0x2be28d['type']['key']};});_0x74e4e5[_0x81ff('0x21')]=_[_0x81ff('0x1d')](_0x427939,_0x81ff('0x19'));_0x74e4e5['query']=_['keys'](_0xa382a9['query']);_0x74e4e5[_0x81ff('0x22')]=_[_0x81ff('0x23')](_0x74e4e5['model'],_0x74e4e5['query']);_0x4f4576['attributes']=_[_0x81ff('0x23')](_0x74e4e5[_0x81ff('0x21')],qs[_0x81ff('0x24')](_0xa382a9[_0x81ff('0x25')]['fields']));_0x4f4576[_0x81ff('0x26')]=_0x4f4576[_0x81ff('0x26')]['length']?_0x4f4576[_0x81ff('0x26')]:_0x74e4e5[_0x81ff('0x21')];if(!_0xa382a9[_0x81ff('0x25')][_0x81ff('0x27')](_0x81ff('0x28'))){_0x4f4576[_0x81ff('0x11')]=qs[_0x81ff('0x11')](_0xa382a9[_0x81ff('0x25')][_0x81ff('0x11')]);_0x4f4576[_0x81ff('0x10')]=qs['offset'](_0xa382a9[_0x81ff('0x25')][_0x81ff('0x10')]);}_0x4f4576[_0x81ff('0x29')]=qs[_0x81ff('0x2a')](_0xa382a9[_0x81ff('0x25')]['sort']);_0x4f4576[_0x81ff('0x2b')]=qs[_0x81ff('0x22')](_[_0x81ff('0x2c')](_0xa382a9[_0x81ff('0x25')],_0x74e4e5['filters']),_0x427939);if(_0xa382a9[_0x81ff('0x25')][_0x81ff('0x2d')]){_0x4f4576[_0x81ff('0x2b')]=_[_0x81ff('0x2e')](_0x4f4576[_0x81ff('0x2b')],{'$or':_[_0x81ff('0x1d')](_0x427939,function(_0x23a129){if(_0x23a129[_0x81ff('0x2f')]!==_0x81ff('0x30')){var _0x4c66a0={};_0x4c66a0[_0x23a129['name']]={'$like':'%'+_0xa382a9[_0x81ff('0x25')][_0x81ff('0x2d')]+'%'};return _0x4c66a0;}})});}_0x4f4576=_[_0x81ff('0x2e')]({},_0x4f4576,_0xa382a9[_0x81ff('0x31')]);var _0x2a347f={'where':_0x4f4576[_0x81ff('0x2b')]};return db['CloudProvider'][_0x81ff('0x12')](_0x2a347f)['then'](function(_0x4ee248){_0x153a1e[_0x81ff('0x12')]=_0x4ee248;if(_0xa382a9[_0x81ff('0x25')][_0x81ff('0x32')]){_0x4f4576[_0x81ff('0x33')]=[{'all':!![]}];}return db[_0x81ff('0x1e')][_0x81ff('0x34')](_0x4f4576);})[_0x81ff('0x17')](function(_0x408c69){_0x153a1e[_0x81ff('0x35')]=_['map'](_0x408c69,function(_0x252568){if(_0x252568[_0x81ff('0x36')]==='MicrosoftAzure'){var _0x2863b7=encryptor[_0x81ff('0x37')](_0x252568[_0x81ff('0x38')]);_0x252568[_0x81ff('0x38')]=maskClientSecret(_0x2863b7);}return _0x252568;});return _0x153a1e;})[_0x81ff('0x17')](respondWithFilteredResult(_0x2c14ad,_0x4f4576))[_0x81ff('0x39')](handleError(_0x2c14ad,null));};exports[_0x81ff('0x3a')]=function(_0x20b4a1,_0x5543e5){var _0xe1d873={'raw':!![],'where':{'id':_0x20b4a1[_0x81ff('0x3b')]['id']}},_0x2b19af={};_0x2b19af[_0x81ff('0x21')]=_[_0x81ff('0x3c')](db[_0x81ff('0x1e')][_0x81ff('0x1f')]);_0x2b19af[_0x81ff('0x25')]=_[_0x81ff('0x3c')](_0x20b4a1[_0x81ff('0x25')]);_0x2b19af[_0x81ff('0x22')]=_[_0x81ff('0x23')](_0x2b19af[_0x81ff('0x21')],_0x2b19af[_0x81ff('0x25')]);_0xe1d873[_0x81ff('0x26')]=_['intersection'](_0x2b19af[_0x81ff('0x21')],qs[_0x81ff('0x24')](_0x20b4a1['query']['fields']));_0xe1d873[_0x81ff('0x26')]=_0xe1d873[_0x81ff('0x26')][_0x81ff('0x3d')]?_0xe1d873[_0x81ff('0x26')]:_0x2b19af['model'];if(_0x20b4a1[_0x81ff('0x25')]['includeAll']){_0xe1d873[_0x81ff('0x33')]=[{'all':!![]}];}_0xe1d873=_['merge']({},_0xe1d873,_0x20b4a1[_0x81ff('0x31')]);return db[_0x81ff('0x1e')][_0x81ff('0x3e')](_0xe1d873)[_0x81ff('0x17')](handleEntityNotFound(_0x5543e5,null))[_0x81ff('0x17')](function(_0x442f04){if(_0x442f04[_0x81ff('0x36')]===_0x81ff('0x3f')){var _0x53152c=encryptor[_0x81ff('0x37')](_0x442f04[_0x81ff('0x38')]);_0x442f04[_0x81ff('0x38')]=maskClientSecret(_0x53152c);}return _0x442f04;})[_0x81ff('0x17')](respondWithResult(_0x5543e5,null))['catch'](handleError(_0x5543e5,null));};exports[_0x81ff('0x40')]=function(_0x256159,_0x1bbd2d){if(!_0x256159[_0x81ff('0x41')][_0x81ff('0x19')])throw new Error(_0x81ff('0x42'));if(!_0x256159['body'][_0x81ff('0x36')])throw new Error(_0x81ff('0x43'));var _0x434634=db[_0x81ff('0x1e')][_0x81ff('0x1f')][_0x81ff('0x36')][_0x81ff('0x44')];if(!_0x434634[_0x81ff('0x45')](_0x256159[_0x81ff('0x41')][_0x81ff('0x36')]))throw new Error(_0x81ff('0x46')+_0x434634[_0x81ff('0x47')](',\x20'));if(_0x256159[_0x81ff('0x41')]['service']===_0x81ff('0x3f')&&_0x256159[_0x81ff('0x41')]['data3']){_0x256159['body'][_0x81ff('0x38')]=encryptor[_0x81ff('0x48')](_0x256159[_0x81ff('0x41')][_0x81ff('0x38')]);}return db[_0x81ff('0x1e')][_0x81ff('0x40')](_0x256159[_0x81ff('0x41')],{})[_0x81ff('0x17')](respondWithResult(_0x1bbd2d,0xc9))['catch'](handleError(_0x1bbd2d,null));};exports[_0x81ff('0x15')]=function(_0xa60f67,_0x6af4de){if(_0xa60f67['body']['id']){delete _0xa60f67[_0x81ff('0x41')]['id'];}return db[_0x81ff('0x1e')]['find']({'where':{'id':_0xa60f67['params']['id']}})[_0x81ff('0x17')](handleEntityNotFound(_0x6af4de,null))[_0x81ff('0x17')](function(_0x8eb2f4){if(_0x8eb2f4['service']===_0x81ff('0x3f')&&_0xa60f67[_0x81ff('0x41')][_0x81ff('0x38')]){_0xa60f67[_0x81ff('0x41')][_0x81ff('0x38')]=encryptor[_0x81ff('0x48')](_0xa60f67[_0x81ff('0x41')]['data3']);}return _0x8eb2f4;})[_0x81ff('0x17')](saveUpdates(_0xa60f67[_0x81ff('0x41')],null))[_0x81ff('0x17')](respondWithResult(_0x6af4de,null))[_0x81ff('0x39')](handleError(_0x6af4de,null));};exports[_0x81ff('0x16')]=function(_0x238276,_0x4ef55c){return db[_0x81ff('0x1e')][_0x81ff('0x3e')]({'where':{'id':_0x238276[_0x81ff('0x3b')]['id']}})[_0x81ff('0x17')](handleEntityNotFound(_0x4ef55c,null))['then'](removeEntity(_0x4ef55c,null))[_0x81ff('0x39')](handleError(_0x4ef55c,null));};exports[_0x81ff('0x49')]=function(_0x265798,_0x5f7337){return db[_0x81ff('0x1e')][_0x81ff('0x4a')]({'where':{'id':_0x265798['params']['id']},'raw':!![]})[_0x81ff('0x17')](function(_0x3fe019){if(!_0x3fe019)return _0x5f7337[_0x81ff('0xc')](0x194);return{'url':oauth[_0x81ff('0x4b')](_0x3fe019,_0x265798[_0x81ff('0x4c')]['id'])};})['then'](respondWithResult(_0x5f7337,null))[_0x81ff('0x39')](handleError(_0x5f7337,null));};exports[_0x81ff('0x4d')]=function(_0x383105,_0x334410){var _0x472c68=_0x383105[_0x81ff('0x41')];var _0x2e183a;var _0x1f0fc6;if(_0x472c68['error'])throw _0x472c68;redis[_0x81ff('0x4e')](_0x472c68[_0x81ff('0x4f')])[_0x81ff('0x17')](function(_0xe5cf55){if(!_0xe5cf55)throw new Error(_0x81ff('0x50'));_0x2e183a=JSON[_0x81ff('0x51')](_0xe5cf55);var _0x20cfa5=Buffer[_0x81ff('0x52')](_0x472c68[_0x81ff('0x4f')],'base64')['toString'](_0x81ff('0x53'));_0x1f0fc6=JSON[_0x81ff('0x51')](_0x20cfa5);if(!oauth['isValidIdToken'](_0x472c68['id_token'],_0x2e183a['oauth2Claims']))throw new Error(_0x81ff('0x54'));redis['del'](_0x472c68['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x472c68[_0x81ff('0x55')],_0x2e183a);})['then'](function(_0x15355b){_0x2e183a[_0x81ff('0x56')]=_0x15355b['access_token'];_0x2e183a[_0x81ff('0x57')]=_0x15355b['refresh_token'];return db[_0x81ff('0x1e')]['update']({'data5':_0x2e183a[_0x81ff('0x56')],'data6':_0x2e183a['data6']},{'where':{'id':_0x2e183a['id']}});})[_0x81ff('0x17')](function(){oauth[_0x81ff('0x58')](_0x2e183a);socket['emit'](_0x81ff('0x59'),{'id':_0x1f0fc6['id']});return;})['then'](respondWithStatusCode(_0x334410,null))[_0x81ff('0x39')](function(_0x5517a0){if(_0x1f0fc6){socket[_0x81ff('0x5a')](_0x81ff('0x5b'),{'id':_0x1f0fc6['id']});}if(!_0x2e183a){logger['error'](_0x81ff('0x5c'),_0x5517a0);return _0x334410['status'](0x1f4)['send'](_0x5517a0['message']);}logger['error'](_0x81ff('0x5d'),_0x2e183a['id'],JSON[_0x81ff('0x5e')](_0x5517a0));});};
\ No newline at end of file
+var _0x8f42=['encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','from','state','toString','ascii','id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','then','destroy','error','name','send','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','rows','service','MicrosoftAzure','data3','show','params','length','include','find','decryptString','catch','create','body','Service\x20parameter\x20not\x20specified','values','includes'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x8f42,0x184));var _0x28f4=function(_0x27ec50,_0x1d8698){_0x27ec50=_0x27ec50-0x0;var _0x2da0f5=_0x8f42[_0x27ec50];return _0x2da0f5;};'use strict';var _=require(_0x28f4('0x0'));var Redis=require(_0x28f4('0x1'));var qs=require(_0x28f4('0x2'));var encryptor=require(_0x28f4('0x3'));var config=require(_0x28f4('0x4'));var logger=require(_0x28f4('0x5'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0x28f4('0x6'));config[_0x28f4('0x7')]=_[_0x28f4('0x8')](config[_0x28f4('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x28f4('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x28f4('0x7')]);function respondWithStatusCode(_0x42f375,_0x4aead5){_0x4aead5=_0x4aead5||0xcc;return function(_0x197c4e){if(_0x197c4e){return _0x42f375[_0x28f4('0xa')](_0x4aead5);}return _0x42f375['status'](_0x4aead5)[_0x28f4('0xb')]();};}function respondWithResult(_0x5d5afe,_0x57afb5){_0x57afb5=_0x57afb5||0xc8;return function(_0x340a72){if(_0x340a72){return _0x5d5afe['status'](_0x57afb5)[_0x28f4('0xc')](_0x340a72);}};}function respondWithFilteredResult(_0x18d462,_0x3bc618){return function(_0x310850){if(_0x310850){var _0x4eaadd=typeof _0x3bc618[_0x28f4('0xd')]===_0x28f4('0xe')&&typeof _0x3bc618[_0x28f4('0xf')]===_0x28f4('0xe');var _0x140597=_0x310850[_0x28f4('0x10')];var _0x5df20e=_0x4eaadd?0x0:_0x3bc618[_0x28f4('0xd')];var _0xdd85e9=_0x4eaadd?_0x310850[_0x28f4('0x10')]:_0x3bc618[_0x28f4('0xd')]+_0x3bc618[_0x28f4('0xf')];var _0x1208ce;if(_0xdd85e9>=_0x140597){_0xdd85e9=_0x140597;_0x1208ce=0xc8;}else{_0x1208ce=0xce;}_0x18d462[_0x28f4('0x11')](_0x1208ce);return _0x18d462['set'](_0x28f4('0x12'),_0x5df20e+'-'+_0xdd85e9+'/'+_0x140597)[_0x28f4('0xc')](_0x310850);}return null;};}function saveUpdates(_0x591ab0){return function(_0x12d049){if(_0x12d049){return _0x12d049[_0x28f4('0x13')](_0x591ab0)[_0x28f4('0x14')](function(_0x359759){return _0x359759;});}return null;};}function removeEntity(_0x4cb7fc){return function(_0x133f20){if(_0x133f20){return _0x133f20[_0x28f4('0x15')]()[_0x28f4('0x14')](function(){_0x4cb7fc[_0x28f4('0x11')](0xcc)[_0x28f4('0xb')]();});}};}function handleEntityNotFound(_0x1d3b1d){return function(_0x3cf798){if(!_0x3cf798){_0x1d3b1d[_0x28f4('0xa')](0x194);}return _0x3cf798;};}function handleError(_0x3bae35,_0x49327b){_0x49327b=_0x49327b||0x1f4;return function(_0x28afe6){logger[_0x28f4('0x16')](_0x28afe6['stack']);if(_0x28afe6[_0x28f4('0x17')]){delete _0x28afe6['name'];}_0x3bae35[_0x28f4('0x11')](_0x49327b)[_0x28f4('0x18')](_0x28afe6);};}function maskClientSecret(_0x55f0ff){return _[_0x28f4('0x19')](_0x55f0ff[_0x28f4('0x1a')](0x0,0x3),0x14,'*');}exports[_0x28f4('0x1b')]=function(_0x32f6a6,_0x1d4fd1){var _0x22cdea={},_0x5f426b={},_0xe9f18e={'count':0x0,'rows':[]};var _0x5b374a=_['map'](db[_0x28f4('0x1c')][_0x28f4('0x1d')],function(_0x58ff78){return{'name':_0x58ff78[_0x28f4('0x1e')],'type':_0x58ff78[_0x28f4('0x1f')][_0x28f4('0x20')]};});_0x5f426b[_0x28f4('0x21')]=_['map'](_0x5b374a,_0x28f4('0x17'));_0x5f426b[_0x28f4('0x22')]=_[_0x28f4('0x23')](_0x32f6a6[_0x28f4('0x22')]);_0x5f426b[_0x28f4('0x24')]=_[_0x28f4('0x25')](_0x5f426b[_0x28f4('0x21')],_0x5f426b[_0x28f4('0x22')]);_0x22cdea[_0x28f4('0x26')]=_[_0x28f4('0x25')](_0x5f426b['model'],qs[_0x28f4('0x27')](_0x32f6a6['query'][_0x28f4('0x27')]));_0x22cdea['attributes']=_0x22cdea['attributes']['length']?_0x22cdea['attributes']:_0x5f426b['model'];if(!_0x32f6a6[_0x28f4('0x22')][_0x28f4('0x28')](_0x28f4('0x29'))){_0x22cdea['limit']=qs['limit'](_0x32f6a6[_0x28f4('0x22')]['limit']);_0x22cdea[_0x28f4('0xd')]=qs[_0x28f4('0xd')](_0x32f6a6['query'][_0x28f4('0xd')]);}_0x22cdea['order']=qs[_0x28f4('0x2a')](_0x32f6a6[_0x28f4('0x22')]['sort']);_0x22cdea['where']=qs[_0x28f4('0x24')](_['pick'](_0x32f6a6[_0x28f4('0x22')],_0x5f426b[_0x28f4('0x24')]),_0x5b374a);if(_0x32f6a6[_0x28f4('0x22')][_0x28f4('0x2b')]){_0x22cdea[_0x28f4('0x2c')]=_[_0x28f4('0x2d')](_0x22cdea[_0x28f4('0x2c')],{'$or':_[_0x28f4('0x2e')](_0x5b374a,function(_0x570299){if(_0x570299[_0x28f4('0x1f')]!==_0x28f4('0x2f')){var _0x5e5cda={};_0x5e5cda[_0x570299['name']]={'$like':'%'+_0x32f6a6['query'][_0x28f4('0x2b')]+'%'};return _0x5e5cda;}})});}_0x22cdea=_['merge']({},_0x22cdea,_0x32f6a6[_0x28f4('0x30')]);var _0x2e7d51={'where':_0x22cdea['where']};return db[_0x28f4('0x1c')][_0x28f4('0x10')](_0x2e7d51)['then'](function(_0x31fdf1){_0xe9f18e[_0x28f4('0x10')]=_0x31fdf1;if(_0x32f6a6[_0x28f4('0x22')][_0x28f4('0x31')]){_0x22cdea['include']=[{'all':!![]}];}return db[_0x28f4('0x1c')][_0x28f4('0x32')](_0x22cdea);})[_0x28f4('0x14')](function(_0x33b329){_0xe9f18e[_0x28f4('0x33')]=_[_0x28f4('0x2e')](_0x33b329,function(_0x13e0c4){if(_0x13e0c4[_0x28f4('0x34')]===_0x28f4('0x35')){var _0x27072a=encryptor['decryptString'](_0x13e0c4[_0x28f4('0x36')]);_0x13e0c4[_0x28f4('0x36')]=maskClientSecret(_0x27072a);}return _0x13e0c4;});return _0xe9f18e;})['then'](respondWithFilteredResult(_0x1d4fd1,_0x22cdea))['catch'](handleError(_0x1d4fd1,null));};exports[_0x28f4('0x37')]=function(_0xe60a31,_0xcf640f){var _0x345a88={'raw':!![],'where':{'id':_0xe60a31[_0x28f4('0x38')]['id']}},_0x2bfb10={};_0x2bfb10['model']=_[_0x28f4('0x23')](db[_0x28f4('0x1c')][_0x28f4('0x1d')]);_0x2bfb10['query']=_[_0x28f4('0x23')](_0xe60a31[_0x28f4('0x22')]);_0x2bfb10['filters']=_[_0x28f4('0x25')](_0x2bfb10[_0x28f4('0x21')],_0x2bfb10[_0x28f4('0x22')]);_0x345a88[_0x28f4('0x26')]=_[_0x28f4('0x25')](_0x2bfb10[_0x28f4('0x21')],qs['fields'](_0xe60a31[_0x28f4('0x22')][_0x28f4('0x27')]));_0x345a88['attributes']=_0x345a88[_0x28f4('0x26')][_0x28f4('0x39')]?_0x345a88[_0x28f4('0x26')]:_0x2bfb10[_0x28f4('0x21')];if(_0xe60a31['query'][_0x28f4('0x31')]){_0x345a88[_0x28f4('0x3a')]=[{'all':!![]}];}_0x345a88=_[_0x28f4('0x2d')]({},_0x345a88,_0xe60a31['options']);return db['CloudProvider'][_0x28f4('0x3b')](_0x345a88)[_0x28f4('0x14')](handleEntityNotFound(_0xcf640f,null))['then'](function(_0x36caa7){if(_0x36caa7['service']===_0x28f4('0x35')){var _0x269c0e=encryptor[_0x28f4('0x3c')](_0x36caa7[_0x28f4('0x36')]);_0x36caa7[_0x28f4('0x36')]=maskClientSecret(_0x269c0e);}return _0x36caa7;})[_0x28f4('0x14')](respondWithResult(_0xcf640f,null))[_0x28f4('0x3d')](handleError(_0xcf640f,null));};exports[_0x28f4('0x3e')]=function(_0x3a940a,_0x4a8ccd){if(!_0x3a940a[_0x28f4('0x3f')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3a940a[_0x28f4('0x3f')][_0x28f4('0x34')])throw new Error(_0x28f4('0x40'));var _0x373981=db['CloudProvider']['rawAttributes'][_0x28f4('0x34')][_0x28f4('0x41')];if(!_0x373981[_0x28f4('0x42')](_0x3a940a[_0x28f4('0x3f')][_0x28f4('0x34')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x373981['join'](',\x20'));if(_0x3a940a[_0x28f4('0x3f')][_0x28f4('0x34')]===_0x28f4('0x35')&&_0x3a940a[_0x28f4('0x3f')][_0x28f4('0x36')]){_0x3a940a['body']['data3']=encryptor[_0x28f4('0x43')](_0x3a940a[_0x28f4('0x3f')][_0x28f4('0x36')]);}return db['CloudProvider']['create'](_0x3a940a['body'],{})['then'](respondWithResult(_0x4a8ccd,0xc9))[_0x28f4('0x3d')](handleError(_0x4a8ccd,null));};exports[_0x28f4('0x13')]=function(_0x31a61d,_0x56dfe8){if(_0x31a61d['body']['id']){delete _0x31a61d[_0x28f4('0x3f')]['id'];}return db[_0x28f4('0x1c')][_0x28f4('0x3b')]({'where':{'id':_0x31a61d[_0x28f4('0x38')]['id']}})[_0x28f4('0x14')](handleEntityNotFound(_0x56dfe8,null))[_0x28f4('0x14')](function(_0x2fd0fd){if(_0x2fd0fd[_0x28f4('0x34')]===_0x28f4('0x35')&&_0x31a61d[_0x28f4('0x3f')]['data3']){_0x31a61d[_0x28f4('0x3f')]['data3']=encryptor[_0x28f4('0x43')](_0x31a61d[_0x28f4('0x3f')]['data3']);}return _0x2fd0fd;})[_0x28f4('0x14')](saveUpdates(_0x31a61d[_0x28f4('0x3f')],null))[_0x28f4('0x14')](respondWithResult(_0x56dfe8,null))[_0x28f4('0x3d')](handleError(_0x56dfe8,null));};exports[_0x28f4('0x15')]=function(_0x469aa0,_0x35ec2c){return db[_0x28f4('0x1c')][_0x28f4('0x3b')]({'where':{'id':_0x469aa0[_0x28f4('0x38')]['id']}})[_0x28f4('0x14')](handleEntityNotFound(_0x35ec2c,null))[_0x28f4('0x14')](removeEntity(_0x35ec2c,null))[_0x28f4('0x3d')](handleError(_0x35ec2c,null));};exports[_0x28f4('0x44')]=function(_0xab072,_0x3271f1){return db[_0x28f4('0x1c')]['findOne']({'where':{'id':_0xab072[_0x28f4('0x38')]['id']},'raw':!![]})['then'](function(_0xa17f71){if(!_0xa17f71)return _0x3271f1[_0x28f4('0xa')](0x194);return{'url':oauth[_0x28f4('0x45')](_0xa17f71,_0xab072[_0x28f4('0x46')]['id'])};})[_0x28f4('0x14')](respondWithResult(_0x3271f1,null))[_0x28f4('0x3d')](handleError(_0x3271f1,null));};exports['oauth2MicrosoftCallback']=function(_0x393382,_0x194e57){var _0xd9b54f=_0x393382[_0x28f4('0x3f')];var _0x32fe23;var _0x516457;if(_0xd9b54f[_0x28f4('0x16')])throw _0xd9b54f;redis[_0x28f4('0x47')](_0xd9b54f['state'])[_0x28f4('0x14')](function(_0x2ce22d){if(!_0x2ce22d)throw new Error(_0x28f4('0x48'));_0x32fe23=JSON[_0x28f4('0x49')](_0x2ce22d);var _0x3d4056=Buffer[_0x28f4('0x4a')](_0xd9b54f[_0x28f4('0x4b')],'base64')[_0x28f4('0x4c')](_0x28f4('0x4d'));_0x516457=JSON[_0x28f4('0x49')](_0x3d4056);if(!oauth['isValidIdToken'](_0xd9b54f[_0x28f4('0x4e')],_0x32fe23['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x28f4('0x4f')](_0xd9b54f[_0x28f4('0x4b')]);return oauth[_0x28f4('0x50')](_0xd9b54f[_0x28f4('0x51')],_0x32fe23);})['then'](function(_0x5499d7){_0x32fe23[_0x28f4('0x52')]=_0x5499d7['access_token'];_0x32fe23[_0x28f4('0x53')]=_0x5499d7[_0x28f4('0x54')];return db[_0x28f4('0x1c')][_0x28f4('0x13')]({'data5':_0x32fe23[_0x28f4('0x52')],'data6':_0x32fe23[_0x28f4('0x53')]},{'where':{'id':_0x32fe23['id']}});})[_0x28f4('0x14')](function(){oauth['startRefreshInterval'](_0x32fe23);socket[_0x28f4('0x55')](_0x28f4('0x56'),{'id':_0x516457['id']});return;})[_0x28f4('0x14')](respondWithStatusCode(_0x194e57,null))['catch'](function(_0x463074){if(_0x516457){socket[_0x28f4('0x55')](_0x28f4('0x57'),{'id':_0x516457['id']});}if(!_0x32fe23){logger[_0x28f4('0x16')](_0x28f4('0x58'),_0x463074);return _0x194e57[_0x28f4('0x11')](0x1f4)[_0x28f4('0x18')](_0x463074['message']);}logger[_0x28f4('0x16')](_0x28f4('0x59'),_0x32fe23['id'],JSON[_0x28f4('0x5a')](_0x463074));});};
\ No newline at end of file