Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / config / utils.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x52b9=['openchannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','getLicense','role','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','mail','chat','fax','sms','whatsapp'];(function(_0x5e67d0,_0x33d135){var _0x2fc26b=function(_0x690675){while(--_0x690675){_0x5e67d0['push'](_0x5e67d0['shift']());}};_0x2fc26b(++_0x33d135);}(_0x52b9,0x11e));var _0x952b=function(_0x10f1fa,_0x33caad){_0x10f1fa=_0x10f1fa-0x0;var _0x21035e=_0x52b9[_0x10f1fa];return _0x21035e;};'use strict';var _=require(_0x952b('0x0'));var BPromise=require(_0x952b('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x952b('0x2'));var channels=['voice',_0x952b('0x3'),_0x952b('0x4'),_0x952b('0x5'),_0x952b('0x6'),_0x952b('0x7'),_0x952b('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x3fe8eb){_0x3fe8eb=_0x3fe8eb[_0x952b('0x9')]();return _['includes'](channels,_0x3fe8eb);};exports[_0x952b('0xa')]=function(_0xb68295,_0x1ec00c,_0x463d1e,_0x486e55){var _0x37c5b5={'loginAttempts':_0x1ec00c,'blocked':_0x463d1e};if(!_[_0x952b('0xb')](_0x486e55)){_0x37c5b5[_0x952b('0xc')]=_0x486e55;}return _0xb68295['updateAttributes'](_0x37c5b5);};exports[_0x952b('0xd')]=function(_0x722d08){return new BPromise(function(_0x1708d3,_0x4129a3){var _0x423ceb=0x0;if(_0x722d08[_0x952b('0xe')]!==_0x952b('0xf')){_0x1708d3(_0x722d08);}db['User'][_0x952b('0x10')]({'where':{'role':_0x952b('0xf'),'online':!![],'id':{'$ne':_0x722d08['id']}}})[_0x952b('0x11')](function(_0xe6295a){_0x423ceb=_0xe6295a;return util[_0x952b('0xd')]();})[_0x952b('0x11')](function(_0x299f6b){if(_0x299f6b&&_0x299f6b[_0x952b('0x12')]&&_0x423ceb>=_0x299f6b[_0x952b('0x12')]){throw Error(_0x952b('0x13'));}_0x1708d3(_0x722d08);})[_0x952b('0x14')](function(_0x46e35e){_0x4129a3(_0x46e35e);});});};