         target.fetchOwnAccount (err, account) =>
           if err or not account
             return callback new KodingError 'Failed to fetch account.'
-          @setPermissionFor account, { user, owner, mode }, callback
+          @setPermissionFor account, { user, owner }, callback
 
       else if target instanceof JGroup
-        @setPermissionFor target, { user, owner, role, mode }, callback
+        @setPermissionFor target, { user, owner, accessLevel }, callback
 
       else
         callback new KodingError 'Target does not support credentials.'


      if user
        options = { as: if owner then 'owner' else 'user' }

        if role or mode
          options.data = {}
          options.data.role = role  if role
          options.data.mode = mode  if mode

        target.addCredential this, options, (err) -> callback err
      else
        callback err


            callback null, []


  setPermissionFor: (target, { user, owner, accessLevel }, callback) ->

    Relationship.remove
      targetId : @getId()
