index 964af5d13ece60f8964672e30f78a41d6bd19325..ba46e840db640eba6469a22e0dd6418e9ac46c74 100644 (file)
}
-function add_lock ($object, $user)
+function add_lock($object, $user)
{
global $config;
+ /* Remember which entries were opened as read only, because we
+ don't need to remove any locks for them later.
+ */
+ if(!session::is_set("LOCK_CACHE")){
+ session::set("LOCK_CACHE",array(""));
+ }
+ $cache = &session::get("LOCK_CACHE");
+ if(isset($_POST['open_readonly'])){
+ $cache['READ_ONLY'][$object] = TRUE;
+ echo "ADDED : {$user}:{$object}<br>";
+ return;
+ }
+ if(isset($cache['READ_ONLY'][$object])){
+ echo "Removed lock entry $object <br>";
+ unset($cache['READ_ONLY'][$object]);
+ }
+
+
if(is_array($object)){
foreach($object as $obj){
add_lock($obj,$user);
return;
}
+ /* If this object was opened in read only mode then
+ skip removing the lock entry, there wasn't any lock created.
+ */
+ if(session::is_set("LOCK_CACHE")){
+ $cache = &session::get("LOCK_CACHE");
+ if(isset($cache['READ_ONLY'][$object])){
+ if(isset($_POST['delete_lock'])){
+ unset($cache['READ_ONLY'][$object]);
+ }else{
+ echo "Skipped: $object <br>";
+ return;
+ }
+ }
+ }
+
/* Check for existance and remove the entry */
$ldap= $config->get_ldap_link();
$ldap->cd ($config->get_cfg_value("config"));
return("");
}
+ /* Allow readonly access, the plugin::plugin will restrict the acls */
+ if(isset($_POST['open_readonly'])) return("");
+
/* Get LDAP link, check for presence of the lock entry */
$user= "";
$ldap= $config->get_ldap_link();
return (TRUE);
}
- return (count(array_diff($src, $dst)) == 0);
+ return (count(array_diff($src, $dst)) != 0);
}