Skip to content

Commit

Permalink
Move usages to OCP\User\NoUserException
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Jul 18, 2022
1 parent 0ef28c4 commit d8e6255
Show file tree
Hide file tree
Showing 29 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions apps/dashboard/lib/Service/BackgroundService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace OCA\Dashboard\Service;

use InvalidArgumentException;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCP\Files\File;
use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
Expand Down Expand Up @@ -143,7 +143,7 @@ public function setDefaultBackground(): void {
* @throws NotPermittedException
* @throws LockedException
* @throws PreConditionNotMetException
* @throws NoUserException
* @throws \OCP\User\NoUserException
*/
public function setFileBackground($path): void {
$this->config->setUserValue($this->userId, 'dashboard', 'background', 'custom');
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/BackgroundJob/EventReminderJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct(ITimeFactory $time,
/**
* @throws \OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException
* @throws \OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
*/
public function run($argument):void {
if ($this->config->getAppValue('dav', 'sendEventReminders', 'yes') !== 'yes') {
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/BackgroundJob/UploadCleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
namespace OCA\DAV\BackgroundJob;

use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\IJobList;
Expand Down
2 changes: 1 addition & 1 deletion apps/encryption/lib/Hooks/UserHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public function setPassphrase($params) {
* init mount points for given user
*
* @param string $user
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
*/
protected function initMountPoints($user) {
Filesystem::initMountPoints($user);
Expand Down
2 changes: 1 addition & 1 deletion apps/files/lib/Service/OwnershipTransferService.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function __construct(IEncryptionManager $manager,
* @param OutputInterface|null $output
* @param bool $move
* @throws TransferOwnershipException
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
*/
public function transfer(IUser $sourceUser,
IUser $destinationUser,
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Command/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

use OC\Core\Command\Base;
use OC\Files\Filesystem;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\DefinitionParameter;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Command/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace OCA\Files_External\Command;

use OC\Core\Command\Base;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\GlobalStoragesService;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Command/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace OCA\Files_External\Command;

use OC\Core\Command\Base;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\GlobalStoragesService;
use OCA\Files_External\Service\UserStoragesService;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/SharedStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
use OCP\Files\Node;
use OC\Files\Storage\FailedStorage;
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\Files_External\Config\ExternalMountPoint;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public static function ensureFileScannedHook($params) {
*
* @param string $filename
* @return array
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
*/
public static function getUidAndFilename($filename) {
$uid = Filesystem::getOwner($filename);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_versions/lib/Sabre/VersionHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
namespace OCA\Files_Versions\Sabre;

use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\Files_Versions\Versions\IVersionManager;
use OCP\Files\IRootFolder;
use OCP\IUserManager;
Expand Down
4 changes: 2 additions & 2 deletions apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Storage {
*
* @param string $filename
* @return array
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
*/
public static function getUidAndFilename($filename) {
$uid = Filesystem::getOwner($filename);
Expand Down Expand Up @@ -755,7 +755,7 @@ public static function expire($filename, $uid) {
$user = \OC::$server->get(IUserManager::class)->get($uid);
if (is_null($user)) {
$logger->error('Backends provided no user object for ' . $uid, ['app' => 'files_versions']);
throw new \OC\User\NoUserException('Backends provided no user object for ' . $uid);
throw new \OCP\User\NoUserException('Backends provided no user object for ' . $uid);
}

\OC_Util::setupFS($uid);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_versions/tests/VersioningTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ public function testExpireNonexistingFile() {


public function testExpireNonexistingUser() {
$this->expectException(\OC\User\NoUserException::class);
$this->expectException(\OCP\User\NoUserException::class);

$this->logout();
// needed to have a FS setup (the background job does this)
Expand Down
2 changes: 1 addition & 1 deletion apps/provisioning_api/lib/Controller/AUserData.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

use OC\Group\Manager;
use OC\User\Backend;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OC_Helper;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\PropertyDoesNotExistException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

use OC\Group\Manager;
use OC\SubAdmin;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\Provisioning_API\Controller\GroupsController;
use OCP\Accounts\IAccountManager;
use OCP\IConfig;
Expand Down
2 changes: 1 addition & 1 deletion apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

use OC\Share20\Exception\InvalidShare;
use OC\Share20\Share;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\ShareByMail\Settings\SettingsManager;
use OCP\Activity\IManager;
use OCP\DB\QueryBuilder\IQueryBuilder;
Expand Down
2 changes: 1 addition & 1 deletion apps/testing/lib/Controller/LockingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace OCA\Testing\Controller;

use OC\Lock\DBLockingProvider;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\Testing\Locking\FakeDBLockingProvider;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
Expand Down
4 changes: 2 additions & 2 deletions apps/user_ldap/lib/User_LDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

use OC\ServerNotAvailableException;
use OC\User\Backend;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCA\User_LDAP\Exceptions\NotOnLDAP;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
Expand Down Expand Up @@ -429,7 +429,7 @@ public function deleteUser($uid) {
*
* @param string $uid the username
* @return bool|string
* @throws NoUserException
* @throws \OCP\User\NoUserException
* @throws \Exception
*/
public function getHome($uid) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Avatar/AvatarManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

use OC\KnownUser\KnownUserService;
use OC\User\Manager;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\PropertyDoesNotExistException;
use OCP\Files\IAppData;
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Cache/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class File implements ICache {
*
* @return \OC\Files\View cache storage
* @throws \OC\ForbiddenException
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
*/
protected function getStorage() {
if ($this->storage !== null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Encryption/Keys/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use OC\Files\Filesystem;
use OC\Files\View;
use OC\ServerNotAvailableException;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCP\Encryption\Keys\IStorage;
use OCP\IConfig;
use OCP\Security\ICrypto;
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

use OCP\Cache\CappedMemoryCache;
use OC\Files\Mount\MountPoint;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\Node\FilesystemTornDownEvent;
use OCP\Files\NotFoundException;
Expand Down Expand Up @@ -366,7 +366,7 @@ public static function initMountManager() {
* Initialize system and personal mount points for a user
*
* @param string|IUser|null $user
* @throws \OC\User\NoUserException if the user is not available
* @throws \OCP\User\NoUserException if the user is not available
*/
public static function initMountPoints($user = '') {
/** @var IUserManager $userManager */
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Files/Node/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
use OC\Files\Utils\PathHelper;
use OC\Files\View;
use OC\Hooks\PublicEmitter;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Events\Node\FilesystemTornDownEvent;
Expand Down Expand Up @@ -358,7 +358,7 @@ public function getName() {
*
* @param string $userId user ID
* @return \OCP\Files\Folder
* @throws NoUserException
* @throws \OCP\User\NoUserException
* @throws NotPermittedException
*/
public function getUserFolder($userId) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Template/TemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function createFromTemplate(string $filePath, string $templateId = '', st
* @return Folder
* @throws \OCP\Files\NotFoundException
* @throws \OCP\Files\NotPermittedException
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
*/
private function getTemplateFolder(): Node {
if ($this->getTemplatePath() !== '') {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,7 @@ public function getPathRelativeToFiles($absolutePath) {
/**
* @param string $filename
* @return array
* @throws \OC\User\NoUserException
* @throws \OCP\User\NoUserException
* @throws NotFoundException
*/
public function getUidAndFilename($filename) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function setImpersonatingUserID(bool $useCurrentUser = true): void {
$currentUser = $this->getUser();

if ($currentUser === null) {
throw new \OC\User\NoUserException();
throw new \OCP\User\NoUserException();
}
$this->session->set('oldUserId', $currentUser->getUID());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files/IRootFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace OCP\Files;

use OC\Hooks\Emitter;
use OC\User\NoUserException;
use OCP\User\NoUserException;

/**
* Interface IRootFolder
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Files/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Temporary;
use OC\User\NoUserException;
use OCP\User\NoUserException;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IUser;
Expand Down Expand Up @@ -340,16 +340,16 @@ public function testHooks() {
*
*/
public function testLocalMountWhenUserDoesNotExist() {
$this->expectException(\OC\User\NoUserException::class);
$this->expectException(\OCP\User\NoUserException::class);

$userId = $this->getUniqueID('user_');

\OC\Files\Filesystem::initMountPoints($userId);
}


public function testNullUserThrows() {
$this->expectException(\OC\User\NoUserException::class);
$this->expectException(\OCP\User\NoUserException::class);

\OC\Files\Filesystem::initMountPoints(null);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Files/Node/RootTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function testGetUserFolder() {


public function testGetUserFolderWithNoUserObj() {
$this->expectException(\OC\User\NoUserException::class);
$this->expectException(\OCP\User\NoUserException::class);
$this->expectExceptionMessage('Backends provided no user object');

$root = new \OC\Files\Node\Root(
Expand Down

0 comments on commit d8e6255

Please sign in to comment.