Merge pull request #60620 from nextcloud/backport/60516/stable30
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
Integration sqlite / integration-sqlite (8.1, stable30, --tags ~@large files_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, capabilities_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, collaboration_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, comments_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, dav_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, federation_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, filesdrop_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, ldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, openldap_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, openldap_numerical_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, remoteapi_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, setup_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, sharees_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, sharing_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, theming_features) (push) Has been cancelled
Integration sqlite / integration-sqlite (8.1, stable30, videoverification_features) (push) Has been cancelled
Integration sqlite / integration-sqlite-summary (push) Has been cancelled

[stable30] feat(users): Check assertion when enabling user
This commit is contained in:
Andy Scherzinger 2026-05-21 11:06:26 +02:00 committed by GitHub
commit 2fdb60d839
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);
}
/**
@ -466,6 +470,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) {