 
     { delegate } = client.connection
 
-    unless delegate.getId().equals this.owner
+    unless delegate.getId().equals this.originId
       return callback new KodingError 'Access denied'
 
     @remove callback

      return callback null, workspace

  @fetch = secure (client, query = {}, callback) ->
    query.owner = client.connection.delegate._id
    JWorkspace.some query, {}, callback


  @deleteById = secure (client, id, callback)->

    selector =
      owner  : client.connection.delegate._id
      _id    : ObjectId id

    JWorkspace.one selector, (err, ws)->
      return callback err  if err?

  @deleteByUid = secure (client, uid, callback)->

    selector     =
      originId   : client.connection.delegate._id
      machineUId : uid

    JWorkspace.remove selector, (err)->
