From de351bb1f5974ae1a5e2dc330c45c02695f423b5 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 27 Oct 2006 09:29:07 +0000 Subject: [PATCH] Some template && acl fixes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4950 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/addons/addressbook/address_info.tpl | 268 ++++++++++++------ .../addons/addressbook/class_addressbook.inc | 41 ++- 2 files changed, 212 insertions(+), 97 deletions(-) diff --git a/plugins/addons/addressbook/address_info.tpl b/plugins/addons/addressbook/address_info.tpl index d6cf405d5..3bb3a2242 100644 --- a/plugins/addons/addressbook/address_info.tpl +++ b/plugins/addons/addressbook/address_info.tpl @@ -1,104 +1,196 @@ - - - - - - + + + -
{$storage_info}X
+
{$storage_info} + + X +
- - + - + +
-

{t}Personal{/t}

+
+ + + + + + + + - + + - - -
+

+ + {t}Personal{/t} +

- - - - - - - - - - -
{t}Name{/t}{$info_sn}, {$info_givenName}
{t}Initials{/t}{$info_initials}
{t}Personal title{/t}{$info_title}
+ + + + + + + + + + + + + +
+ {t}Name{/t} + + {$info_sn}, {$info_givenName} +
+ {t}Initials{/t} + + {$info_initials} +
+ {t}Personal title{/t} + + {$info_title} +
-
- -

{t}Private{/t}

+

+ + {t}Private{/t} +

- - - - - - - - - - - - - - -
{t}Address{/t}

{$info_homePostalAddress}
{t}Phone{/t}{$info_homePhone}
{t}Mobile{/t}{$info_mobile}
{t}Email{/t}{$info_mail}
+ + + + + + + + + + + + + + + + + +
+ {t}Address{/t} + + {$info_homePostalAddress} +
+ {t}Phone{/t} + + {$info_homePhone} +
+ {t}Mobile{/t} + + {$info_mobile} +
+ {t}Email{/t} + + {$info_mail} +
-
-
-

{t}Organizational{/t}

+

+ + {t}Organizational{/t} +

- - - - -
+ + + - -
- - - - - - - - - - - - - - - - -
{t}Company{/t}{$info_o}
{t}Department{/t}{$info_ou}
{t}City{/t}{$info_l}
{t}Postal code{/t}{$info_postalCode}
{t}Country{/t}{$info_st}
-
+ + + + + + + + + + + + + + + + + + + + + +
+ {t}Company{/t} + + {$info_o} +
+ {t}Department{/t} + + {$info_ou} +
+ {t}City{/t} + + {$info_l} +
+ {t}Postal code{/t} + + {$info_postalCode} +
+ {t}Country{/t} + + {$info_st} +
- - - - - - - - - - - - + + + +
{t}Address{/t}

{$info_postalAddress}
{t}Phone{/t}{$info_telephoneNumber}
{t}FAX{/t}{$info_facsimileTelephoneNumber}
{t}Pager{/t}{$info_pager} + + + + + + + + + + + + + + + + + + +
+ {t}Address{/t} + + {$info_postalAddress} +
+ {t}Phone{/t} + + {$info_telephoneNumber} +
+ {t}FAX{/t} + + {$info_facsimileTelephoneNumber} +
+ {t}Pager{/t} + + {$info_pager} +
+
+ +
-
-
- -
diff --git a/plugins/addons/addressbook/class_addressbook.inc b/plugins/addons/addressbook/class_addressbook.inc index d3c2b9f3a..1f1dff6be 100644 --- a/plugins/addons/addressbook/class_addressbook.inc +++ b/plugins/addons/addressbook/class_addressbook.inc @@ -410,7 +410,7 @@ class addressbook extends plugin $acls = $this->get_entry_acls($attrs['dn'],$attr); if(!preg_match("/r/",$acls)){ - $attrs[$attr][0] = "Not allowed"; + $attrs[$attr][0] = ""; }else{ $any = true; } @@ -444,12 +444,15 @@ class addressbook extends plugin \"vcf\" "; - if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){ - $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]); - $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= - "". - "\"vcf\""; + if(preg_match("/r/",$this->get_entry_acls($attrs['dn'],"mail"))){ + if (isset($attrs['mail'][0]) && !empty($attrs['mail'][0])){ + $dest= sprintf(_("Send mail to %s"), $attrs['mail'][0]); + $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= + + "". + "\"vcf\""; + } } $this->telephone_list[$attrs['sn'][0].$attrs['dn']].= ""; } @@ -494,19 +497,33 @@ class addressbook extends plugin $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": + + $a_bases = $this->get_allowed_bases(); + + if(!in_array_ics($this->storage_base,$a_bases)){ + $base = key($this->get_allowed_bases()); + $this->storage_base = $base; + } + $smarty->assign ('storage_base', $this->storage_base); $smarty->assign ('address_info', get_template_path('address_edit.tpl', TRUE)); + + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $smarty->assign($name."ACL",$this->get_entry_acls($this->abobjectclass.",".$base,$name)); + } break; default: $smarty->assign ('address_info', get_template_path('address_info.tpl', TRUE)); + foreach($tmp['plProvidedAcls'] as $name => $translated){ + $smarty->assign($name."ACL",$this->get_entry_acls($this->dn,$name)); + } break; } @@ -516,6 +533,12 @@ class addressbook extends plugin $info= $ldap->fetch(); } foreach ($this->attributes as $name){ + + /* Skip entries we are not allowed to read */ + if(!preg_match("/r/",$this->get_entry_acls($_SESSION['show_info'],$name))){ + $smarty->assign("info_$name", ""); + }else + if ($_SESSION['show_info'] != "ADD" && isset($info["$name"][0])){ error_reporting(0); /* Special treatment for phone attributes */ -- 2.30.2