summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fbff61a)
raw | patch | inline | side by side (parent: fbff61a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 27 Oct 2006 05:48:26 +0000 (05:48 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 27 Oct 2006 05:48:26 +0000 (05:48 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4948 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/addons/addressbook/address_edit.tpl b/plugins/addons/addressbook/address_edit.tpl
index dae7341460673c49b4df96cda5866768177b4747..9a79f3b723cfb16d3f4a5503e3a93db90c66a574 100644 (file)
{t}First name{/t}{$must}
</LABEL>
</td>
- <td>
+ <td>
+{render acl=$snACL}
<input id="sn" name="sn" size=10 maxlength=60 value="{$info_sn}" {$snACL}>,
+{/render}
+{render acl=$givenNameACL}
<input id="givenName" name="givenName" size=10 maxlength=60 value="{$info_givenName}" {$givenNameACL}>
+{/render}
<td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$initialsACL}
<input id="initials" name="initials" size=5 maxlength=20 value="{$info_initials}" {$initialsACL}>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$titleACL}
<input id="title" name="title" size=10 maxlength=20 value="{$info_title}" {$titleACL}>
+{/render}
</td>
</tr>
</table>
<br>
</td>
<td style="vertical-align:top;">
+{render acl=$homePostalAddressACL}
<textarea id="homePostalAddress" name="homePostalAddress"
rows=1 cols=20 {$homePostalAddressACL}>{$info_homePostalAddress}</textarea>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$homePhoneACL}
<input id="homePhone" name="homePhone" size=15 maxlength=60 value="{$info_homePhone}" {$homePhoneACL}>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$mobileACL}
<input id="mobile" name="mobile" size=15 maxlength=60 value="{$info_mobile}" {$mobileACL}>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$mailACL}
<input id="mail" name="mail" size=15 maxlength=60 value="{$info_mail}" {$mailACL}>
+{/render}
</td>
</tr>
</table>
</LABEL>
</td>
<td>
+{render acl=$oACL}
<input id="o" name="o" size=15 maxlength=60 value="{$info_o}" {$oACL}>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$ouACL}
<input id="ou" name="ou" size=15 maxlength=60 value="{$info_ou}" {$ouACL}>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$lACL}
<input id="l" name="l" size=15 maxlength=60 value="{$info_l}" {$lACL}>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$postalCodeACL}
<input id="postalCode" name="postalCode" size=15 maxlength=60 value="{$info_postalCode}" {$postalCodeACL}>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$stACL}
<input id="st" name="st" size=15 maxlength=60 value="{$info_st}" {$stACL}>
+{/render}
</td>
</tr>
</table>
<br>
</td>
<td style="vertical-align:top;">
+{render acl=$postalAddressACL}
<textarea id="postalAddress" name="postalAddress" rows=1 cols=20
{$postalAddressACL}>{$info_postalAddress}</textarea>
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$telephoneNumberACL}
<input id="telephoneNumber" name="telephoneNumber" {$telephoneNumberACL}
size=15 maxlength=60 value="{$info_telephoneNumber}">
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$facsimileTelephoneNumberACL}
<input id="facsimileTelephoneNumber" name="facsimileTelephoneNumber" {$facsimileTelephoneNumberACL}
size=15 maxlength=60 value="{$info_facsimileTelephoneNumber}">
+{/render}
</td>
</tr>
<tr>
</LABEL>
</td>
<td>
+{render acl=$pagerACL}
<input id="pager" name="pager" size=15 maxlength=60 value="{$info_pager}" {$pagerACL}>
+{/render}
</td>
</tr>
</table>
</tr>
</table>
+<!--
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+-->
diff --git a/plugins/addons/addressbook/class_addressbook.inc b/plugins/addons/addressbook/class_addressbook.inc
index bbb57ac20104a970763a310fd1091e2aa5b26195..baa8f01e69c1794d1b436805f37c295398a86b93 100644 (file)
}
register_global("phonefilter", $phonefilter);
+ /* Assign create acl */
+ $acl = $this->get_entry_acls($this->abobjectclass.",".$phonefilter['search_base']);
+ $smarty->assign("internal_createable", preg_match("/c/",$acl));
+ $smarty->assign("internal_removeable", preg_match("/d/",$acl));
/* Perform actions with CTI hook */
if (isset($_GET['target'])
/* Some nice guy may send this as POST, so we've to check
for the permissions again. */
- if (chkacl($this->acl, "delete") == ""){
+
+ $acl = $this->get_entry_acls($this->dn);
+ if(preg_match("/d/",$acl)){
/* Delete request is permitted, perform LDAP action */
$ldap= $this->config->get_ldap_link();
case "remove":
$this->dn= $_SESSION['show_info'];
$this->load();
+
/* Load permissions for selected 'dn' and check if
we're allowed to remove this 'dn' */
- if (chkacl($this->acl, "delete") == ""){
+ $acl = $this->get_entry_acls($this->dn);
+ if(preg_match("/d/",$acl)){
/* Check locking, save current plugin in 'back_plugin', so
the dialog knows where to return. */
}
/* Check if at least one attribute is specified */
- $skip = true;
+ $skip = false;
+
foreach($must_have_this as $attr) {
if(isset($attrs[$attr][0]) && !empty($attrs[$attr][0])){
$skip =false;
/* Skip all attributes that we are not allowed to read */
$any = false;
foreach($attributes as $attr){
- if(!preg_match("/r/",$this->ui->get_permissions($attrs['dn'],"users/user",$attr))){
+
+ $acls = $this->get_entry_acls($attrs['dn'],$attr);
+ if(!preg_match("/r/",$acls)){
$attrs[$attr][0] = "Not allowed";
}else{
$any = true;
}
}
-
+
/* Only show lines that have set any mail or phone informations */
if(!$skip && $any){
$output= "";
$mod= 0;
-#! hickert
- if(!isset($_SESSION['show_info'])) $smarty->assign("show_info", "");;
+ /* View detailed infos */
+ $smarty->assign("show_info", "");
if (isset($_SESSION['show_info'])){
+
$range= 4;
$smarty->assign("show_info", "1");
$smarty->assign("url", "main.php?plug=".validate($_GET['plug'])."&close=1");
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name));
+ }
+
switch ($_SESSION['show_info']){
case "ADD":
$smarty->assign ('storage_base', $this->storage_base);
- $smarty->assign ('address_info',
- get_template_path('address_edit.tpl', TRUE));
+ $smarty->assign ('address_info', get_template_path('address_edit.tpl', TRUE));
break;
default:
- $smarty->assign ('address_info',
- get_template_path('address_info.tpl', TRUE));
+ $smarty->assign ('address_info', get_template_path('address_info.tpl', TRUE));
break;
}
$this->new_dn= $this->dn;
}
- if ($_SESSION['show_info'] == "ADD" && chkacl($this->acl, "add") != ""){
- $message[]= _("You have no permissions to create or modify a global address book entry.");
- }
-
return ($message);
}
}
}
+
+ /* Return entry acls */
+ function get_entry_acls($dn,$attr = "")
+ {
+ $acls = "";
+
+ /* Use addressbook acls */
+ if(preg_match("/".normalizePreg($this->abobjectclass)."/",$dn)) {
+ $dn = preg_replace("/".normalizePreg($this->abobjectclass).",/","",$dn);
+ $acls = $this->ui->get_permissions($dn,"addressbook/addressbook",$attr);
+ }
+
+ /* Use Organizational Person acls */
+ else{
+ $acls = $this->ui->get_permissions($dn,"users/user",$attr);
+ }
+
+ return($acls);
+ }
+
+
+ /* Return plugin informations for acl handling */
+ function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Addressbook"),
+ "plDescription" => _("Addressbook entry acls"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 0,
+ "plSection" => array("addons" => _("Addons")),
+ "plCategory" => array("addressbook" => array("objectClass" => "inetOrgPerson", "description" => _("Addressbook"))),
+
+ "plProvidedAcls" => array(
+ "sn" => _("Surename"),
+ "givenName" => _("Given name"),
+ "telephoneNumber" => _("Telefon number"),
+ "facsimileTelephoneNumber" => _("Fax number"),
+ "mobile" => _("Mobile number"),
+ "homePhone" => _("Home phone number"),
+ "uid" => _("User identification"),
+ "mail" => _("Mail address"),
+ "pager" => _("Pgaer"),
+ "o" => _("Organization"),
+ "ou" => _("Department"),
+ "l" => _("Location"),
+ "postalAddress" => _("Postal address"),
+ "postalCode" => _("Postal address"),
+ "st" => _("State"),
+ "initials" => _("Initials"),
+ "title" => _("Title"),
+ "homePostalAddress" => _("Home postal address"),
+ "cn" => _("Common name"))
+ ));
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
index 3e61376feb52327507e9c4a94b1fe88f8292d7c2..80472c950f22174ba89aa1eaa4b2bdefb2275694 100644 (file)
</div>
<div class="contentboxb">
<p class="contentboxb" style="vertical-align:middle;">
+ {if $internal_createable}
<img class="center" alt="" src="{$add_image}">
<a href="main.php{$plug}&global=add" style="text-align:center;vertical-align:middle;">{t}Add entry{/t}</a><br>
+ {/if}
{if $internal eq 0}
<img alt="" src="{$edit_image}" class="center">
<a href="main.php{$plug}&global=edit">{t}Edit entry{/t}</a><br>
- <img alt="" src="{$delete_image}" class="center">
- <a href="main.php{$plug}&global=remove" style="vertical-align:middle;">{t}Remove entry{/t}</a><br>
+ {if $internal_removeable}
+ <img alt="" src="{$delete_image}" class="center">
+ <a href="main.php{$plug}&global=remove" style="vertical-align:middle;">{t}Remove entry{/t}</a><br>
+ {/if}
{/if}
</p>
</div>