               log.error "CANT CREATE THIS USER"
               callback?  "[ERROR] unable to get user's UID, can't create user: #{stderr}"
 
-          
+
       else if stdout < config.minAllowedUid
         stdout = stdout.replace(/(\r\n|\n|\r)/gm," ")
         log.error e = "[ERROR]  min UID for commands is #{config.minAllowedUid}, your #{stdout}"

      else
        stdout = stdout.replace(/(\r\n|\n|\r)/gm," ")
        log.debug "[OK] func:checkUid: user's #{username} UID #{stdout} allowed"
        callback? null  
  
  secureUser : (options,callback)->
    # put user to the secure env http://www.cloudlinux.com/docs/cagefs/


                            callback null,"[OK] user and group #{username} has been added to LDAP"

  createVhost : (options,callback)->

    {username,uid,domainName} = options

    domainName ?= "#{username}.#{config.defaultDomain}"
    targetPath = "/Users/#{username}/Sites/#{domainName}"
    cmd        = "mkdir -p #{targetPath} && cp -r #{config.defaultVhostFiles}/website #{targetPath} && chown #{uid}:#{uid} -R #{targetPath}/*"
    log.debug "executing CreateVhost:",cmd

    exec cmd,(err,stdout,stderr)->
      unless err
        callback null, "vhost created with default files:",domainName
