From: hickert Date: Mon, 17 Jul 2006 11:03:53 +0000 (+0000) Subject: Added changes made for testing new acl handling . X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ae588594f68bfcfb10e2c50d8bdcf43a6f7a4634;p=gosa.git Added changes made for testing new acl handling . git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4177 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/smarty/plugins/block.render.php b/include/smarty/plugins/block.render.php index 1aa87baf5..96381c9f0 100755 --- a/include/smarty/plugins/block.render.php +++ b/include/smarty/plugins/block.render.php @@ -3,33 +3,33 @@ function smarty_block_render($params, $text, &$smarty) { $text = stripslashes($text); + $acl = ""; if (isset($params['acl'])) { $acl = $params['acl']; unset($params['acl']); } + /* Read / Write*/ if(preg_match("/w/i",$acl)){ - - /* Read / Write*/ + return ($text); + } - }elseif(preg_match("/r/i",$acl)){ + $from = array("/name=/i"); + $to = array("disabled name="); + $text = preg_replace($from,$to,$text); - /* Read only */ - $from = array("/name=/i"); - $to = array("disabled name="); - $text = preg_replace($from,$to,$text); + /* Read only */ + if(preg_match("/r/i",$acl)){ + return($text); + } - }elseif(empty($acl)){ - - /* No rights */ - $text= " "; - + /* No acls */ + if(preg_match("/type['\"= ].*submit/",$text)){ + $text = preg_replace("/submit/","button",$text); }else{ - // unknown - $text =" "; + $text = preg_replace("/value=['\" ].*['\" ]/","",$text); } - return $text; } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 700a3aeea..bc2522c98 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -468,14 +468,6 @@ class user extends plugin return($smarty->fetch (get_template_path('generic_certs.tpl', TRUE, dirname(__FILE__)))); } - /* Show us the edit screen */ - @$smarty->assign("bases", $this->allowedBasesToMoveTo()); -# $smarty->assign("bases", $this->config->idepartments); - $smarty->assign("base_select", $this->base); - $smarty->assign("selectmode", chkacl($this->acl, "create")); - $smarty->assign("certificatesACL", chkacl($this->acl, "certificates")); - $smarty->assign("jpegPhotoACL", chkacl($this->acl, "jpegPhoto")); - /* Prepare password hashes */ if ($this->pw_storage == ""){ $this->pw_storage= $this->config->current['HASH']; @@ -484,16 +476,27 @@ class user extends plugin $temp = @passwordMethod::get_available_methods(); $hashes = $temp['name']; - $smarty->assign("pwmode", $hashes); - $smarty->assign("pwmode_select", $this->pw_storage); - $smarty->assign("passwordStorageACL", chkacl($this->acl, "passwordStorage")); - /* Load attributes and acl's */ + $ui =get_userinfo(); foreach($this->attributes as $val){ $smarty->assign("$val", $this->$val); - $smarty->assign("$val"."ACL", chkacl($this->acl,$val)); + $smarty->assign("$val"."ACL", $ui->get_permissions($this->dn, "user", $val)); } + $smarty->assign("pwmode", $hashes); + $smarty->assign("pwmode_select", $this->pw_storage); + $smarty->assign("passwordStorageACL", $ui->get_permissions($this->dn,"user", "userPassword")); + $smarty->assign("base_select", $this->base); + $smarty->assign("baseACL", $ui->get_permissions($this->dn,"user", "base")); + $smarty->assign("selectmode", $ui->get_permissions($this->dn,"user", "create")); + $smarty->assign("CertificatesACL", $ui->get_permissions($this->dn,"user", "Certificate")); + $smarty->assign("userPictureACL", $ui->get_permissions($this->dn,"user", "userPicture")); + + /* Show us the edit screen */ + @$smarty->assign("bases", $this->allowedBasesToMoveTo()); +# $smarty->assign("bases", $this->config->idepartments); + + /* Save government mode attributes */ if (isset($this->config->current['GOVERNMENTMODE']) && preg_match('/true/i', $this->config->current['GOVERNMENTMODE'])){ @@ -503,22 +506,14 @@ class user extends plugin $smarty->assign("ivbbmodes", $ivbbmodes); foreach ($this->govattrs as $val){ $smarty->assign("$val", $this->$val); - $smarty->assign("$val"."ACL", chkacl($this->acl,$val)); + $smarty->assign("$val"."ACL", $ui->get_permissions($this->dn,"user",$val)); } } else { $smarty->assign("governmentmode", "false"); } - /* Special mode for uid */ - $uidACL= ""; - if (isset ($this->dn)){ - if ($this->dn != "new"){ - $uidACL="readonly"; - } - } else { - $uidACL= "readonly"; - } - $uidACL.= " ".chkacl($this->acl, "uid"); + $uidACL= $ui->get_permissions($this->dn,"user", "uid"); + $uidACL= preg_replace("/w/","",$uidACL); $smarty->assign("uidACL", $uidACL); $smarty->assign("is_template", $this->is_template); @@ -579,7 +574,7 @@ class user extends plugin /* Save government mode attributes */ if ($this->config->current['GOVERNMENTMODE']){ foreach ($this->govattrs as $val){ - if (chkacl ($this->acl, "$val") == "" && isset ($_POST["$val"])){ + if (obj_is_writable($this->dn, "user",$val) && isset ($_POST["$val"])){ $data= stripcslashes($_POST["$val"]); if ($data != $this->$val){ $this->is_modified= TRUE; @@ -961,7 +956,7 @@ class user extends plugin } /* must: sn, givenName, uid */ - if ($this->sn == "" && chkacl ($this->acl, "sn") == ""){ + if ($this->sn == "" && obj_is_writable($this->dn, "user","sn")){ $message[]= _("The required field 'Name' is not set."); } @@ -976,10 +971,10 @@ class user extends plugin /* In template mode, the uid and givenName are autogenerated... */ if (!$this->is_template){ - if ($this->givenName == "" && chkacl ($this->acl, "givenName") == ""){ + if ($this->givenName == "" && obj_is_writable($this->dn, "user","givenName")){ $message[]= _("The required field 'Given name' is not set."); } - if ($this->uid == "" && chkacl ($this->acl, "uid") == ""){ + if ($this->uid == "" && obj_is_writable($this->dn, "user","uid")){ $message[]= _("The required field 'Login' is not set."); } if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){ @@ -1315,6 +1310,7 @@ class user extends plugin "objectClass" => "gosaAccount")), "plProvidedAcls" => array( + "base" => _("Base"), "userPassword" => _("User password"), "sn" => _("Surename"), "givenName" => _("Given name"), @@ -1334,16 +1330,15 @@ class user extends plugin "employeeType" => _("Employee type"), "l" => _("Location"), "st" => _("State"), - + "userPicture" => _("User picture"), "roomNumber" => _("Room number"), "telephoneNumber" => _("Telefon number"), "mobile" => _("Mobile number"), "pager" => _("Pager number"), - "userPKCS12" => _("User certificate PKCS12"), + "Certificate" => _("User certificates"), "postalAddress" => _("Postal address"), - "facsimileTelephoneNumber" => _("Fax number"), - "userSMIMECertificate" => _("User certificate SMIME")) + "facsimileTelephoneNumber" => _("Fax number")) ); /* Append government attributes if required */ diff --git a/plugins/personal/generic/generic.tpl b/plugins/personal/generic/generic.tpl index 83635680a..bac5756b1 100644 --- a/plugins/personal/generic/generic.tpl +++ b/plugins/personal/generic/generic.tpl @@ -16,12 +16,16 @@
- {t}Personal picture{/t} + {render acl=$userPictureACL} + {t}Personal picture{/t} + {/render}
- + {render acl=$userPictureACL} + + {/render}
@@ -31,7 +35,7 @@ {t}Personal picture{/t}
- + --> @@ -41,23 +45,23 @@ {if $is_template ne "true"} - + {render acl=$snACL}{/render} {else} - + {render acl=$snACL}{/render} {/if} {if $is_template ne "true"} - + {render acl=$givenNameACL}{/render} - + {render acl=$uidACL}{/render} {/if} @@ -68,13 +72,17 @@
- + {render acl=$personalTitleACL} + + {/render} - + {render acl=$academicTitleACL} + + {/render} @@ -84,21 +92,23 @@
- {if $use_dob eq 1} - - - - - - {else} - - {/if} + {render acl=$dateOfBirthACL} + {if $use_dob eq 1} + + + + + + {else} + + {/if} + {/render} @@ -106,9 +116,11 @@ - + {render acl=$genderACL} + + {/render} @@ -116,9 +128,11 @@ - + {render acl=$preferredLanguageACL} + + {/render} @@ -128,14 +142,16 @@
- - {if $selectmode == ""} + {render acl=$baseACL} + + {if $selectmode==""} {else} {/if} + {/render} @@ -149,15 +165,27 @@ - + - - + - + @@ -177,13 +207,20 @@ + {/if}
+ {render acl=$homePostalAddressACL} + + {/render} +
+ + {render acl=$homePhoneACL} + + {/render} +
+ {render acl=$labeledURIACL} + + {/render} +
@@ -167,9 +195,11 @@
- + {render acl=$passwordStorageACL} + + {/render}
- + {render acl=$CertificatesACL} + + {/render}
@@ -211,28 +248,42 @@ - + - +
+ {render acl=$oACL} + + {/render} +
+ {render acl=$ouACL} + + {/render} +
- + {render acl=$departmentNumberACL} + + {/render}
- + {render acl=$employeeNumberACL} + + {/render}
- + {render acl=$employeeTypeACL} + + {/render}
@@ -247,30 +298,44 @@ - + {if $has_phoneaccount ne "true"} {/if} - + -
+ {render acl=$roomNumberACL} + + {/render} +
- + {render acl=$telephoneNumberACL} + + {/render}
+ {render acl=$mobileACL} + + {/render} +
- + {render acl=$pagerACL} + + {/render}
+ + {render acl=$facsimileTelephoneNumberACL} + + {/render}
@@ -285,16 +350,26 @@ - + - +
+ {render acl=$lACL} + + {/render} +
+ {render acl=$stACL} + + {/render} +
- + {render acl=$postalAddressACL} + + {/render}
@@ -307,35 +382,45 @@ - +
+ {render acl=$vocationACL} + + {/render} +
- + {render acl=$gouvernmentOrganizationalUnitDescriptionACL} + + {/render}
- + {render acl=$gouvernmentOrganizationalUnitSubjectAreaACL} + + {/render}
- + {render acl=$functionalTitleACL} + + {/render}
- + {render acl=$roleACL} + + {/render}
@@ -347,35 +432,44 @@ - + {/render} - + + {render acl=$gouvernmentOrganizationalUnitACL} + + {/render} - + {render acl=$streetACL} + + {/render} - + {render acl=$postalCodeACL} + + {/render} - + {render acl=$houseIdentifierACL} + + {/render} @@ -386,39 +480,50 @@ - +
+ {render acl=$roomNumberACL} + + {/render} +
- {if $has_phoneaccount ne "true"} - - {else} - {t}Please use the phone tab{/t} - {/if} + {render acl=$telephoneNumberACL} + {if $has_phoneaccount ne "true"} + + {else} + {t}Please use the phone tab{/t} + {/if} + {/render}
- + {render acl=$facsimileTelephoneNumberACL} + + {/render}
- + {render acl=$ivbbLastDeliveryCollectiveACL} + + {/render}
- + {render acl=$publicVisibleACL} + + {/render}
@@ -437,4 +542,3 @@ populate(document.mainform,document.mainform.dateOfBirth); --> -