From: hickert Date: Thu, 20 Jul 2006 07:49:28 +0000 (+0000) Subject: removed redundant status flags X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1ad51ae16551daa67b87ea00070c73c7a39a0ff0;p=gosa.git removed redundant status flags git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4250 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 471117145..33a7d1d9a 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -83,9 +83,6 @@ class user extends plugin var $last_pw_storage= "unset"; var $had_userCertificate= FALSE; - var $MyAccount_mode = false; - var $edit_mode = false; - /* attribute list for save action */ var $attributes= array("sn", "givenName", "uid", "personalTitle", "academicTitle", "homePostalAddress", "homePhone", "labeledURI", "o", "ou", "dateOfBirth", "gender","preferredLanguage", @@ -316,7 +313,7 @@ class user extends plugin } /* Remove picture? */ - if($this->acl_is_writeable("userPicture",($this->MyAccount_mode && !$this->edit_mode))) { + if($this->acl_is_writeable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit']))) ){ if (isset($_POST['picture_remove'])){ $this->jpegPhoto= "*removed*"; $this->set_picture ("./images/default.jpg"); @@ -397,7 +394,7 @@ class user extends plugin /* Remove certificate? */ - if($this->acl_is_writeable("Certificate",($this->MyAccount_mode && !$this->edit_mode))){ + if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ foreach (array ("userCertificate", "userSMIMECertificate", "userPKCS12") as $val){ if (isset($_POST["remove_$val"])){ @@ -409,7 +406,7 @@ class user extends plugin } /* Upload new cert and close dialog? */ - if($this->acl_is_writeable("Certificate",($this->MyAccount_mode && !$this->edit_mode))){ + if($this->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ if (isset($_POST['cert_edit_finish'])){ /* for all certificates do */ @@ -457,7 +454,7 @@ class user extends plugin /* Display cert dialog */ if ($this->cert_dialog){ - $smarty->assign("CertificateACL",$this->getacl("Certificate",($this->MyAccount_mode && !$this->edit_mode))); + $smarty->assign("CertificateACL",$this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))); $smarty->assign("Certificate_readable",$this->acl_is_readable("Certificate")); foreach(array("userCertificate", "userSMIMECertificate", "userPKCS12") as $cert){ @@ -494,19 +491,19 @@ class user extends plugin $ui =get_userinfo(); foreach($this->attributes as $val){ $smarty->assign("$val", $this->$val); - $smarty->assign("$val"."ACL", $this->getacl($val,($this->MyAccount_mode && !$this->edit_mode))); + $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit'])))); } $smarty->assign("pwmode", $hashes); $smarty->assign("pwmode_select", $this->pw_storage); - $smarty->assign("passwordStorageACL", $this->getacl("userPassword",($this->MyAccount_mode && !$this->edit_mode))); + $smarty->assign("passwordStorageACL", $this->getacl("userPassword",(!is_object($this->parent) && !isset($_SESSION['edit'])))); $smarty->assign("base_select", $this->base); - $smarty->assign("CertificatesACL", $this->getacl("Certificate",($this->MyAccount_mode && !$this->edit_mode))); - $smarty->assign("userPictureACL", $this->getacl("userPicture",($this->MyAccount_mode && !$this->edit_mode))); - $smarty->assign("userPicture_is_readable", $this->acl_is_readable("userPicture",($this->MyAccount_mode && !$this->edit_mode))); + $smarty->assign("CertificatesACL", $this->getacl("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))); + $smarty->assign("userPictureACL", $this->getacl("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit'])))); + $smarty->assign("userPicture_is_readable", $this->acl_is_readable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit'])))); /* Create base acls */ - $baseACL = $this->getacl("base",($this->MyAccount_mode && !$this->edit_mode)); + $baseACL = $this->getacl("base",(!is_object($this->parent) && !isset($_SESSION['edit']))); if(!$this->acl_is_moveable()) { $baseACL = preg_replace("/w/","",$baseACL); } @@ -526,14 +523,14 @@ class user extends plugin $smarty->assign("ivbbmodes", $ivbbmodes); foreach ($this->govattrs as $val){ $smarty->assign("$val", $this->$val); - $smarty->assign("$val"."ACL", $this->getacl($val,($this->MyAccount_mode && !$this->edit_mode))); + $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !isset($_SESSION['edit'])))); } } else { $smarty->assign("governmentmode", "false"); } /* Special mode for uid */ - $uidACL= $this->getacl("uid",($this->MyAccount_mode && !$this->edit_mode)); + $uidACL= $this->getacl("uid",(!is_object($this->parent) && !isset($_SESSION['edit']))); if (isset ($this->dn)){ if ($this->dn != "new"){ $uidACL= preg_replace("/w/","",$uidACL); @@ -601,7 +598,7 @@ class user extends plugin /* Save government mode attributes */ if ($this->config->current['GOVERNMENTMODE']){ foreach ($this->govattrs as $val){ - if ($this->acl_is_writeable($val,($this->MyAccount_mode && !$this->edit_mode)) && isset ($_POST["$val"])){ + if ($this->acl_is_writeable($val,(!is_object($this->parent) && !isset($_SESSION['edit']))) && isset($_POST["$val"])){ $data= stripcslashes($_POST["$val"]); if ($data != $this->$val){ $this->is_modified= TRUE; @@ -972,13 +969,13 @@ class user extends plugin if ($this->dn == "new" && !$this->acl_is_createable()){ $message[]= _("You have no permissions to create a user on this 'Base'."); } elseif ($this->dn != $new_dn && $this->dn != "new"){ - if (!$this->acl_is_writeable($this->dn, "user","create",($this->MyAccount_mode && !$this->edit_mode))){ + if (!$this->acl_is_writeable($this->dn, "user","create",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ $message[]= _("You have no permissions to move a user from the original 'Base'."); } } /* must: sn, givenName, uid */ - if ($this->sn == "" && ($this->acl_is_writeable("sn",($this->MyAccount_mode && !$this->edit_mode)) || ($this->new))){ + if ($this->sn == "" && ($this->acl_is_writeable("sn",(!is_object($this->parent) && !isset($_SESSION['edit'])) || ($this->new)))){ $message[]= _("The required field 'Name' is not set."); } @@ -993,10 +990,10 @@ class user extends plugin /* In template mode, the uid and givenName are autogenerated... */ if (!$this->is_template){ - if ($this->givenName == "" && $this->acl_is_writeable("givenName",($this->MyAccount_mode && !$this->edit_mode))){ + if ($this->givenName == "" && $this->acl_is_writeable("givenName",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ $message[]= _("The required field 'Given name' is not set."); } - if ($this->uid == "" && $this->acl_is_writeable("uid",($this->MyAccount_mode && !$this->edit_mode))){ + if ($this->uid == "" && $this->acl_is_writeable("uid",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ $message[]= _("The required field 'Login' is not set."); } if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){ @@ -1137,7 +1134,7 @@ class user extends plugin /* Load picture from file to object */ function set_picture($filename) { - if($this->acl_is_writeable("userPicture",($this->MyAccount_mode && !$this->edit_mode))) { + if($this->acl_is_writeable("userPicture",(!is_object($this->parent) && !isset($_SESSION['edit'])))){ if (!is_file($filename)){ $filename= "./images/default.jpg"; $this->jpegPhoto= "*removed*"; @@ -1157,7 +1154,7 @@ class user extends plugin /* Load certificate from file to object */ function set_cert($cert, $filename) { - if(!$thsi->acl_is_writeable("Certificate",($this->MyAccount_mode && !$this->edit_mode))) return; + if(!$thsi->acl_is_writeable("Certificate",(!is_object($this->parent) && !isset($_SESSION['edit'])))) return; $fd = fopen ($filename, "rb"); if (filesize($filename)>0) { $this->$cert= fread ($fd, filesize ($filename)); diff --git a/plugins/personal/generic/main.inc b/plugins/personal/generic/main.inc index ddb0a24e1..840bc7423 100644 --- a/plugins/personal/generic/main.inc +++ b/plugins/personal/generic/main.inc @@ -58,16 +58,6 @@ if (!$remove_lock){ $_SESSION['edit']= TRUE; } - /* MyAccount_mode tell class user that we are editing for my account section - edit_mode allows us to force the acls to be not writeable, when not in editing mode */ - $user->MyAccount_mode = true; - if (isset($_SESSION['edit'])){ - $user->edit_mode = true; - } else { - $user->edit_mode = false; - } - - /* Perform password change */ if (isset($_POST['password_finish'])){