Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions lib/Controller/OcsApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\IRootFolder;
use OCP\Files\NotPermittedException;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\User\Events\UserFirstTimeLoggedInEvent;

class OcsApiController extends OCSController {

Expand All @@ -26,6 +28,8 @@
private IRootFolder $root,
private UserMapper $userMapper,
private IUserManager $userManager,
private IEventDispatcher $eventDispatcher,
private IConfig $config,

Check failure on line 32 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

UndefinedClass

lib/Controller/OcsApiController.php:32:3: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 32 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

UndefinedClass

lib/Controller/OcsApiController.php:32:3: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 32 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

UndefinedClass

lib/Controller/OcsApiController.php:32:3: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 32 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable29

UndefinedClass

lib/Controller/OcsApiController.php:32:3: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 32 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

UndefinedClass

lib/Controller/OcsApiController.php:32:3: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 32 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable31

UndefinedClass

lib/Controller/OcsApiController.php:32:3: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import is missing.
Also you may want to use ServerVersion?

) {
parent::__construct(Application::APP_ID, $request);
}
Expand Down Expand Up @@ -65,12 +69,19 @@
$user->setQuota($quota);
}

$userFolder = $this->root->getUserFolder($user->getUID());
try {
// copy skeleton
\OC_Util::copySkeleton($user->getUID(), $userFolder);
} catch (NotPermittedException $ex) {
// read only uses
// Slighly incorrect, but this event trigger the creation of the file skeleton and
// the contact book entry.
$this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user));
Comment on lines +72 to +74
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is incorrect, we should not trigger this event unless the user logs in.
But with oidc if it’s created it means he’s currently logging in?


/** Replace with ServerVersion once we depend on NC 31 */
if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '34.0.0', '<')) {

Check failure on line 77 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

UndefinedClass

lib/Controller/OcsApiController.php:77:23: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 77 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

UndefinedClass

lib/Controller/OcsApiController.php:77:23: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 77 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

UndefinedClass

lib/Controller/OcsApiController.php:77:23: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 77 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable29

UndefinedClass

lib/Controller/OcsApiController.php:77:23: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 77 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable30

UndefinedClass

lib/Controller/OcsApiController.php:77:23: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)

Check failure on line 77 in lib/Controller/OcsApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable31

UndefinedClass

lib/Controller/OcsApiController.php:77:23: UndefinedClass: Class, interface or enum named OCA\UserOIDC\Controller\IConfig does not exist (see https://psalm.dev/019)
$userFolder = $this->root->getUserFolder($user->getUID());
try {
// copy skeleton
\OC_Util::copySkeleton($user->getUID(), $userFolder);
} catch (NotPermittedException $ex) {
// read only uses
}
}

return new DataResponse(['user_id' => $user->getUID()]);
Expand Down
8 changes: 4 additions & 4 deletions lib/User/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use OCP\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\IRootFolder;
use OCP\Files\ISetupManager;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IConfig;
Expand Down Expand Up @@ -456,11 +455,12 @@ private function checkFirstLogin(string $userId): bool {
if ($firstLogin) {
/** Replace with ServerVersion once we depend on NC 31 */
if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '34.0.0', '>=')) {
Server::get(ISetupManager::class)->setupForUser($user);
} else {
\OC_Util::setupFS($userId);
$this->eventDispatcher->dispatchTyped(new UserFirstTimeLoggedInEvent($user));
return $firstLogin;
}

\OC_Util::setupFS($userId);

try {
// trigger creation of user home and /files folder
$userFolder = Server::get(IRootFolder::class)->getUserFolder($userId);
Expand Down
Loading