X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Ffunctions.inc;h=ba46e840db640eba6469a22e0dd6418e9ac46c74;hb=844ab453f272569135b2cc9014b81e8567e8978c;hp=8f4a91aad595ccd8138f7dccbe987170d0010eaf;hpb=cce24205c07d0675d901df9c5e7e082f610d30de;p=gosa.git
diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc
index 8f4a91aad..ba46e840d 100644
--- a/gosa-core/include/functions.inc
+++ b/gosa-core/include/functions.inc
@@ -595,10 +595,28 @@ function ldap_expired_account($config, $userdn, $username)
}
-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}
";
+ return;
+ }
+ if(isset($cache['READ_ONLY'][$object])){
+ echo "Removed lock entry $object
";
+ unset($cache['READ_ONLY'][$object]);
+ }
+
+
if(is_array($object)){
foreach($object as $obj){
add_lock($obj,$user);
@@ -656,6 +674,21 @@ function del_lock ($object)
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
";
+ return;
+ }
+ }
+ }
+
/* Check for existance and remove the entry */
$ldap= $config->get_ldap_link();
$ldap->cd ($config->get_cfg_value("config"));