             callback null, []
 
 
-  setPermissionFor: (target, { user, owner, role }, callback) ->
+  setPermissionFor: (target, { user, owner, role, mode }, callback) ->
 
     Relationship.remove
       targetId : @getId()

  shareWith: (client, options, callback) ->

    { delegate } = client.connection
    { target, user, owner, role } = options
    user ?= yes

    # Owners cannot unassign them from a credential

        target.fetchOwnAccount (err, account) =>
          if err or not account
            return callback new KodingError 'Failed to fetch account.'
          @setPermissionFor account, { user, owner, mode }, callback

      else if target instanceof JGroup
        @setPermissionFor target, { user, owner, role, mode }, callback

      else
        callback new KodingError 'Target does not support credentials.'
