           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

    indexes         :
      code          : 'unique'
    sharedMethods   :
      static        : ['create','byCode','sendBetaInviteFromClient'] # ,'__createBetaInvites'
    schema          :
      code          : String
      inviteeEmail  : String

      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 = ->
