Branch: Tag:

2018-03-27

2018-03-27 15:14:11 by Henrik Grubbström (Grubba) <grubba@grubba.org>

WebDAV: Changed API for find_locks().

Instead of returning a multiset(DAVLock) it now returns
a mapping(string:DAVLock), where the mapping is indexed
on locktoken.

839:   //! current user were to make a shared lock.)   //!   //! @returns - //! Returns a multiset containing all applicable locks in + //! Returns a mapping containing all applicable locks in   //! this location module, or @expr{0@} (zero) if there are none.   //!   //! @note
850:   //! @note   //! The default implementation only handles the @expr{"DAV:write"@}   //! lock type. - multiset(DAVLock) find_locks(string path, + mapping(string:DAVLock) find_locks(string path,    int(-1..1) recursive,    int(0..1) exclude_shared,    RequestID id)
863:       string rsc = resource_id (path, id);    -  multiset(DAVLock) locks = (<>); +  mapping(string:DAVLock) locks = ([]);    function(mapping(mixed:DAVLock):void) add_locks;       if (exclude_shared) {
872:    foreach (sub_locks; string user; DAVLock lock)    if (user == auth_user ||    lock->lockscope == "DAV:exclusive") -  locks[lock] = 1; +  locks[lock->locktoken] = lock;    };    }    else    add_locks = lambda (mapping(mixed:DAVLock) sub_locks) { -  locks |= mkmultiset (values (sub_locks)); +  locks |= mkmapping(values(sub_locks)->locktoken, +  values(sub_locks));    };       if (file_locks[rsc]) {