Take directory_* permissions into account when accessing a profile.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 30 Aug 2010 13:09:43 +0000 (15:09 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Mon, 30 Aug 2010 13:09:43 +0000 (15:09 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
modules/profile.php
templates/profile/profile.tpl

index e1004c9..d7cd55f 100644 (file)
@@ -253,9 +253,9 @@ class ProfileModule extends PLModule
         $page->changeTpl('profile/profile.tpl', SIMPLE);
 
         // Determines the access level at which the profile will be displayed.
-        if (!S::logged() || Env::v('view') == 'public') {
+        if (!S::logged() || !S::user()->checkPerms('directory_ax') || Env::v('view') == 'public') {
             $view = 'public';
-        } else if (S::logged() && Env::v('view') == 'ax') {
+        } else if (!S::user()->checkPerms('directory_private') || Env::v('view') == 'ax') {
             $view = 'ax';
         } else {
             $view = 'private';
index 53eecf4..ed73b0b 100644 (file)
@@ -87,7 +87,7 @@ function chgMainWinLoc(strPage)
   <div id="fiche_identite" class="part">
     <div class="civilite">
       {if $profile->isFemale()}&bull;{/if}
-        {if $logged}{$profile->private_name}{else}{$profile->public_name}{/if}
+        {if $view eq 'private'}{$profile->private_name}{else}{$profile->public_name}{/if}
 
       {if $logged}
         &nbsp;{if !$profile->isDead()}<a href="vcard/{$owner->login()}.vcf">{*