Esempio n. 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRole()
 {
     return $this->hasOne(UserRole::className(), ['id_user_role' => 'id_user_role']);
 }
Esempio n. 2
0
 public static function SetAuthAssignment($id_user_role, $user_id)
 {
     $roleModel = UserRole::findOne($id_user_role);
     $AuthAssignment = new AuthAssignment();
     $AuthAssignment->item_name = strtolower($roleModel->name);
     $AuthAssignment->user_id = $user_id;
     if ($AuthAssignment->save(false)) {
         return true;
     } else {
         return false;
     }
 }