                   @reserveNames options, callback
 
 
-  @fetchBlockedUsers = secure ({connection:{delegate}}, options, callback) ->
+  @fetchBlockedUsers = secure ({ connection:{ delegate } }, options, callback) ->
     unless delegate.can 'list-blocked-users'
       return callback new KodingError 'Access denied!'
 

      # targetType from string to object.
      JStackTemplate   = require './computeproviders/stacktemplate'

      appStorage    :
        as          : 'appStorage'
        targetType  : "JAppStorage"

      storage       :
        as          : 'storage'
        targetType  : 'JStorage'

      tag:
        as          : 'skill'
        targetType  : "JTag"

      domain        :
        as          : 'owner'
        targetType  : 'JProposedDomain'

      proxyFilter   :
        as          : 'owner'
        targetType  : 'JProxyFilter'

      referrer      :
        targetType  : 'JReferral'
        as          : 'referrer'
      referred      :
        targetType  : 'JReferral'
        as          : 'referred'
      invitation    :
        as          : 'owner'
        targetType  : 'JInvitation'

      paymentMethod :
        as          : 'payment method'
        targetType  : 'JPaymentMethod'

      subscription  :
        as          : 'service subscription'
        targetType  : 'JPaymentSubscription'

      kite          :
        as          : 'owner'
        targetType  : JKite

      credential    :
        as          : ['owner', 'user']
        targetType  : 'JCredential'

      stackTemplate :
        as          : 'user'
        targetType  : JStackTemplate


  constructor:->
    super
    @notifyOriginWhen 'PrivateMessageSent', 'FollowHappened'
    @notifyGroupWhen 'FollowHappened'

  @sendUpdateInstanceEvent = (obj, op) =>
    JAccount.bongos.forEach (bongo) =>
      bongo.handleEvent "instance", obj, "updateInstance", [op]

  canEditPost: permit 'edit posts'

  canDeletePost: permit 'delete posts'

  createSocialApiId:(callback)->
    if @type is 'unregistered'
      return callback null, -1

    return callback null, @socialApiId  if @socialApiId
    {createAccount} = require './socialapi/requests'
    createAccount {id: @getId(), nickname: @profile.nickname}, (err, account)=>
      return callback new ApiError err  if err
      return callback {message: "Account is not set, malformed response from social api"} unless account?.id
      @update $set: socialApiId: account.id, isExempt: account.isTroll, (err)->
        # check for error
        if err
          console.error "Error while creating account on social api", err
          return callback { message: "Couldnt create/register Account"}
        # check account
        # return account id from social api
        return callback null, account.id

  checkGroupMembership: secure (client, groupName, callback)->
    {delegate} = client.connection
    JGroup = require "./group"
    JGroup.one {slug : groupName}, (err, group)->
      return callback new KodingError "An error occurred!" if err
      return callback null, no unless group

      Relationship.one {
        as          : 'member'
        targetId    : delegate.getId()
        sourceId    : group.getId()
      }, (err, relation)=>
        return callback new KodingError "An error occurred!" if err
        return callback null, relation?

  changeUsername: (options, callback = (->)) ->

    deciding ourselves which parts of the search are for first or last name.
    MongoDB 2.4 and bongo implementation of aggregate required to use $concat
    ###
    names = seed.toString().split('/')[1].replace(/[\\^]/g, '').split ' '
    names.push names.first if names.length is 1
    @some {
      $or : [
