Built motion from commit f6d7e26c.|2.6.14
[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 _0x5092=['toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','voice','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel'];(function(_0x40be9d,_0x9294ce){var _0x4fb656=function(_0x4cd05e){while(--_0x4cd05e){_0x40be9d['push'](_0x40be9d['shift']());}};_0x4fb656(++_0x9294ce);}(_0x5092,0x18e));var _0x2509=function(_0x1df477,_0x5363e1){_0x1df477=_0x1df477-0x0;var _0x302bff=_0x5092[_0x1df477];return _0x302bff;};'use strict';var _=require(_0x2509('0x0'));var BPromise=require('bluebird');var db=require(_0x2509('0x1'))['db'];var util=require('./license/util');var channels=[_0x2509('0x2'),'mail',_0x2509('0x3'),_0x2509('0x4'),_0x2509('0x5'),_0x2509('0x6'),_0x2509('0x7')];exports[_0x2509('0x8')]=function(){return channels;};exports[_0x2509('0x9')]=function(_0x368883){_0x368883=_0x368883[_0x2509('0xa')]();return _[_0x2509('0xb')](channels,_0x368883);};exports['clearBlockUser']=function(_0x9cbf25,_0x98cd82,_0x6276b5,_0x12a867){var _0x362fd7={'loginAttempts':_0x98cd82,'blocked':_0x6276b5};if(!_[_0x2509('0xc')](_0x12a867)){_0x362fd7[_0x2509('0xd')]=_0x12a867;}return _0x9cbf25[_0x2509('0xe')](_0x362fd7);};exports[_0x2509('0xf')]=function(_0xcdd53f){return new BPromise(function(_0x229e16,_0xf53cfc){var _0x283f7b=0x0;if(_0xcdd53f[_0x2509('0x10')]!==_0x2509('0x11')){_0x229e16(_0xcdd53f);}db[_0x2509('0x12')][_0x2509('0x13')]({'where':{'role':_0x2509('0x11'),'online':!![],'id':{'$ne':_0xcdd53f['id']}}})[_0x2509('0x14')](function(_0x5b35b3){_0x283f7b=_0x5b35b3;return util[_0x2509('0xf')]();})[_0x2509('0x14')](function(_0x1543f1){if(_0x1543f1&&_0x1543f1[_0x2509('0x15')]&&_0x283f7b>=_0x1543f1[_0x2509('0x15')]){throw Error(_0x2509('0x16'));}_0x229e16(_0xcdd53f);})[_0x2509('0x17')](function(_0x860b7e){_0xf53cfc(_0x860b7e);});});};