UNPKG

flexbiz-server

Version:

Flexible Server

5 lines (4 loc) 1.35 kB
'use strict';const model=global.getModel("mailaccount"),controller=require("../../controllers/controller"),dns=require("dns"); module.exports=function($router$$){(new controller($router$$,model,"mailaccount",{sort:{username:1},notNeedRight:!0,onFinding:function($user$$,$condition$$,$next$$){$condition$$.user_created=$user$$.email;$next$$(null,$condition$$)},onCreating:function($user$$,$obj$$,$next$$){$obj$$.imap&&$obj$$.imap.host?dns.lookup($obj$$.imap.host,function($error$$){$error$$?$next$$("Kh\u00f4ng th\u1ec3 k\u1ebft n\u1ed1i v\u1edbi m\u00e1y ch\u1ee7 IMAP: "+$obj$$.imap.host):($obj$$.id_link||($obj$$.id_link=$user$$.email), $next$$(null,$obj$$))}):$next$$(null,$obj$$)},onUpdating:function($user$$,$data$$,$obj$$,$next$$){$data$$.imap&&$data$$.imap.host?dns.lookup($data$$.imap.host,function($error$$){$error$$?$next$$("Kh\u00f4ng th\u1ec3 k\u1ebft n\u1ed1i v\u1edbi m\u00e1y ch\u1ee7 IMAP: "+$data$$.imap.host+"\n"+$error$$.toString()):$next$$(null,$data$$,$obj$$)}):$next$$(null,$data$$,$obj$$)},onCreated:function($user$$,$obj$$,$next$$){global.mailmanagement.startAccount($obj$$);$next$$(null,$obj$$)},onUpdated:function($user$$, $obj$$,$next$$){global.mailmanagement.startAccount($obj$$);$next$$(null,$obj$$)},onDeleted:function($user$$,$obj$$,$next$$){global.mailmanagement.stopAccount($obj$$);$next$$(null,$obj$$)}})).route()};