Branch: Tag:

2004-05-03

2004-05-03 20:24:26 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added find_locks().

Rev: server/base_server/configuration.pike:1.565

5:   // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.564 2004/05/03 16:09:43 grubba Exp $"; + constant cvs_version = "$Id: configuration.pike,v 1.565 2004/05/03 20:24:26 grubba Exp $";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>
1330:    return res;   }    + //! Find all applicable locks for this user on @[path]. + multiset(DAVLock) find_locks(string path, int(0..1) recursive, +  int(0..1) exclude_shared, RequestID id) + { +  multiset(DAVLock) locks = (<>); +  +  foreach(location_module_cache||location_modules(), +  [string loc, function func]) +  { +  string subpath; +  if (has_prefix(path, loc)) { +  // path == loc + subpath. +  subpath = path[sizeof(loc)..]; +  } else if (recursive && has_prefix(loc, path)) { +  // loc == path + ignored. +  subpath = "/"; +  } else { +  // Does not apply to this location module. +  continue; +  } +  multiset(DAVLock) sub_locks = +  function_object(func)->find_locks(subpath, recursive, +  exclude_shared, id); +  if (sub_locks) locks |= sub_locks; +  } +  return locks; + } +    //! Check if there are any applicable locks for this user on @[path].   int(-2..1)|DAVLock check_locks(string path, int(0..1) recursive, RequestID id)   {