OSDN Git Service

認証済ユーザ情報取得方法の変更
authorCake <cake_67@users.sourceforge.jp>
Sun, 10 Jan 2010 05:23:13 +0000 (14:23 +0900)
committerCake <cake_67@users.sourceforge.jp>
Sun, 10 Jan 2010 05:23:13 +0000 (14:23 +0900)
Authから取得

app/controllers/app_controller.php
app/controllers/users_controller.php

index 270cf66..f1f9507 100644 (file)
@@ -67,7 +67,7 @@ class AppController extends Controller
                        $this->AuthPlus->actionPath = 'controllers/';
                        $this->AuthPlus->authorize = 'crud';
                        // 認証済みユーザ情報のセット
-                       $this->user = $this->getUser($this->AuthPlus->user('id'));
+                       $this->user = $this->AuthPlus->user();
                        if (in_array($this->AuthPlus->user('group_id'), array(1,2,3))) {
                                $this->isAdministrator = true;
                        }
@@ -101,6 +101,7 @@ class AppController extends Controller
                parent::beforeRender();
        }
 
+       /* 共通関数 */
        /* 
         * 不正な$this->dataセットを削除
         */
@@ -117,7 +118,6 @@ class AppController extends Controller
                }
 
        }
-
 }
 
 // AppControllerを携帯とPCで振り分け
@@ -203,20 +203,6 @@ class PcAppController extends AppController
                parent::beforeRender();
 
        }
-
-       /* 共通関数 */
-       function getUser($id) {
-               if (!$id) {
-                       return $this->user;
-               }
-               $user = $this->User->read(null, $id);
-               if (!$user['User']) {
-                       $this->Session->setFlash(__('Invalid User.', true));
-                       return $this->user;
-               }
-               return $user;
-       }
-
 }
 
 
index 442e4cd..487a5f9 100644 (file)
@@ -412,5 +412,18 @@ class UsersController extends ModuleController {
                }
        }
 
+       /* ユーザ情報取得 */
+       function getUser($id) {
+               if (!$id) {
+                       return $this->user;
+               }
+               $user = $this->User->read(null, $id);
+               if (!$user['User']) {
+                       $this->Session->setFlash(__('Invalid User.', true));
+                       return $this->user;
+               }
+               return $user;
+       }
+
 }