           else
             log "[JInvitation.sendBetaInvite] something got messed up."
 
-  
-  # @__createBetaInvites =do ->
-  #   #betaTestersEmails = 'chris123412341234@jraphical.com'
-  #   betaTestersEmails = fs.readFileSync('./invitee-emails2.txt', 'utf-8')
-  #   #betaTestersEmails = 'chris123123@jraphical.com'
-  #   (callback)->
-  #     JAccount.one {'profile.nickname': 'devrim'}, (err, devrim)=>
-  #       i = 0
-  #       recipients = []
-  #       uniq(betaTestersEmails.split '\n').forEach (email)->
-  #         code = crypto
-  #           .createHmac('sha1', 'kodingsecret')
-  #           .update(email)
-  #           .digest('hex')
-  #         # console.log email, code
-  #         recipients.push ->
-  #           invite = new JInvitation {
-  #             code
-  #             inviteeEmail  : email
-  #             maxUses       : 1
-  #             origin        : ObjectRef(devrim)
-  #             type          : 'launchrock'
-  #           }
-  #           invite.save (err)-> 
-  #             recipients.next(err)
-  #       recipients.push -> callback(recipients)
-  #       daisy recipients
+  @grantInvitesFromClient = bongo.secure (client, options,callback)->
+    account = client.connection.delegate    
+    # unless 'super-admin' in account.globalFlags 
+    unless account?.profile?.nickname is 'devrim'
+      return callback new KodingError "not authorized"
+    else
+      if options.batch?
+        callback "not implemented yet"
+      else
+        {username,quota} = options        
+        quota = 3 if quota is ''
+        @grant {'profile.nickname':username},quota,(err)->
+          if err
+            callback err
+          else
+            callback null, "#{quota} invites granted to #{username}"
+
   
   @grant =(selector, quota, callback)->
     unless quota > 0

        targetType  : JAccount
        as          : 'redeemer'
  
  # @__attemptToFixChrisFuckup =(callback)->
  #   i = 0
  #   JAccount.one {'profile.nickname': 'devrim'}, (err, devrim)=>
  #     if err
  #       callback err
  #     else
  #       @all { 'origin.constructorName': $exists: no }, (err, invites)->
  #         invites.forEach (invite)->
  #           if err
  #             callback err
  #           else
  #             invite.update {$set: origin: ObjectRef devrim}, {multi: yes}, callback
  #             # invite.addInvitedBy devrim, (err)->
  #             #   console.log err
  #             #   console.log 'finished', i++
  #             #   callback 'ok'
  # 
  # @__sendBetaInvites = bongo.secure do->
  #   betaTestersEmails = fs.readFileSync 'invitee-emails2.txt', 'utf-8'
  #   # betaTestersEmails = 'chris123412341234@jraphical.com'
  #   betaTestersHTML   = fs.readFileSync 'email/beta-testers-invite.txt', 'utf-8'
  #   protocol = 'https://'
  #   (client,callback)->
  #     i = 0
  #     recipients = []
  #     {host, port} = server
  #     account = client.connection.delegate
  #     unless 'super-admin' in account.globalFlags 
  #       return callback new KodingError "not authorized"

  #     # host = 'localhost:3000'
  #     # protocol = 'http://'
  #     uniq(betaTestersEmails.split '\n').slice(2983, 3999).forEach (email)=>
  #       recipients.push =>
  #         @one {inviteeEmail: email}, (err, invite)=>
  #           if err
  #             console.log err
  #           else if invite?
  #             url = "#{protocol}#{host}/invitation/#{invite.code}"
  #             # bitly.shorten url, (err, response)=>
  #             #   shortenedUrl = response.data.url
  #             #   if shortenedUrl?
  #                 # shortenedUrl = url
  #             personalizedMail = betaTestersHTML.replace '#{url}', url#shortenedUrl
              
  #             Emailer.send
  #               From      : @getInviteEmail()
  #               To        : email
  #               Subject   : '[Koding] Here is your beta invite!'
  #               TextBody  : personalizedMail
  #             , (err)-> 
  #               # console.log 'finished', i++, err
  #               recipients.next(err)
  #               # else console.log email
  #           else
  #             console.log "no invitation was found for #{email}"              
  #             recipients.next null
  #     recipients.push callback
  #     daisy recipients
  
  createBetaInvite = (options,callback)->
    {inviterUsername,inviteeEmail,inviteType} = options

      return callback new KodingError "not authorized"
    else
      if options.batch?
        JInvitationRequest.some {sent:$ne:true}, {limit:options.batch, sort:requestedAt:-1},(err,emails)->        
          daisy queue = emails.map (item)->
            ->
              continueLooping = ->
