revokeAll() public method

public revokeAll ( $userId )
Example #1
0
 public function revokeAll($userId)
 {
     if ($this->cache !== null) {
         $this->cache->delete($this->assignmentsCachePrefix . '_' . $userId);
     }
     parent::revokeAll($userId);
 }
Example #2
0
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if (!\Yii::$app instanceof ConsoleApplication) {
         if ($this->scenario == 'update' || $this->scenario == 'create') {
             $auth = new DbManager();
             $auth->init();
             $name = $this->role ? $this->role : self::ROLE_DEFAULT;
             $role = $auth->getRole($name);
             if (!$insert) {
                 $auth->revokeAll($this->id);
             }
             $auth->assign($role, $this->id);
         }
     }
 }
Example #3
0
 /**
  * @inheritdoc
  */
 public function revokeAll($userId)
 {
     if (empty($userId)) {
         return false;
     }
     $result = parent::revokeAll($userId);
     $this->_assignments[$userId] = [];
     return $result;
 }