/** * If a user is removed from a role, raise two events signaling a potential change in * Rights/Policies for this user. * @see Item::beforeSave() */ protected function beforeSave() { if (parent::beforeSave()) { if (isset($this->originalAttributeValues['role']) && $this->originalAttributeValues['role'][1] > 0) { AllPermissionsOptimizationUtil::userBeingRemovedFromRole($this, Role::getById($this->originalAttributeValues['role'][1])); $this->onChangeRights(); $this->onChangePolicies(); } return true; } else { return false; } }