wsgidav.lock_man.lock_manager.LockManager.check_write_permission#

LockManager.check_write_permission(*, url, depth, token_list, principal)[source]#

Check, if <principal> can modify <url>, otherwise raise HTTP_LOCKED.

If modifying <url> is prevented by a lock, DAVError(HTTP_LOCKED) is raised. An embedded DAVErrorCondition contains the conflicting locks.

<url> may be modified by <principal>, if it is not currently locked directly or indirectly (i.e. by a locked parent). For depth-infinity operations, <url> also must not have locked children.

It is not enough to check whether a lock is owned by <principal>, but also the token must be passed with the request. Because <principal> may run two different applications.

See http://www.webdav.org/specs/rfc4918.html#lock-model

http://www.webdav.org/specs/rfc4918.html#rfc.section.7.4

TODO: verify assumptions: - Parent locks WILL NOT be conflicting, if they are depth-0. - Exclusive child locks WILL be conflicting, even if they are owned by <principal>.

@param url: URL that shall be modified, created, moved, or deleted @param depth: “0”|”infinity” @param token_list: list of lock tokens, that the principal submitted in If: header @param principal: name of the principal requesting a lock

@return: None or raise error