public function revokeAll($userId) { if ($this->cache !== null) { $this->cache->delete($this->assignmentsCachePrefix . '_' . $userId); } parent::revokeAll($userId); }
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); } } }
/** * @inheritdoc */ public function revokeAll($userId) { if (empty($userId)) { return false; } $result = parent::revokeAll($userId); $this->_assignments[$userId] = []; return $result; }