Esempio n. 1
0
 /**
  * view method
  *
  * @return void
  */
 public function view()
 {
     if (!$this->__prepare()) {
         return;
     }
     //レイアウトの設定
     if ($this->request->is('ajax')) {
         $this->viewClass = 'View';
         $this->layout = 'NetCommons.modal';
     } elseif (Current::isControlPanel()) {
         $this->ControlPanelLayout = $this->Components->load('ControlPanel.ControlPanelLayout');
     } else {
         $this->PageLayout = $this->Components->load('Pages.PageLayout');
     }
     if (!Hash::get($this->request->query, 'tab')) {
         $this->request->query = Hash::insert($this->request->query, 'tab', 'user-infomation');
     }
     //自分自身の場合、ルーム・グループデータ取得する
     if (Hash::get($this->viewVars['user'], 'User.id') === Current::read('User.id')) {
         //ルームデータ取得
         $this->Rooms->setReadableRooms(Hash::get($this->viewVars['user'], 'User.id'));
         // グループデータ取得・設定
         $this->Groups->setGroupList($this);
     } else {
         if (Current::allowSystemPlugin('rooms')) {
             //ルームデータ取得
             $this->Rooms->setReadableRooms(Hash::get($this->viewVars['user'], 'User.id'));
         }
     }
 }
Esempio n. 2
0
 /**
  * invalidatesのセット
  *
  * @param Model $model ビヘイビア呼び出し元モデル
  * @param array $userAttribute UserAttributeデータ
  * @param array $userAttributesRoles UserAttributesRoleデータ
  * @return void
  * @throws BadRequestException
  */
 private function __setInvalidates(Model $model, $userAttribute, $userAttributesRoles)
 {
     $userAttributeKey = $userAttribute['UserAttribute']['key'];
     if ($model->UsersLanguage->hasField($userAttributeKey)) {
         $modelName = $model->UsersLanguage->alias;
     } else {
         $modelName = $model->alias;
     }
     $userAttributesRole = Hash::extract($userAttributesRoles, '{n}.UserAttributesRole[user_attribute_key=' . $userAttributeKey . ']');
     $userAttributesRole = $userAttributesRole[0];
     //他人でother_editable=falseの場合、自分でself_editable=falseは、不正エラー
     $userId = Hash::get($model->data[$model->alias], 'id');
     if ($userId !== Current::read('User.id') && !$userAttributesRole['other_editable'] || $userId === Current::read('User.id') && !$userAttributesRole['self_editable']) {
         throw new BadRequestException(__d('net_commons', 'Bad Request'));
     }
     //管理者しか許可しない項目のチェック⇒不正エラーとする
     if ($userAttribute['UserAttributeSetting']['only_administrator_editable'] && !Current::allowSystemPlugin('user_manager') && isset($model->data[$modelName][$userAttributeKey])) {
         throw new BadRequestException(__d('net_commons', 'Bad Request'));
     }
 }