Merge pull request #60619 from nextcloud/backport/60516/stable31
Some checks failed
Integration sqlite / changes (push) Has been cancelled
Psalm static code analysis / static-code-analysis (push) Has been cancelled
Psalm static code analysis / static-code-analysis-security (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ocp (push) Has been cancelled
Psalm static code analysis / static-code-analysis-ncu (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, file_conversions) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, files_reminders) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, theming_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (stable31, 8.1, stable31, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled

[stable31] feat(users): Check assertion when enabling user
This commit is contained in:
Louis 2026-05-22 09:23:22 +02:00 committed by GitHub
commit e01d4d79cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,6 +26,7 @@ use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserBackend;
use OCP\Notification\IManager as INotificationManager;
use OCP\Support\Subscription\IAssertion;
use OCP\User\Backend\IGetHomeBackend;
use OCP\User\Backend\IPasswordHashBackend;
use OCP\User\Backend\IProvideAvatarBackend;
@ -49,6 +50,7 @@ class User implements IUser {
private IConfig $config;
private IURLGenerator $urlGenerator;
private IAssertion $assertion;
/** @var IAccountManager */
protected $accountManager;
@ -77,11 +79,13 @@ class User implements IUser {
private IEventDispatcher $dispatcher,
$emitter = null,
?IConfig $config = null,
$urlGenerator = null,
?IURLGenerator $urlGenerator = null,
?IAssertion $assertion = null,
) {
$this->emitter = $emitter;
$this->config = $config ?? \OCP\Server::get(IConfig::class);
$this->urlGenerator = $urlGenerator ?? \OCP\Server::get(IURLGenerator::class);
$this->assertion = $assertion ?? \OCP\Server::get(IAssertion::class);
}
/**
@ -485,6 +489,11 @@ class User implements IUser {
$this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false');
$this->enabled = $enabled;
};
if ($oldStatus === false && $enabled === true) {
$this->assertion->createUserIsLegit();
}
if ($this->backend instanceof IProvideEnabledStateBackend) {
$queryDatabaseValue = function (): bool {
if ($this->enabled === null) {