Code

removed redundant status flags
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Jul 2006 07:49:28 +0000 (07:49 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 20 Jul 2006 07:49:28 +0000 (07:49 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4250 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/generic/class_user.inc
plugins/personal/generic/main.inc

index 471117145c03cac19196f36dbcc1ad660dae88d6..33a7d1d9ac1764ecaa9dbd755cb5981099db97ec 100644 (file)
@@ -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));
index ddb0a24e1fcdeef882be5ace78698172ca6e6ac1..840bc74236ebeee2fce2880b2aa9a3ce8bca5f59 100644 (file)
@@ -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'])){