예제 #1
0
 public static function redirect_user_if_not_admin($url = null)
 {
     $auth = new AppAuthService();
     if (!$auth->user) {
         return $auth->redirect_to_login();
     } elseif (!$auth->user_is_admin()) {
         return $auth->forbid_access();
     } else {
         return $auth;
     }
 }
예제 #2
0
$auth = new AppAuthService();
?>
    <?php 
if (NeechyConfig::stage() == 'dev') {
    ?>
      <div class="dev-footer">
        <h4>App Engine Dev Server</h4>
        <p>Using <?php 
    echo NeechyConfig::environment();
    ?>
 config settings.</p>
        <?php 
    if ($auth->user) {
        ?>
        <p>Logged in as <?php 
        echo $auth->user_is_admin() ? 'admin' : 'user';
        ?>
.</p>
        <?php 
    } else {
        ?>
        <p>Not logged in.</p>
        <?php 
    }
    ?>
      </div>
    <?php 
} else {
    ?>
      <div class="dev-footer">
        Please note: Database data will be reset periodically.