Built motion from commit (unavailable).|2.4.18
[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 _0x9228=['fax','sms','openchannel','getChannels','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','voice','chat'];(function(_0x4e2e78,_0x26804d){var _0x481b3e=function(_0x444b87){while(--_0x444b87){_0x4e2e78['push'](_0x4e2e78['shift']());}};_0x481b3e(++_0x26804d);}(_0x9228,0x1de));var _0x8922=function(_0x4fe823,_0x16dbde){_0x4fe823=_0x4fe823-0x0;var _0x3693c9=_0x9228[_0x4fe823];return _0x3693c9;};'use strict';var _=require(_0x8922('0x0'));var BPromise=require(_0x8922('0x1'));var db=require(_0x8922('0x2'))['db'];var util=require(_0x8922('0x3'));var channels=[_0x8922('0x4'),'mail',_0x8922('0x5'),_0x8922('0x6'),_0x8922('0x7'),_0x8922('0x8')];exports[_0x8922('0x9')]=function(){return channels;};exports['isValidChannel']=function(_0x566090){_0x566090=_0x566090[_0x8922('0xa')]();return _['includes'](channels,_0x566090);};exports[_0x8922('0xb')]=function(_0x4c8355,_0x42f895,_0x428632,_0x45a595){var _0x3532ea={'loginAttempts':_0x42f895,'blocked':_0x428632};if(!_[_0x8922('0xc')](_0x45a595)){_0x3532ea[_0x8922('0xd')]=_0x45a595;}return _0x4c8355[_0x8922('0xe')](_0x3532ea);};exports[_0x8922('0xf')]=function(_0xb6af6b){return new BPromise(function(_0x524dcb,_0xf5f2fd){var _0x12915a=0x0;if(_0xb6af6b['role']!==_0x8922('0x10')){_0x524dcb(_0xb6af6b);}db[_0x8922('0x11')][_0x8922('0x12')]({'where':{'role':_0x8922('0x10'),'online':!![],'id':{'$ne':_0xb6af6b['id']}}})[_0x8922('0x13')](function(_0x14c86c){_0x12915a=_0x14c86c;return util['getLicense']();})[_0x8922('0x13')](function(_0xe7813c){if(_0xe7813c&&_0xe7813c['agents']&&_0x12915a>=_0xe7813c[_0x8922('0x14')]){throw Error(_0x8922('0x15'));}_0x524dcb(_0xb6af6b);})['catch'](function(_0x5f3ac4){_0xf5f2fd(_0x5f3ac4);});});};