Skip to content

Commit bd74b64

Browse files
artongebackportbot[bot]
authored andcommitted
feat(users): Check assertion when enabling user
feat(users): Check assertion when enabling user Signed-off-by: Louis Chmn <louis@chmn.me> [skip ci]
1 parent 78ddc9d commit bd74b64

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/private/User/User.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public function __construct(
7676
private IEventDispatcher $dispatcher,
7777
$emitter = null,
7878
?IConfig $config = null,
79-
$urlGenerator = null,
79+
?IURLGenerator $urlGenerator = null,
80+
?IAssertion $assertion = null,
8081
) {
8182
$this->emitter = $emitter;
8283
$this->config = $config ?? \OCP\Server::get(IConfig::class);
@@ -484,6 +485,11 @@ public function setEnabled(bool $enabled = true) {
484485
$this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false');
485486
$this->enabled = $enabled;
486487
};
488+
489+
if ($oldStatus === false && $enabled === true) {
490+
$this->assertion->createUserIsLegit();
491+
}
492+
487493
if ($this->backend instanceof IProvideEnabledStateBackend) {
488494
$queryDatabaseValue = function (): bool {
489495
if ($this->enabled === null) {

0 commit comments

Comments
 (0)