예제 #1
0
 /**
  * Retrieves a user from the current authorization context which should be
  * used for permission checks.
  */
 public static function currentUser()
 {
     if (Authorization::switched()) {
         return Authorization::realUser();
     }
     return Authorization::user();
 }
예제 #2
0
echo $r->escapeHtml($theUser->display_name);
?>
 <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="<?php 
echo $r->escapeAttr($pageURL('users/details/', array('user' => $theUser->id)));
?>
">My Profile</a></li>
                        <li><a href="<?php 
echo $r->escapeAttr($pageURL('settings/own/account'));
?>
">Account settings</a></li>
                        <li class="divider"></li>
                        <?php 
if ($ru = \tniessen\tinyIt\Security\Authorization::realUser()) {
    ?>
                            <li><a href="<?php 
    $url = $pageURL('switch-user', array('revert' => true, 'nonce' => $theNonce));
    echo $r->escapeAttr($url);
    ?>
">Switch back to <?php 
    echo $r->escapeHtml($ru->display_name);
    ?>
</a></li>
                        <?php 
}
?>
                        <li><a href="<?php 
$nonce = \tniessen\tinyIt\Security\Authorization::getNonce();
$url = $pageURL('logout', array('nonce' => $nonce));