Permalink
Browse files

Locking: proof-of-concept of the resource unlock API

  • Loading branch information...
1 parent 5284d1f commit b5f240eabfd71fb548465d87244f15d855942963 @vjt vjt committed Jun 15, 2011
Showing with 5 additions and 2 deletions.
  1. +2 −0 README.md
  2. +3 −2 lib/rack_dav/controller.rb
View
@@ -88,6 +88,8 @@ to retrieve and change the resources:
* __lock(token, timeout, scope, type, owner)__: Lock this resource.
If scope, type and owner are nil, refresh the given lock.
+* __unlock(token)__: Unlock this resource
+
Note, that it is generally possible, that a resource object is
instantiated for a not yet existing resource.
@@ -202,9 +202,10 @@ def lock
def unlock
raise MethodNotAllowed unless resource.respond_to?(:unlock)
- raise NoContent
- end
+ locktoken = request_locktoken('LOCK_TOKEN')
+ response.status = resource.unlock(locktoken) ? NoContent : Forbidden
+ end
private

0 comments on commit b5f240e

Please sign in to comment.