public function __construct(
private IAuditLogger $logger,
- ) {}
+ ) {
+ }
/**
* Log a single action with a log level of info
* @param bool $obfuscateParameters
*/
public function log(string $text,
- array $params,
- array $elements,
- bool $obfuscateParameters = false): void {
+ array $params,
+ array $elements,
+ bool $obfuscateParameters = false): void {
foreach ($elements as $element) {
if (!isset($params[$element])) {
if ($obfuscateParameters) {
*/
public function assign(string $uid): void {
$this->log(
- 'UserID assigned: "%s"',
+ 'UserID assigned: "%s"',
[ 'uid' => $uid ],
[ 'uid' ]
);
* Register hooks in order to log them
*/
private function registerHooks(IAuditLogger $logger,
- ContainerInterface $serverContainer): void {
+ ContainerInterface $serverContainer): void {
$this->userManagementHooks($logger, $serverContainer->get(IUserSession::class));
$this->groupHooks($logger, $serverContainer->get(IGroupManager::class));
$this->authHooks($logger);
}
private function userManagementHooks(IAuditLogger $logger,
- IUserSession $userSession): void {
+ IUserSession $userSession): void {
$userActions = new UserManagement($logger);
Util::connectHook('OC_User', 'post_createUser', $userActions, 'create');
}
private function groupHooks(IAuditLogger $logger,
- IGroupManager $groupManager): void {
+ IGroupManager $groupManager): void {
$groupActions = new GroupManagement($logger);
assert($groupManager instanceof GroupManager);
}
private function appHooks(IAuditLogger $logger,
- IEventDispatcher $eventDispatcher): void {
+ IEventDispatcher $eventDispatcher): void {
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) use ($logger) {
$appActions = new AppManagement($logger);
$appActions->enableApp($event->getAppID());
}
private function consoleHooks(IAuditLogger $logger,
- IEventDispatcher $eventDispatcher): void {
+ IEventDispatcher $eventDispatcher): void {
$eventDispatcher->addListener(ConsoleEvent::class, function (ConsoleEvent $event) use ($logger) {
$appActions = new Console($logger);
$appActions->runCommand($event->getArguments());
}
private function fileHooks(IAuditLogger $logger,
- IEventDispatcher $eventDispatcher): void {
+ IEventDispatcher $eventDispatcher): void {
$fileActions = new Files($logger);
$eventDispatcher->addListener(
BeforePreviewFetchedEvent::class,
}
private function securityHooks(IAuditLogger $logger,
- IEventDispatcher $eventDispatcher): void {
+ IEventDispatcher $eventDispatcher): void {
$eventDispatcher->addListener(TwoFactorProviderChallengePassed::class, function (TwoFactorProviderChallengePassed $event) use ($logger) {
$security = new Security($logger);
$security->twofactorSuccess($event->getUser(), $event->getProvider());
*/
namespace OCA\AdminAudit\BackgroundJobs;
-use OCP\BackgroundJob\TimedJob;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\Log\RotationTrait;
'verb' => 'POST',
'root' => '/ocm',
],
-// [
-// 'name' => 'RequestHandler#inviteAccepted',
-// 'url' => '/invite-accepted',
-// 'verb' => 'POST',
-// 'root' => '/ocm',
-// ]
+ // [
+ // 'name' => 'RequestHandler#inviteAccepted',
+ // 'url' => '/invite-accepted',
+ // 'verb' => 'POST',
+ // 'root' => '/ocm',
+ // ]
],
];
<?php
+
declare(strict_types=1);
/**
use OCA\Comments\Listener\LoadSidebarScripts;
use OCA\Comments\MaxAutoCompleteResultsInitialState;
use OCA\Comments\Notification\Notifier;
-use OCA\Comments\Search\LegacyProvider;
use OCA\Comments\Search\CommentsSearchProvider;
+use OCA\Comments\Search\LegacyProvider;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Comments\CommentsEntityEvent;
+use OCP\Comments\ICommentsManager;
use OCP\ISearch;
use OCP\IServerContainer;
-use OCP\Comments\ICommentsManager;
class Application extends App implements IBootstrap {
public const APP_ID = 'comments';
namespace OCA\Comments\Controller;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\RedirectResponse;
-use OCP\AppFramework\Http;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCP\Files\IRootFolder;
namespace OCA\Comments\Search;
use OCP\Comments\IComment;
+use OCP\Comments\ICommentsManager;
use OCP\Files\Folder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\IUser;
use OCP\Search\Provider;
-use OCP\Comments\ICommentsManager;
use function count;
class LegacyProvider extends Provider {
}
public function findExisting(IUser $user,
- ?string $uid,
- ?string $email,
- ?string $cloudId): ?string {
+ ?string $uid,
+ ?string $email,
+ ?string $cloudId): ?string {
$addressbooksQuery = $this->db->getQueryBuilder();
$cardQuery = $this->db->getQueryBuilder();
$propQuery = $this->db->getQueryBuilder();
* @return RecentContact[]
*/
public function findMatch(IUser $user,
- ?string $uid,
- ?string $email,
- ?string $cloudId): array {
+ ?string $uid,
+ ?string $email,
+ ?string $cloudId): array {
$qb = $this->db->getQueryBuilder();
$or = $qb->expr()->orX();
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Sabre\VObject\Component\VCard;
-use Sabre\VObject\Reader;
use Sabre\VObject\UUIDUtil;
-use Throwable;
class ContactInteractionListener implements IEventListener {
namespace OCA\Dashboard\Controller;
use OCA\Dashboard\ResponseDefinitions;
-use OCP\AppFramework\OCSController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\OCSController;
+use OCP\Dashboard\IAPIWidget;
+use OCP\Dashboard\IAPIWidgetV2;
use OCP\Dashboard\IButtonWidget;
use OCP\Dashboard\IIconWidget;
-use OCP\Dashboard\IOptionWidget;
use OCP\Dashboard\IManager;
+use OCP\Dashboard\IOptionWidget;
use OCP\Dashboard\IReloadableWidget;
use OCP\Dashboard\IWidget;
use OCP\Dashboard\Model\WidgetButton;
+use OCP\Dashboard\Model\WidgetItem;
+
use OCP\Dashboard\Model\WidgetOptions;
use OCP\IConfig;
use OCP\IRequest;
-use OCP\Dashboard\IAPIWidget;
-use OCP\Dashboard\IAPIWidgetV2;
-use OCP\Dashboard\Model\WidgetItem;
-use OCP\Dashboard\Model\WidgetItems;
-
/**
* @psalm-import-type DashboardWidget from ResponseDefinitions
* @psalm-import-type DashboardWidgetItem from ResponseDefinitions
<?php
+
declare(strict_types=1);
/**
// Backends
use OC\KnownUser\KnownUserService;
use OCA\DAV\CalDAV\CalDavBackend;
-use OCA\DAV\Connector\LegacyDAVACL;
use OCA\DAV\CalDAV\CalendarRoot;
+use OCA\DAV\Connector\LegacyDAVACL;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
use OCA\DAV\Connector\Sabre\MaintenancePlugin;
use OCA\DAV\Events\CardUpdatedEvent;
use OCA\DAV\Events\SubscriptionCreatedEvent;
use OCA\DAV\Events\SubscriptionDeletedEvent;
-use OCA\DAV\Listener\OutOfOfficeListener;
-use OCP\Accounts\UserUpdatedEvent;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Federation\Events\TrustedServerRemovedEvent;
use OCA\DAV\HookManager;
use OCA\DAV\Listener\ActivityUpdaterListener;
use OCA\DAV\Listener\AddressbookListener;
use OCA\DAV\Listener\CalendarShareUpdateListener;
use OCA\DAV\Listener\CardListener;
use OCA\DAV\Listener\ClearPhotoCacheListener;
+use OCA\DAV\Listener\OutOfOfficeListener;
use OCA\DAV\Listener\SubscriptionListener;
use OCA\DAV\Listener\TrustedServerRemovedListener;
use OCA\DAV\Listener\UserPreferenceListener;
use OCA\DAV\SetupChecks\NeedsSystemAddressBookSync;
use OCA\DAV\UserMigration\CalendarMigrator;
use OCA\DAV\UserMigration\ContactsMigrator;
+use OCP\Accounts\UserUpdatedEvent;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\Config\BeforePreferenceDeletedEvent;
use OCP\Config\BeforePreferenceSetEvent;
use OCP\Contacts\IManager as IContactsManager;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Federation\Events\TrustedServerRemovedEvent;
use OCP\Files\AppData\IAppDataFactory;
use OCP\IUser;
use OCP\User\Events\OutOfOfficeChangedEvent;
}
public function registerHooks(HookManager $hm,
- IEventDispatcher $dispatcher,
- IAppContainer $container) {
+ IEventDispatcher $dispatcher,
+ IAppContainer $container) {
$hm->setup();
// first time login event setup
}
private function setupContactsProvider(IContactsManager $contactsManager,
- IAppContainer $container,
- string $userID): void {
+ IAppContainer $container,
+ string $userID): void {
/** @var ContactsManager $cm */
$cm = $container->query(ContactsManager::class);
$urlGenerator = $container->getServer()->getURLGenerator();
}
private function setupSystemContactsProvider(IContactsManager $contactsManager,
- IAppContainer $container): void {
+ IAppContainer $container): void {
/** @var ContactsManager $cm */
$cm = $container->query(ContactsManager::class);
$urlGenerator = $container->getServer()->getURLGenerator();
}
public function registerCalendarManager(ICalendarManager $calendarManager,
- IAppContainer $container): void {
+ IAppContainer $container): void {
$calendarManager->register(function () use ($container, $calendarManager) {
$user = \OC::$server->getUserSession()->getUser();
if ($user !== null) {
}
private function setupCalendarProvider(ICalendarManager $calendarManager,
- IAppContainer $container,
- $userId) {
+ IAppContainer $container,
+ $userId) {
$cm = $container->query(CalendarManager::class);
$cm->setupCalendarProvider($calendarManager, $userId);
}
public function registerCalendarReminders(NotificationProviderManager $manager,
- LoggerInterface $logger): void {
+ LoggerInterface $logger): void {
try {
$manager->registerProvider(AudioProvider::class);
$manager->registerProvider(EmailProvider::class);
* BuildReminderIndexBackgroundJob constructor.
*/
public function __construct(IDBConnection $db,
- ReminderService $reminderService,
- LoggerInterface $logger,
- IJobList $jobList,
- ITimeFactory $timeFactory) {
+ ReminderService $reminderService,
+ LoggerInterface $logger,
+ IJobList $jobList,
+ ITimeFactory $timeFactory) {
parent::__construct($timeFactory);
$this->db = $db;
$this->reminderService = $reminderService;
private $service;
public function __construct(ITimeFactory $time,
- RetentionService $service) {
+ RetentionService $service) {
parent::__construct($time);
$this->service = $service;
private $config;
public function __construct(ITimeFactory $time,
- ReminderService $reminderService,
- IConfig $config) {
+ ReminderService $reminderService,
+ IConfig $config) {
parent::__construct($time);
$this->reminderService = $reminderService;
$this->config = $config;
private $config;
public function __construct(ITimeFactory $time,
- BirthdayService $birthdayService,
- IConfig $config) {
+ BirthdayService $birthdayService,
+ IConfig $config) {
parent::__construct($time);
$this->birthdayService = $birthdayService;
*/
namespace OCA\DAV\BackgroundJob;
-use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\BackgroundJob\TimedJob;
use OCA\DAV\AppInfo\Application;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CardDAV\CardDavBackend;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use Psr\Log\LoggerInterface;
* @param IJobList $jobList
*/
public function __construct(ITimeFactory $time,
- IUserManager $userManager,
- IJobList $jobList) {
+ IUserManager $userManager,
+ IJobList $jobList) {
parent::__construct($time);
$this->userManager = $userManager;
$this->jobList = $jobList;
private $calDavBackend;
public function __construct(ITimeFactory $time,
- IResourceManager $resourceManager,
- IRoomManager $roomManager,
- IDBConnection $dbConnection,
- CalDavBackend $calDavBackend) {
+ IResourceManager $resourceManager,
+ IRoomManager $roomManager,
+ IDBConnection $dbConnection,
+ CalDavBackend $calDavBackend) {
parent::__construct($time);
$this->resourceManager = $resourceManager;
$this->roomManager = $roomManager;
* @param string $principalPrefix
*/
private function runForBackend($backendManager,
- string $dbTable,
- string $dbTableMetadata,
- string $foreignKey,
- string $principalPrefix): void {
+ string $dbTable,
+ string $dbTableMetadata,
+ string $foreignKey,
+ string $principalPrefix): void {
$backends = $backendManager->getBackends();
foreach ($backends as $backend) {
* @return int Insert id
*/
private function addToCache(string $table,
- string $backendId,
- $remote): int {
+ string $backendId,
+ $remote): int {
$query = $this->dbConnection->getQueryBuilder();
$query->insert($table)
->values([
* @param array $metadata
*/
private function addMetadataToCache(string $table,
- string $foreignKey,
- int $foreignId,
- array $metadata): void {
+ string $foreignKey,
+ int $foreignId,
+ array $metadata): void {
foreach ($metadata as $key => $value) {
$query = $this->dbConnection->getQueryBuilder();
$query->insert($table)
* @param int $id
*/
private function deleteFromCache(string $table,
- int $id): void {
+ int $id): void {
$query = $this->dbConnection->getQueryBuilder();
$query->delete($table)
->where($query->expr()->eq('id', $query->createNamedParameter($id)))
* @param int $id
*/
private function deleteMetadataFromCache(string $table,
- string $foreignKey,
- int $id): void {
+ string $foreignKey,
+ int $id): void {
$query = $this->dbConnection->getQueryBuilder();
$query->delete($table)
->where($query->expr()->eq($foreignKey, $query->createNamedParameter($id)))
* @param IResource|IRoom $remote
*/
private function updateCache(string $table,
- int $id,
- $remote): void {
+ int $id,
+ $remote): void {
$query = $this->dbConnection->getQueryBuilder();
$query->update($table)
->set('email', $query->createNamedParameter($remote->getEMail()))
* @param array $cachedMetadata
*/
private function updateMetadataCache(string $dbTable,
- string $foreignKey,
- int $id,
- array $metadata,
- array $cachedMetadata): void {
+ string $foreignKey,
+ int $id,
+ array $metadata,
+ array $cachedMetadata): void {
$newMetadata = array_diff_key($metadata, $cachedMetadata);
$deletedMetadata = array_diff_key($cachedMetadata, $metadata);
* @return array
*/
private function getAllMetadataOfCache(string $table,
- string $foreignKey,
- int $id): array {
+ string $foreignKey,
+ int $id): array {
$query = $this->dbConnection->getQueryBuilder();
$query->select(['key', 'value'])
->from($table)
* @return array
*/
private function getAllCachedByBackend(string $tableName,
- string $backendId): array {
+ string $backendId): array {
$query = $this->dbConnection->getQueryBuilder();
$query->select('resource_id')
->from($tableName)
* @param $principalUri
*/
private function deleteCalendarDataForResource(string $principalPrefix,
- string $principalUri): void {
+ string $principalUri): void {
$calendar = $this->calDavBackend->getCalendarByUri(
implode('/', [$principalPrefix, $principalUri]),
CalDavBackend::RESOURCE_BOOKING_CALENDAR_URI);
* @return int
*/
private function getIdForBackendAndResource(string $table,
- string $backendId,
- string $resourceId): int {
+ string $backendId,
+ string $resourceId): int {
$query = $this->dbConnection->getQueryBuilder();
$query->select('id')
->from($table)
use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\TimedJob;
-use OCP\Files\Node;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
protected IConfig $config;
public function __construct(ITimeFactory $timeFactory,
- IDBConnection $connection,
- IJobList $jobList,
- LoggerInterface $logger,
- IManager $manager,
- IConfig $config) {
+ IDBConnection $connection,
+ IJobList $jobList,
+ LoggerInterface $logger,
+ IManager $manager,
+ IConfig $config) {
parent::__construct($timeFactory);
$this->connection = $connection;
$this->jobList = $jobList;
namespace OCA\DAV\BulkUpload;
+use OCA\DAV\Connector\Sabre\MtimeSanitizer;
+use OCP\AppFramework\Http;
+use OCP\Files\DavUtil;
+use OCP\Files\Folder;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-use OCP\Files\DavUtil;
-use OCP\Files\Folder;
-use OCP\AppFramework\Http;
-use OCA\DAV\Connector\Sabre\MtimeSanitizer;
class BulkUploadPlugin extends ServerPlugin {
private Folder $userFolder;
namespace OCA\DAV\BulkUpload;
-use Sabre\HTTP\RequestInterface;
+use OCP\AppFramework\Http;
use Sabre\DAV\Exception;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\LengthRequired;
-use OCP\AppFramework\Http;
+use Sabre\HTTP\RequestInterface;
class MultipartRequestParser {
<?php
+
declare(strict_types=1);
/**
namespace OCA\DAV\CalDAV\AppCalendar;
-use OCA\DAV\CalDAV\Plugin;
use OCA\DAV\CalDAV\Integration\ExternalCalendar;
+use OCA\DAV\CalDAV\Plugin;
use OCP\Calendar\ICalendar;
use OCP\Calendar\ICreateFromString;
use OCP\Constants;
<?php
+
declare(strict_types=1);
/**
<?php
+
declare(strict_types=1);
/**
* BirthdayService constructor.
*/
public function __construct(CalDavBackend $calDavBackEnd,
- CardDavBackend $cardDavBackEnd,
- GroupPrincipalBackend $principalBackend,
- IConfig $config,
- IDBConnection $dbConnection,
- IL10N $l10n) {
+ CardDavBackend $cardDavBackEnd,
+ GroupPrincipalBackend $principalBackend,
+ IConfig $config,
+ IDBConnection $dbConnection,
+ IL10N $l10n) {
$this->calDavBackEnd = $calDavBackEnd;
$this->cardDavBackEnd = $cardDavBackEnd;
$this->principalBackend = $principalBackend;
}
public function onCardChanged(int $addressBookId,
- string $cardUri,
- string $cardData): void {
+ string $cardUri,
+ string $cardData): void {
if (!$this->isGloballyEnabled()) {
return;
}
}
public function onCardDeleted(int $addressBookId,
- string $cardUri): void {
+ string $cardUri): void {
if (!$this->isGloballyEnabled()) {
return;
}
* @throws InvalidDataException
*/
public function buildDateFromContact(string $cardData,
- string $dateField,
- string $postfix,
- ?string $reminderOffset):?VCalendar {
+ string $dateField,
+ string $postfix,
+ ?string $reminderOffset):?VCalendar {
if (empty($cardData)) {
return null;
}
* @return bool
*/
public function birthdayEvenChanged(string $existingCalendarData,
- VCalendar $newCalendarData):bool {
+ VCalendar $newCalendarData):bool {
try {
$existingBirthday = Reader::read($existingCalendarData);
} catch (Exception $ex) {
* @throws \Sabre\DAV\Exception\BadRequest
*/
private function updateCalendar(string $cardUri,
- string $cardData,
- array $book,
- int $calendarId,
- array $type,
- ?string $reminderOffset):void {
+ string $cardData,
+ array $book,
+ int $calendarId,
+ array $type,
+ ?string $reminderOffset):void {
$objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics';
$calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix'], $reminderOffset);
$existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri);
* @return string The formatted title
*/
private function formatTitle(string $field,
- string $name,
- int $year = null,
- bool $supports4Byte = true):string {
+ string $name,
+ int $year = null,
+ bool $supports4Byte = true):string {
if ($supports4Byte) {
switch ($field) {
case 'BDAY':
use OCP\Calendar\Exceptions\CalendarException;
use OCP\Calendar\ICreateFromString;
use OCP\Calendar\IHandleImipMessage;
-use OCP\Calendar\ISchedulingInformation;
use OCP\Constants;
use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp;
use Sabre\DAV\Exception\Conflict;
private array $calendarInfo;
public function __construct(Calendar $calendar,
- array $calendarInfo,
- CalDavBackend $backend) {
+ array $calendarInfo,
+ CalDavBackend $backend) {
$this->calendar = $calendar;
$this->calendarInfo = $calendarInfo;
$this->backend = $backend;
* @param array $objectData
*/
public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
- array $calendarInfo,
- array $objectData) {
+ array $calendarInfo,
+ array $objectData) {
parent::__construct($caldavBackend, $calendarInfo, $objectData);
if ($this->isShared()) {
*/
namespace OCA\DAV\CalDAV;
-use OCA\DAV\AppInfo\Application;
use OCA\DAV\CalDAV\Schedule\IMipService;
-use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\IConfig;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
-use Sabre\VObject\Component\VTimeZone;
-use Sabre\VObject\Component\VTodo;
-use function max;
class EventComparisonService {
<?php
+
declare(strict_types=1);
/*
* *
namespace OCA\DAV\CalDAV\FreeBusy;
-use DateTimeInterface;
-use DateTimeZone;
use Sabre\VObject\Component\VCalendar;
/**
* @param IConfig $config
*/
public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
- IConfig $config, LoggerInterface $logger) {
+ IConfig $config, LoggerInterface $logger) {
$this->caldavBackend = $caldavBackend;
$this->l10n = $l10n;
$this->config = $config;
$this->server = $server;
$this->server->on('method:POST', [$this, 'httpPost']);
- $this->server->on('propFind', [$this, 'propFind']);
+ $this->server->on('propFind', [$this, 'propFind']);
}
public function propFind(PropFind $propFind, INode $node) {
case '{'.self::NS_CALENDARSERVER.'}publish-calendar':
- // We can only deal with IShareableCalendar objects
- if (!$node instanceof Calendar) {
- return;
- }
- $this->server->transactionType = 'post-publish-calendar';
+ // We can only deal with IShareableCalendar objects
+ if (!$node instanceof Calendar) {
+ return;
+ }
+ $this->server->transactionType = 'post-publish-calendar';
- // Getting ACL info
- $acl = $this->server->getPlugin('acl');
+ // Getting ACL info
+ $acl = $this->server->getPlugin('acl');
- // If there's no ACL support, we allow everything
- if ($acl) {
- /** @var \Sabre\DAVACL\Plugin $acl */
- $acl->checkPrivileges($path, '{DAV:}write');
+ // If there's no ACL support, we allow everything
+ if ($acl) {
+ /** @var \Sabre\DAVACL\Plugin $acl */
+ $acl->checkPrivileges($path, '{DAV:}write');
- $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes';
- $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner();
- if ($limitSharingToOwner && !$isOwner) {
- return;
+ $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes';
+ $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner();
+ if ($limitSharingToOwner && !$isOwner) {
+ return;
+ }
}
- }
- $node->setPublishStatus(true);
+ $node->setPublishStatus(true);
- // iCloud sends back the 202, so we will too.
- $response->setStatus(202);
+ // iCloud sends back the 202, so we will too.
+ $response->setStatus(202);
- // Adding this because sending a response body may cause issues,
- // and I wanted some type of indicator the response was handled.
- $response->setHeader('X-Sabre-Status', 'everything-went-well');
+ // Adding this because sending a response body may cause issues,
+ // and I wanted some type of indicator the response was handled.
+ $response->setHeader('X-Sabre-Status', 'everything-went-well');
- // Breaking the event chain
- return false;
+ // Breaking the event chain
+ return false;
case '{'.self::NS_CALENDARSERVER.'}unpublish-calendar':
- // We can only deal with IShareableCalendar objects
- if (!$node instanceof Calendar) {
- return;
- }
- $this->server->transactionType = 'post-unpublish-calendar';
+ // We can only deal with IShareableCalendar objects
+ if (!$node instanceof Calendar) {
+ return;
+ }
+ $this->server->transactionType = 'post-unpublish-calendar';
- // Getting ACL info
- $acl = $this->server->getPlugin('acl');
+ // Getting ACL info
+ $acl = $this->server->getPlugin('acl');
- // If there's no ACL support, we allow everything
- if ($acl) {
- /** @var \Sabre\DAVACL\Plugin $acl */
- $acl->checkPrivileges($path, '{DAV:}write');
+ // If there's no ACL support, we allow everything
+ if ($acl) {
+ /** @var \Sabre\DAVACL\Plugin $acl */
+ $acl->checkPrivileges($path, '{DAV:}write');
- $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes';
- $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner();
- if ($limitSharingToOwner && !$isOwner) {
- return;
+ $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes';
+ $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner();
+ if ($limitSharingToOwner && !$isOwner) {
+ return;
+ }
}
- }
- $node->setPublishStatus(false);
+ $node->setPublishStatus(false);
- $response->setStatus(200);
+ $response->setStatus(200);
- // Adding this because sending a response body may cause issues,
- // and I wanted some type of indicator the response was handled.
- $response->setHeader('X-Sabre-Status', 'everything-went-well');
+ // Adding this because sending a response body may cause issues,
+ // and I wanted some type of indicator the response was handled.
+ $response->setHeader('X-Sabre-Status', 'everything-went-well');
- // Breaking the event chain
- return false;
+ // Breaking the event chain
+ return false;
}
}
* @param ITimeFactory $timeFactory
*/
public function __construct(IDBConnection $db,
- ITimeFactory $timeFactory) {
+ ITimeFactory $timeFactory) {
$this->db = $db;
$this->timeFactory = $timeFactory;
}
* @return int The insert id
*/
public function insertReminder(int $calendarId,
- int $objectId,
- string $uid,
- bool $isRecurring,
- int $recurrenceId,
- bool $isRecurrenceException,
- string $eventHash,
- string $alarmHash,
- string $type,
- bool $isRelative,
- int $notificationDate,
- bool $isRepeatBased):int {
+ int $objectId,
+ string $uid,
+ bool $isRecurring,
+ int $recurrenceId,
+ bool $isRecurrenceException,
+ string $eventHash,
+ string $alarmHash,
+ string $type,
+ bool $isRelative,
+ int $notificationDate,
+ bool $isRepeatBased):int {
$query = $this->db->getQueryBuilder();
$query->insert('calendar_reminders')
->values([
* @param int $newNotificationDate
*/
public function updateReminder(int $reminderId,
- int $newNotificationDate):void {
+ int $newNotificationDate):void {
$query = $this->db->getQueryBuilder();
$query->update('calendar_reminders')
->set('notification_date', $query->createNamedParameter($newNotificationDate))
* @return void
*/
public function send(VEvent $vevent,
- ?string $calendarDisplayName,
- array $principalEmailAddresses,
- array $users = []): void;
+ ?string $calendarDisplayName,
+ array $principalEmailAddresses,
+ array $users = []): void;
}
protected $config;
public function __construct(LoggerInterface $logger,
- L10NFactory $l10nFactory,
- IURLGenerator $urlGenerator,
- IConfig $config) {
+ L10NFactory $l10nFactory,
+ IURLGenerator $urlGenerator,
+ IConfig $config) {
$this->logger = $logger;
$this->l10nFactory = $l10nFactory;
$this->urlGenerator = $urlGenerator;
* @return void
*/
abstract public function send(VEvent $vevent,
- ?string $calendarDisplayName,
- array $principalEmailAddresses,
- array $users = []): void;
+ ?string $calendarDisplayName,
+ array $principalEmailAddresses,
+ array $users = []): void;
/**
* @return string
private IMailer $mailer;
public function __construct(IConfig $config,
- IMailer $mailer,
- LoggerInterface $logger,
- L10NFactory $l10nFactory,
- IURLGenerator $urlGenerator) {
+ IMailer $mailer,
+ LoggerInterface $logger,
+ L10NFactory $l10nFactory,
+ IURLGenerator $urlGenerator) {
parent::__construct($logger, $l10nFactory, $urlGenerator, $config);
$this->mailer = $mailer;
}
* @throws \Exception
*/
public function send(VEvent $vevent,
- ?string $calendarDisplayName,
- array $principalEmailAddresses,
- array $users = []):void {
+ ?string $calendarDisplayName,
+ array $principalEmailAddresses,
+ array $users = []):void {
$fallbackLanguage = $this->getFallbackLanguage();
$organizerEmailAddress = null;
* @param array $eventData
*/
private function addBulletList(IEMailTemplate $template,
- IL10N $l10n,
- string $calendarDisplayName,
- VEvent $vevent):void {
+ IL10N $l10n,
+ string $calendarDisplayName,
+ VEvent $vevent):void {
$template->addBodyListItem($calendarDisplayName, $l10n->t('Calendar:'),
$this->getAbsoluteImagePath('actions/info.png'));
* @return array<string, string[]>
*/
private function sortEMailAddressesByLanguage(array $emails,
- string $defaultLanguage):array {
+ string $defaultLanguage):array {
$sortedByLanguage = [];
foreach ($emails as $emailAddress => $parameters) {
}
private function isDayEqual(DateTime $dtStart,
- DateTime $dtEnd):bool {
+ DateTime $dtEnd):bool {
return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d');
}
private $timeFactory;
public function __construct(IConfig $config,
- IManager $manager,
- LoggerInterface $logger,
- L10NFactory $l10nFactory,
- IURLGenerator $urlGenerator,
- ITimeFactory $timeFactory) {
+ IManager $manager,
+ LoggerInterface $logger,
+ L10NFactory $l10nFactory,
+ IURLGenerator $urlGenerator,
+ ITimeFactory $timeFactory) {
parent::__construct($logger, $l10nFactory, $urlGenerator, $config);
$this->manager = $manager;
$this->timeFactory = $timeFactory;
* @throws \Exception
*/
public function send(VEvent $vevent,
- ?string $calendarDisplayName,
- array $principalEmailAddresses,
- array $users = []):void {
+ ?string $calendarDisplayName,
+ array $principalEmailAddresses,
+ array $users = []):void {
if ($this->config->getAppValue('dav', 'sendEventRemindersPush', 'yes') !== 'yes') {
return;
}
* @param ITimeFactory $timeFactory
*/
public function __construct(IFactory $factory,
- IURLGenerator $urlGenerator,
- ITimeFactory $timeFactory) {
+ IURLGenerator $urlGenerator,
+ ITimeFactory $timeFactory) {
$this->l10nFactory = $factory;
$this->urlGenerator = $urlGenerator;
$this->timeFactory = $timeFactory;
* @throws \Exception
*/
public function prepare(INotification $notification,
- string $languageCode):INotification {
+ string $languageCode):INotification {
if ($notification->getApp() !== Application::APP_ID) {
throw new \InvalidArgumentException('Notification not from this app');
}
* @return bool
*/
private function isDayEqual(DateTime $dtStart,
- DateTime $dtEnd):bool {
+ DateTime $dtEnd):bool {
return $dtStart->format('Y-m-d') === $dtEnd->format('Y-m-d');
}
];
public function __construct(Backend $backend,
- NotificationProviderManager $notificationProviderManager,
- IUserManager $userManager,
- IGroupManager $groupManager,
- CalDavBackend $caldavBackend,
- ITimeFactory $timeFactory,
- IConfig $config,
- LoggerInterface $logger,
- Principal $principalConnector) {
+ NotificationProviderManager $notificationProviderManager,
+ IUserManager $userManager,
+ IGroupManager $groupManager,
+ CalDavBackend $caldavBackend,
+ ITimeFactory $timeFactory,
+ IConfig $config,
+ LoggerInterface $logger,
+ Principal $principalConnector) {
$this->backend = $backend;
$this->notificationProviderManager = $notificationProviderManager;
$this->userManager = $userManager;
* @return array
*/
private function getRemindersForVAlarm(VAlarm $valarm,
- array $objectData,
- DateTimeZone $calendarTimeZone,
- string $eventHash = null,
- string $alarmHash = null,
- bool $isRecurring = false,
- bool $isRecurrenceException = false):array {
+ array $objectData,
+ DateTimeZone $calendarTimeZone,
+ string $eventHash = null,
+ string $alarmHash = null,
+ bool $isRecurring = false,
+ bool $isRecurrenceException = false):array {
if ($eventHash === null) {
$eventHash = $this->getEventHash($valarm->parent);
}
* @param VEvent $vevent
*/
private function deleteOrProcessNext(array $reminder,
- VObject\Component\VEvent $vevent):void {
+ VObject\Component\VEvent $vevent):void {
if ($reminder['is_repeat_based'] ||
!$reminder['is_recurring'] ||
!$reminder['is_relative'] ||
* @return VEvent|null
*/
private function getVEventByRecurrenceId(VObject\Component\VCalendar $vcalendar,
- int $recurrenceId,
- bool $isRecurrenceException):?VEvent {
+ int $recurrenceId,
+ bool $isRecurrenceException):?VEvent {
$vevents = $this->getAllVEventsFromVCalendar($vcalendar);
if (count($vevents) === 0) {
return null;
private $cuType;
public function __construct(IDBConnection $dbConnection,
- IUserSession $userSession,
- IGroupManager $groupManager,
- LoggerInterface $logger,
- ProxyMapper $proxyMapper,
- string $principalPrefix,
- string $dbPrefix,
- string $cuType) {
+ IUserSession $userSession,
+ IGroupManager $groupManager,
+ LoggerInterface $logger,
+ ProxyMapper $proxyMapper,
+ string $principalPrefix,
+ string $dbPrefix,
+ string $cuType) {
$this->db = $dbConnection;
$this->userSession = $userSession;
$this->groupManager = $groupManager;
}
[, $name] = \Sabre\Uri\split($path);
- [$backendId, $resourceId] = explode('-', $name, 2);
+ [$backendId, $resourceId] = explode('-', $name, 2);
$query = $this->db->getQueryBuilder();
$query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname'])
case IRoomMetadata::CAPACITY:
case IResourceMetadata::VEHICLE_SEATING_CAPACITY:
- $results[] = $this->searchPrincipalsByCapacity($prop,$value);
+ $results[] = $this->searchPrincipalsByCapacity($prop, $value);
break;
default:
}
[, $name] = \Sabre\Uri\split($path);
- [$backendId, $resourceId] = explode('-', $name, 2);
+ [$backendId, $resourceId] = explode('-', $name, 2);
$query = $this->db->getQueryBuilder();
$query->select(['id', 'backend_id', 'resource_id', 'email', 'displayname', 'group_restrictions'])
* ResourcePrincipalBackend constructor.
*/
public function __construct(IDBConnection $dbConnection,
- IUserSession $userSession,
- IGroupManager $groupManager,
- LoggerInterface $logger,
- ProxyMapper $proxyMapper) {
+ IUserSession $userSession,
+ IGroupManager $groupManager,
+ LoggerInterface $logger,
+ ProxyMapper $proxyMapper) {
parent::__construct($dbConnection, $userSession, $groupManager, $logger,
$proxyMapper, 'principals/calendar-resources', 'resource', 'RESOURCE');
}
* RoomPrincipalBackend constructor.
*/
public function __construct(IDBConnection $dbConnection,
- IUserSession $userSession,
- IGroupManager $groupManager,
- LoggerInterface $logger,
- ProxyMapper $proxyMapper) {
+ IUserSession $userSession,
+ IGroupManager $groupManager,
+ LoggerInterface $logger,
+ ProxyMapper $proxyMapper) {
parent::__construct($dbConnection, $userSession, $groupManager, $logger,
$proxyMapper, 'principals/calendar-rooms', 'room', 'ROOM');
}
private $calDavBackend;
public function __construct(IConfig $config,
- ITimeFactory $time,
- CalDavBackend $calDavBackend) {
+ ITimeFactory $time,
+ CalDavBackend $calDavBackend) {
$this->config = $config;
$this->time = $time;
$this->calDavBackend = $calDavBackend;
private EventComparisonService $eventComparisonService;
public function __construct(IConfig $config,
- IMailer $mailer,
- LoggerInterface $logger,
- ITimeFactory $timeFactory,
- Defaults $defaults,
- IUserManager $userManager,
- $userId,
- IMipService $imipService,
- EventComparisonService $eventComparisonService) {
+ IMailer $mailer,
+ LoggerInterface $logger,
+ ITimeFactory $timeFactory,
+ Defaults $defaults,
+ IUserManager $userManager,
+ $userId,
+ IMipService $imipService,
+ EventComparisonService $eventComparisonService) {
parent::__construct('');
$this->userId = $userId;
$this->config = $config;
$itip_msg = $iTipMessage->message->serialize();
$message->attachInline(
- $itip_msg,
+ $itip_msg,
'event.ics',
- 'text/calendar; method=' . $iTipMessage->method,
+ 'text/calendar; method=' . $iTipMessage->method,
);
try {
<?php
+
declare(strict_types=1);
/*
* DAV App
];
public function __construct(URLGenerator $urlGenerator,
- IConfig $config,
- IDBConnection $db,
- ISecureRandom $random,
- L10NFactory $l10nFactory) {
+ IConfig $config,
+ IDBConnection $db,
+ ISecureRandom $random,
+ L10NFactory $l10nFactory) {
$this->urlGenerator = $urlGenerator;
$this->config = $config;
$this->db = $db;
return $default;
}
$newstring = $vevent->$property->getValue();
- if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring ) {
+ if(isset($oldVEvent->$property) && $oldVEvent->$property->getValue() !== $newstring) {
$oldstring = $oldVEvent->$property->getValue();
return sprintf($strikethrough, $oldstring, $newstring);
}
if(!empty($oldVEvent)) {
$oldMeetingWhen = $this->generateWhenString($oldVEvent);
- $data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']);
+ $data['meeting_title_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'SUMMARY', $data['meeting_title']);
$data['meeting_description_html'] = $this->generateDiffString($vEvent, $oldVEvent, 'DESCRIPTION', $data['meeting_description']);
$data['meeting_location_html'] = $this->generateLinkifiedDiffString($vEvent, $oldVEvent, 'LOCATION', $data['meeting_location']);
$strikethrough = "<span style='text-decoration: line-through'>%s</span>";
$newMeetingWhen = $this->generateWhenString($vEvent);
- $newSummary = isset($vEvent->SUMMARY) && (string)$vEvent->SUMMARY !== '' ? (string)$vEvent->SUMMARY : $this->l10n->t('Untitled event');;
+ $newSummary = isset($vEvent->SUMMARY) && (string)$vEvent->SUMMARY !== '' ? (string)$vEvent->SUMMARY : $this->l10n->t('Untitled event');
+ ;
$newDescription = isset($vEvent->DESCRIPTION) && (string)$vEvent->DESCRIPTION !== '' ? (string)$vEvent->DESCRIPTION : $defaultVal;
$newUrl = isset($vEvent->URL) && (string)$vEvent->URL !== '' ? sprintf('<a href="%1$s">%1$s</a>', $vEvent->URL) : $defaultVal;
$newLocation = isset($vEvent->LOCATION) && (string)$vEvent->LOCATION !== '' ? (string)$vEvent->LOCATION : $defaultVal;
htmlspecialchars($organizer->getNormalizedValue()),
htmlspecialchars($organizerName ?: $organizerEmail));
$organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail);
- if(isset($organizer['PARTSTAT']) ) {
+ if(isset($organizer['PARTSTAT'])) {
/** @var Parameter $partstat */
$partstat = $organizer['PARTSTAT'];
if(strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) {
use OCP\IConfig;
use Psr\Log\LoggerInterface;
use Sabre\CalDAV\ICalendar;
-use Sabre\CalDAV\Schedule\IOutbox;
use Sabre\DAV\INode;
use Sabre\DAV\IProperties;
use Sabre\DAV\PropFind;
use Sabre\DAVACL\IPrincipal;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-use Sabre\VObject;
use Sabre\VObject\Component;
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
class Status {
- public function __construct(private string $status = '', private ?string $message = null, private ?string $customMessage = null){}
+ public function __construct(private string $status = '', private ?string $message = null, private ?string $customMessage = null) {
+ }
public function getStatus(): string {
return $this->status;
*/
namespace OCA\DAV\CalDAV\Status;
-use DateTimeZone;
use OC\Calendar\CalendarQuery;
use OCA\DAV\CalDAV\CalendarImpl;
use OCA\DAV\CalDAV\FreeBusy\FreeBusyGenerator;
use OCA\DAV\CalDAV\InvitationResponse\InvitationResponseServer;
-use OCA\DAV\CalDAV\IUser;
use OCA\DAV\CalDAV\Schedule\Plugin as SchedulePlugin;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Calendar\IManager;
-use OCP\Calendar\ISchedulingInformation;
use OCP\IL10N;
use OCP\IUser as User;
use OCP\UserStatus\IUserStatus;
use Sabre\DAVACL\Exception\NeedPrivileges;
use Sabre\DAVACL\Plugin as AclPlugin;
use Sabre\VObject\Component;
-use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
use Sabre\VObject\Parameter;
use Sabre\VObject\Property;
class StatusService {
public function __construct(private ITimeFactory $timeFactory,
- private IManager $calendarManager,
- private InvitationResponseServer $server,
- private IL10N $l10n,
- private FreeBusyGenerator $generator){}
+ private IManager $calendarManager,
+ private InvitationResponseServer $server,
+ private IL10N $l10n,
+ private FreeBusyGenerator $generator) {
+ }
public function processCalendarAvailability(User $user, ?string $availability): ?Status {
$userId = $user->getUID();
foreach ($calendarEvents as $calendarEvent) {
$vEvent = new VEvent($calendar, 'VEVENT');
foreach($calendarEvent['objects'] as $component) {
- foreach ($component as $key => $value) {
+ foreach ($component as $key => $value) {
$vEvent->add($key, $value[0]);
}
}
private $calDavBackend;
public function __construct(string $name,
- array $objectData,
- string $principalUri,
- CalDavBackend $calDavBackend) {
+ array $objectData,
+ string $principalUri,
+ CalDavBackend $calDavBackend) {
$this->name = $name;
$this->objectData = $objectData;
$this->calDavBackend = $calDavBackend;
private $principalInfo;
public function __construct(CalDavBackend $caldavBackend,
- array $principalInfo) {
+ array $principalInfo) {
$this->caldavBackend = $caldavBackend;
$this->principalInfo = $principalInfo;
}
private $server;
public function __construct(IRequest $request,
- RetentionService $retentionService) {
+ RetentionService $retentionService) {
$this->disableTrashbin = $request->getHeader('X-NC-CalDAV-No-Trashbin') === '1';
$this->retentionService = $retentionService;
}
private $principalInfo;
public function __construct(CalDavBackend $caldavBackend,
- array $principalInfo) {
+ array $principalInfo) {
$this->caldavBackend = $caldavBackend;
$this->principalInfo = $principalInfo;
}
use Sabre\VObject\Component;
use Sabre\VObject\DateTimeParser;
use Sabre\VObject\InvalidDataException;
-use Sabre\VObject\Recur\NoInstancesException;
use Sabre\VObject\ParseException;
use Sabre\VObject\Reader;
+use Sabre\VObject\Recur\NoInstancesException;
use Sabre\VObject\Splitter\ICalendar;
use Sabre\VObject\UUIDUtil;
use function count;
protected $userManager;
public function __construct(IActivityManager $activityManager,
- IGroupManager $groupManager,
- IUserSession $userSession,
- IAppManager $appManager,
- IUserManager $userManager) {
+ IGroupManager $groupManager,
+ IUserSession $userSession,
+ IAppManager $appManager,
+ IUserManager $userManager) {
$this->activityManager = $activityManager;
$this->groupManager = $groupManager;
$this->userSession = $userSession;
protected $eventMerger;
public function __construct(IFactory $languageFactory,
- IURLGenerator $url,
- IManager $activityManager,
- IUserManager $userManager,
- IGroupManager $groupManager,
- IEventMerger $eventMerger) {
+ IURLGenerator $url,
+ IManager $activityManager,
+ IUserManager $userManager,
+ IGroupManager $groupManager,
+ IEventMerger $eventMerger) {
parent::__construct($userManager, $groupManager, $url);
$this->languageFactory = $languageFactory;
$this->activityManager = $activityManager;
protected $url;
public function __construct(IUserManager $userManager,
- IGroupManager $groupManager,
- IURLGenerator $urlGenerator) {
+ IGroupManager $groupManager,
+ IURLGenerator $urlGenerator) {
$this->userManager = $userManager;
$this->groupManager = $groupManager;
$this->url = $urlGenerator;
protected $appManager;
public function __construct(IFactory $languageFactory,
- IURLGenerator $url,
- IManager $activityManager,
- IUserManager $userManager,
- IGroupManager $groupManager,
- IEventMerger $eventMerger,
- IAppManager $appManager) {
+ IURLGenerator $url,
+ IManager $activityManager,
+ IUserManager $userManager,
+ IGroupManager $groupManager,
+ IEventMerger $eventMerger,
+ IAppManager $appManager) {
parent::__construct($userManager, $groupManager, $url);
$this->languageFactory = $languageFactory;
$this->activityManager = $activityManager;
* @param IUrlGenerator $urlGenerator
*/
public function __construct(
- AddressBook $addressBook,
- array $addressBookInfo,
- CardDavBackend $backend,
- IURLGenerator $urlGenerator) {
+ AddressBook $addressBook,
+ array $addressBookInfo,
+ CardDavBackend $backend,
+ IURLGenerator $urlGenerator) {
$this->addressBook = $addressBook;
$this->addressBookInfo = $addressBookInfo;
$this->backend = $backend;
* @param string $principalPrefix
*/
public function __construct(\Sabre\DAVACL\PrincipalBackend\BackendInterface $principalBackend,
- \Sabre\CardDAV\Backend\BackendInterface $carddavBackend,
- PluginManager $pluginManager,
- ?IUser $user,
- ?IGroupManager $groupManager,
- string $principalPrefix = 'principals') {
+ \Sabre\CardDAV\Backend\BackendInterface $carddavBackend,
+ PluginManager $pluginManager,
+ ?IUser $user,
+ ?IGroupManager $groupManager,
+ string $principalPrefix = 'principals') {
parent::__construct($principalBackend, $carddavBackend, $principalPrefix);
$this->pluginManager = $pluginManager;
$this->user = $user;
*/
namespace OCA\DAV\CardDAV;
-class Card extends \Sabre\CardDAV\Card
-{
+class Card extends \Sabre\CardDAV\Card {
public function getId(): int {
return (int) $this->cardData['id'];
}
*/
namespace OCA\DAV\CardDAV;
+use OC\Search\Filter\DateTimeFilter;
use OCA\DAV\Connector\Sabre\Principal;
use OCA\DAV\DAV\Sharing\Backend;
use OCA\DAV\DAV\Sharing\IShareable;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
-use OC\Search\Filter\DateTimeFilter;
use PDO;
use Sabre\CardDAV\Backend\BackendInterface;
use Sabre\CardDAV\Backend\SyncSupport;
* @param IEventDispatcher $dispatcher
*/
public function __construct(IDBConnection $db,
- Principal $principalBackend,
- IUserManager $userManager,
- IGroupManager $groupManager,
- IEventDispatcher $dispatcher) {
+ Principal $principalBackend,
+ IUserManager $userManager,
+ IGroupManager $groupManager,
+ IEventDispatcher $dispatcher) {
$this->db = $db;
$this->principalBackend = $principalBackend;
$this->userManager = $userManager;
* @return array
*/
public function searchPrincipalUri(string $principalUri,
- string $pattern,
- array $searchProperties,
- array $options = []): array {
+ string $pattern,
+ array $searchProperties,
+ array $options = []): array {
return $this->atomic(function () use ($principalUri, $pattern, $searchProperties, $options) {
$addressBookIds = array_map(static function ($row):int {
return (int) $row['id'];
* @return array
*/
private function searchByAddressBookIds(array $addressBookIds,
- string $pattern,
- array $searchProperties,
- array $options = []): array {
+ string $pattern,
+ array $searchProperties,
+ array $options = []): array {
if (empty($addressBookIds)) {
return [];
}
use Exception;
use OCP\Accounts\IAccountManager;
-use OCP\IURLGenerator;
use OCP\IImage;
+use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
use Sabre\VObject\Component\VCard;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
+use Psr\Log\LoggerInterface;
use Sabre\CardDAV\Card;
use Sabre\VObject\Document;
use Sabre\VObject\Parameter;
use Sabre\VObject\Property\Binary;
use Sabre\VObject\Reader;
-use Psr\Log\LoggerInterface;
class PhotoCache {
*/
namespace OCA\DAV\CardDAV;
-use OC\Accounts\AccountManager;
use OCP\AppFramework\Db\TTransactional;
use OCP\AppFramework\Http;
use OCP\IDBConnection;
protected string $certPath;
public function __construct(CardDavBackend $backend,
- IUserManager $userManager,
- IDBConnection $dbConnection,
- LoggerInterface $logger,
- Converter $converter) {
+ IUserManager $userManager,
+ IDBConnection $dbConnection,
+ LoggerInterface $logger,
+ Converter $converter) {
$this->backend = $backend;
$this->userManager = $userManager;
$this->logger = $logger;
$cardUri = basename($resource);
if (isset($status[200])) {
$vCard = $this->download($url, $userName, $sharedSecret, $resource);
- $this->atomic(function() use ($addressBookId, $cardUri, $vCard) {
+ $this->atomic(function () use ($addressBookId, $cardUri, $vCard) {
$existingCard = $this->backend->getCard($addressBookId, $cardUri);
if ($existingCard === false) {
$this->backend->createCard($addressBookId, $cardUri, $vCard['body']);
* @throws \Sabre\DAV\Exception\BadRequest
*/
public function ensureSystemAddressBookExists(string $principal, string $uri, array $properties): ?array {
- return $this->atomic(function() use ($principal, $uri, $properties) {
+ return $this->atomic(function () use ($principal, $uri, $properties) {
$book = $this->backend->getAddressBooksByUri($principal, $uri);
if (!is_null($book)) {
return $book;
$cardId = self::getCardUri($user);
if ($user->isEnabled()) {
- $this->atomic(function() use ($addressBookId, $cardId, $user) {
+ $this->atomic(function () use ($addressBookId, $cardId, $user) {
$card = $this->backend->getCard($addressBookId, $cardId);
if ($card === false) {
$vCard = $this->converter->createCardFromUser($user);
use OCP\IL10N;
use OCP\IRequest;
use OCP\IUserSession;
-use Sabre\CardDAV\Backend\SyncSupport;
use Sabre\CardDAV\Backend\BackendInterface;
+use Sabre\CardDAV\Backend\SyncSupport;
use Sabre\CardDAV\Card;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\NotFound;
namespace OCA\DAV\CardDAV;
use OCA\DAV\AppInfo\PluginManager;
-use OCA\DAV\CardDAV\Integration\IAddressBookProvider;
use OCA\DAV\CardDAV\Integration\ExternalAddressBook;
+use OCA\DAV\CardDAV\Integration\IAddressBookProvider;
use OCA\Federation\TrustedServers;
use OCP\AppFramework\QueryException;
use OCP\IConfig;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use Sabre\CardDAV\Backend;
-use Sabre\DAV\Exception\MethodNotAllowed;
use Sabre\CardDAV\IAddressBook;
-use function array_map;
+use Sabre\DAV\Exception\MethodNotAllowed;
use Sabre\DAV\MkCol;
+use function array_map;
class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
/** @var IL10N */
private ?IGroupManager $groupManager;
public function __construct(Backend\BackendInterface $carddavBackend,
- string $principalUri,
- PluginManager $pluginManager,
- ?IUser $user,
- ?IGroupManager $groupManager) {
+ string $principalUri,
+ PluginManager $pluginManager,
+ ?IUser $user,
+ ?IGroupManager $groupManager) {
parent::__construct($carddavBackend, $principalUri);
$this->pluginManager = $pluginManager;
$this->user = $user;
->setName('dav:create-addressbook')
->setDescription('Create a dav addressbook')
->addArgument('user',
- InputArgument::REQUIRED,
- 'User for whom the addressbook will be created')
+ InputArgument::REQUIRED,
+ 'User for whom the addressbook will be created')
->addArgument('name',
- InputArgument::REQUIRED,
- 'Name of the addressbook');
+ InputArgument::REQUIRED,
+ 'Name of the addressbook');
}
protected function execute(InputInterface $input, OutputInterface $output): int {
throw new BadRequest('Invalid input values', 0, $e);
} catch (\OCP\Comments\MessageTooLongException $e) {
$msg = 'Message exceeds allowed character limit of ';
- throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e);
+ throw new BadRequest($msg . \OCP\Comments\IComment::MAX_MESSAGE_LENGTH, 0, $e);
}
}
}
private IThrottler $throttler;
public function __construct(IRequest $request,
- IManager $shareManager,
- ISession $session,
- IThrottler $throttler) {
+ IManager $shareManager,
+ ISession $session,
+ IThrottler $throttler) {
$this->request = $request;
$this->shareManager = $shareManager;
$this->session = $session;
private $isMacOSDavAgent = false;
/**
- * Sets up the plugin.
- *
- * This method is automatically called by the server class.
+ * Sets up the plugin.
+ *
+ * This method is automatically called by the server class.
*
* @return void
- */
- public function initialize(Server $server)
- {
+ */
+ public function initialize(Server $server) {
$server->on('beforeMethod:REPORT', [$this, 'beforeReport'], 0);
$server->on('report', [$this, 'report'], 0);
}
/**
- * Triggered before any method is handled.
+ * Triggered before any method is handled.
*
* @return void
- */
- public function beforeReport(RequestInterface $request, ResponseInterface $response)
- {
+ */
+ public function beforeReport(RequestInterface $request, ResponseInterface $response) {
$userAgent = $request->getRawServerValue('HTTP_USER_AGENT') ?? 'unknown';
$this->isMacOSDavAgent = $this->isMacOSUserAgent($userAgent);
}
/**
- * This method handles HTTP REPORT requests.
- *
- * @param string $reportName
- * @param mixed $report
- * @param mixed $path
+ * This method handles HTTP REPORT requests.
+ *
+ * @param string $reportName
+ * @param mixed $report
+ * @param mixed $path
*
* @return bool
- */
- public function report($reportName, $report, $path)
- {
+ */
+ public function report($reportName, $report, $path) {
if ($reportName == '{DAV:}principal-property-search' && $this->isMacOSDavAgent) {
/** @var \Sabre\DAVACL\Xml\Request\PrincipalPropertySearchReport $report */
$report->applyToPrincipalCollectionSet = true;
*
* @return bool
*/
- protected function isMacOSUserAgent(string $userAgent):bool
- {
+ protected function isMacOSUserAgent(string $userAgent):bool {
return str_starts_with(self::OSX_AGENT_PREFIX, $userAgent);
}
*
* @return null|array
*/
- protected function decodeMacOSAgentString(string $userAgent):?array
- {
+ protected function decodeMacOSAgentString(string $userAgent):?array {
// OSX agent string is like: macOS/13.2.1 (22D68) dataaccessd/1.0
if (preg_match('|^' . self::OSX_AGENT_PREFIX . '/([0-9]+)\\.([0-9]+)\\.([0-9]+)\s+\((\w+)\)\s+([^/]+)/([0-9]+)(?:\\.([0-9]+))?(?:\\.([0-9]+))?$|i', $userAgent, $matches)) {
return [
private IThrottler $throttler;
public function __construct(ISession $session,
- Session $userSession,
- IRequest $request,
- Manager $twoFactorManager,
- IThrottler $throttler,
- string $principalPrefix = 'principals/users/') {
+ Session $userSession,
+ IRequest $request,
+ Manager $twoFactorManager,
+ IThrottler $throttler,
+ string $principalPrefix = 'principals/users/') {
$this->session = $session;
$this->userSession = $userSession;
$this->twoFactorManager = $twoFactorManager;
if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With') ?? ''))) {
// do not re-authenticate over ajax, use dummy auth name to prevent browser popup
- $response->addHeader('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"');
+ $response->addHeader('WWW-Authenticate', 'DummyBasic realm="' . $this->realm . '"');
$response->setStatus(401);
throw new \Sabre\DAV\Exception\NotAuthenticated('Cannot authenticate over ajax calls');
}
private string $principalPrefix;
public function __construct(IUserSession $userSession,
- ISession $session,
- IRequest $request,
- $principalPrefix = 'principals/users/') {
+ ISession $session,
+ IRequest $request,
+ $principalPrefix = 'principals/users/') {
$this->userSession = $userSession;
$this->session = $session;
$this->request = $request;
use OCP\IConfig;
use OCP\IRequest;
+use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
-use Sabre\DAV\Server;
/**
* Class BlockLegacyClientPlugin is used to detect old legacy sync clients and
namespace OCA\DAV\Connector\Sabre;
+use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-use Sabre\DAV\Server;
class ChecksumUpdatePlugin extends ServerPlugin {
protected ?Server $server = null;
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
use OCP\Comments\ICommentsManager;
use OCP\IUserSession;
use Sabre\DAV\PropFind;
-use Sabre\DAV\ServerPlugin;
use Sabre\DAV\Server;
+use Sabre\DAV\ServerPlugin;
class CommentPropertiesPlugin extends ServerPlugin {
public const PROPERTY_NAME_HREF = '{http://owncloud.org/ns}comments-href';
namespace OCA\DAV\Connector\Sabre;
use Sabre\DAV\Exception\NotFound;
+use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-use Sabre\DAV\Server;
/**
* Copies the "Etag" header to "OC-Etag" after any request.
use OCP\L10N\IFactory;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
+use OCP\Share\IManager as IShareManager;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\BadRequest;
use Sabre\DAV\Exception\Locked;
use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\IFile;
use Sabre\DAV\INode;
-use OCP\Share\IManager as IShareManager;
class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuota, \Sabre\DAV\IMoveTarget, \Sabre\DAV\ICopyTarget {
/**
*/
namespace OCA\DAV\Connector\Sabre;
+use Sabre\DAV\Server;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-use Sabre\DAV\Server;
/**
* Class DummyGetResponsePlugin is a plugin used to not show a "Not implemented"
public function httpGet(RequestInterface $request, ResponseInterface $response) {
$string = 'This is the WebDAV interface. It can only be accessed by ' .
'WebDAV clients such as the Nextcloud desktop sync client.';
- $stream = fopen('php://memory','r+');
+ $stream = fopen('php://memory', 'r+');
fwrite($stream, $string);
rewind($stream);
* @param \DOMElement $errorNode
* @return void
*/
- public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
+ public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) {
// set ownCloud namespace
$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
// adding the retry node
- $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
+ $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true));
$errorNode->appendChild($error);
// adding the message node
- $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
+ $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage());
$errorNode->appendChild($error);
}
}
* @param \DOMElement $errorNode
* @return void
*/
- public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
+ public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) {
// set ownCloud namespace
$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);
// adding the retry node
- $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true));
+ $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true));
$errorNode->appendChild($error);
// adding the message node
- $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage());
+ $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage());
$errorNode->appendChild($error);
}
}
use Sabre\DAV\Exception\NotImplemented;
use Sabre\DAV\Exception\PreconditionFailed;
use Sabre\DAV\Exception\RequestedRangeNotSatisfiable;
-use Sabre\DAV\Exception\ServiceUnavailable;
class ExceptionLoggerPlugin extends \Sabre\DAV\ServerPlugin {
protected $nonFatalExceptions = [
* @return bool
*/
public function fakeLockProvider(RequestInterface $request,
- ResponseInterface $response) {
+ ResponseInterface $response) {
$lockInfo = new LockInfo();
$lockInfo->token = md5($request->getPath());
$lockInfo->uri = $request->getPath();
* @return bool
*/
public function fakeUnlockProvider(RequestInterface $request,
- ResponseInterface $response) {
+ ResponseInterface $response) {
$response->setStatus(204);
$response->setHeader('Content-Length', '0');
return false;
private IPreview $previewManager;
public function __construct(Tree $tree,
- IConfig $config,
- IRequest $request,
- IPreview $previewManager,
- IUserSession $userSession,
- bool $isPublic = false,
- bool $downloadAttachment = true) {
+ IConfig $config,
+ IRequest $request,
+ IPreview $previewManager,
+ IUserSession $userSession,
+ bool $isPublic = false,
+ bool $downloadAttachment = true) {
$this->tree = $tree;
$this->config = $config;
$this->request = $request;
* @param IAppManager $appManager
*/
public function __construct(Tree $tree,
- View $view,
- ISystemTagManager $tagManager,
- ISystemTagObjectMapper $tagMapper,
- ITagManager $fileTagger,
- IUserSession $userSession,
- IGroupManager $groupManager,
- Folder $userFolder,
- IAppManager $appManager
+ View $view,
+ ISystemTagManager $tagManager,
+ ISystemTagObjectMapper $tagMapper,
+ ITagManager $fileTagger,
+ IUserSession $userSession,
+ IGroupManager $groupManager,
+ Folder $userFolder,
+ IAppManager $appManager
) {
$this->tree = $tree;
$this->fileView = $view;
private $languageFactory;
public function __construct(IUserManager $userManager,
- IGroupManager $groupManager,
- IAccountManager $accountManager,
- IShareManager $shareManager,
- IUserSession $userSession,
- IAppManager $appManager,
- ProxyMapper $proxyMapper,
- KnownUserService $knownUserService,
- IConfig $config,
- IFactory $languageFactory,
- string $principalPrefix = 'principals/users/') {
+ IGroupManager $groupManager,
+ IAccountManager $accountManager,
+ IShareManager $shareManager,
+ IUserSession $userSession,
+ IAppManager $appManager,
+ ProxyMapper $proxyMapper,
+ KnownUserService $knownUserService,
+ IConfig $config,
+ IFactory $languageFactory,
+ string $principalPrefix = 'principals/users/') {
$this->userManager = $userManager;
$this->groupManager = $groupManager;
$this->accountManager = $accountManager;
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Robin Appelman <robin@icewind.nl>
*
*/
namespace OCA\DAV\Connector\Sabre;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Files\Folder;
use OCA\DAV\AppInfo\PluginManager;
use OCA\DAV\DAV\ViewOnlyPlugin;
use OCA\DAV\Files\BrowserErrorPagePlugin;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Folder;
use OCP\Files\Mount\IMountManager;
use OCP\IConfig;
use OCP\IDBConnection;
* @param callable $viewCallBack callback that should return the view for the dav endpoint
*/
public function createServer(string $baseUri,
- string $requestUri,
- Plugin $authPlugin,
- callable $viewCallBack): Server {
+ string $requestUri,
+ Plugin $authPlugin,
+ callable $viewCallBack): Server {
// Fire up server
$objectTree = new \OCA\DAV\Connector\Sabre\ObjectTree();
$server = new \OCA\DAV\Connector\Sabre\Server($objectTree);
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\IUserSession;
-use OCP\Share\IShare;
use OCP\Share\IManager;
+use OCP\Share\IShare;
use Sabre\DAV\PropFind;
-use Sabre\DAV\Tree;
use Sabre\DAV\Server;
+use Sabre\DAV\Tree;
/**
* Sabre Plugin to provide share-related properties
&& $propFind->getDepth() !== 0
&& (!is_null($propFind->getStatus(self::TAGS_PROPERTYNAME))
|| !is_null($propFind->getStatus(self::FAVORITE_PROPERTYNAME))
- )) {
+ )) {
// note: pre-fetching only supported for depth <= 1
$folderContent = $node->getChildren();
$fileIds[] = (int)$node->getId();
* @param CalDavBackend $calDavBackend
*/
public function __construct($appName, IRequest $request,
- IDBConnection $db, IConfig $config,
- IJobList $jobList,
- IUserManager $userManager,
- CalDavBackend $calDavBackend) {
+ IDBConnection $db, IConfig $config,
+ IJobList $jobList,
+ IUserManager $userManager,
+ CalDavBackend $calDavBackend) {
parent::__construct($appName, $request);
$this->db = $db;
$this->config = $config;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSBadRequestException;
-use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\OCS\OCSForbiddenException;
+use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\BeforeDirectFileDownloadEvent;
use OCP\Files\File;
private $eventDispatcher;
public function __construct(string $appName,
- IRequest $request,
- IRootFolder $rootFolder,
- string $userId,
- DirectMapper $mapper,
- ISecureRandom $random,
- ITimeFactory $timeFactory,
- IURLGenerator $urlGenerator,
- IEventDispatcher $eventDispatcher) {
+ IRequest $request,
+ IRootFolder $rootFolder,
+ string $userId,
+ DirectMapper $mapper,
+ ISecureRandom $random,
+ ITimeFactory $timeFactory,
+ IURLGenerator $urlGenerator,
+ IEventDispatcher $eventDispatcher) {
parent::__construct($appName, $request);
$this->rootFolder = $rootFolder;
* @param InvitationResponseServer $responseServer
*/
public function __construct(string $appName, IRequest $request,
- IDBConnection $db, ITimeFactory $timeFactory,
- InvitationResponseServer $responseServer) {
+ IDBConnection $db, ITimeFactory $timeFactory,
+ InvitationResponseServer $responseServer) {
parent::__construct($appName, $request);
$this->db = $db;
$this->timeFactory = $timeFactory;
* @return array
*/
public function getPrincipalByPath($path) {
- $elements = explode('/', $path, 3);
+ $elements = explode('/', $path, 3);
if ($elements[0] !== 'principals') {
return null;
}
use OCA\DAV\Connector\Sabre\Principal;
use OCP\AppFramework\Db\TTransactional;
use OCP\Cache\CappedMemoryCache;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
-use OCP\DB\QueryBuilder\IQueryBuilder;
class Backend {
use TTransactional;
}
public function preloadShares(array $resourceIds): void {
- $resourceIds = array_filter($resourceIds, function(int $resourceId) {
+ $resourceIds = array_filter($resourceIds, function (int $resourceId) {
return !isset($this->shareCache[$resourceId]);
});
if (count($resourceIds) === 0) {
$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
$this->server->on('method:POST', [$this, 'httpPost']);
- $this->server->on('propFind', [$this, 'propFind']);
+ $this->server->on('propFind', [$this, 'propFind']);
}
/**
use OCA\Files_Versions\Sabre\VersionFile;
use OCP\Files\NotFoundException;
use Psr\Log\LoggerInterface;
+use Sabre\DAV\Exception\NotFound;
use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
-use Sabre\DAV\Exception\NotFound;
/**
* Sabre plugin for restricting file share receiver download:
if ($davNode instanceof DavFile) {
// Restrict view-only to nodes which are shared
$node = $davNode->getNode();
- } else if ($davNode instanceof VersionFile) {
+ } elseif ($davNode instanceof VersionFile) {
$node = $davNode->getVersion()->getSourceFile();
} else {
return true;
}
public function createServer(string $baseURI,
- string $requestURI,
- IRootFolder $rootFolder,
- DirectMapper $mapper,
- ITimeFactory $timeFactory,
- IThrottler $throttler,
- IRequest $request): Server {
+ string $requestURI,
+ IRootFolder $rootFolder,
+ DirectMapper $mapper,
+ ITimeFactory $timeFactory,
+ IThrottler $throttler,
+ IRequest $request): Server {
$home = new DirectHome($rootFolder, $mapper, $timeFactory, $throttler, $request, $this->eventDispatcher);
$server = new Server($home);
* @since 20.0.0
*/
public function __construct(int $addressBookId,
- array $addressBookData) {
+ array $addressBookData) {
parent::__construct();
$this->addressBookId = $addressBookId;
$this->addressBookData = $addressBookData;
* @since 20.0.0
*/
public function __construct(int $addressBookId,
- array $addressBookData,
- array $shares) {
+ array $addressBookData,
+ array $shares) {
parent::__construct();
$this->addressBookId = $addressBookId;
$this->addressBookData = $addressBookData;
* @since 20.0.0
*/
public function __construct(int $addressBookId,
- array $addressBookData,
- array $oldShares,
- array $added,
- array $removed) {
+ array $addressBookData,
+ array $oldShares,
+ array $added,
+ array $removed) {
parent::__construct();
$this->addressBookId = $addressBookId;
$this->addressBookData = $addressBookData;
* @since 20.0.0
*/
public function __construct(int $addressBookId,
- array $addressBookData,
- array $shares,
- array $mutations) {
+ array $addressBookData,
+ array $shares,
+ array $mutations) {
parent::__construct();
$this->addressBookId = $addressBookId;
$this->addressBookData = $addressBookData;
* @since 20.0.0
*/
public function __construct(int $subscriptionId,
- array $subscriptionData,
- array $shares,
- array $objectData) {
+ array $subscriptionData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->subscriptionId = $subscriptionId;
$this->subscriptionData = $subscriptionData;
* @since 20.0.0
*/
public function __construct(int $subscriptionId,
- array $subscriptionData,
- array $shares,
- array $objectData) {
+ array $subscriptionData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->subscriptionId = $subscriptionId;
$this->subscriptionData = $subscriptionData;
* @since 20.0.0
*/
public function __construct(int $subscriptionId,
- array $subscriptionData,
- array $shares,
- array $objectData) {
+ array $subscriptionData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->subscriptionId = $subscriptionId;
$this->subscriptionData = $subscriptionData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData) {
+ array $calendarData) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares) {
+ array $calendarData,
+ array $shares) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 22.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares) {
+ array $calendarData,
+ array $shares) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares,
- array $objectData) {
+ array $calendarData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares,
- array $objectData) {
+ array $calendarData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 25.0.0
*/
public function __construct(int $sourceCalendarId,
- array $sourceCalendarData,
- int $targetCalendarId,
- array $targetCalendarData,
- array $sourceShares,
- array $targetShares,
- array $objectData) {
+ array $sourceCalendarData,
+ int $targetCalendarId,
+ array $targetCalendarData,
+ array $sourceShares,
+ array $targetShares,
+ array $objectData) {
parent::__construct();
$this->sourceCalendarId = $sourceCalendarId;
$this->sourceCalendarData = $sourceCalendarData;
* @since 22.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares,
- array $objectData) {
+ array $calendarData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 22.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares,
- array $objectData) {
+ array $calendarData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares,
- array $objectData) {
+ array $calendarData,
+ array $shares,
+ array $objectData) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- string $publicUri) {
+ array $calendarData,
+ string $publicUri) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 22.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares) {
+ array $calendarData,
+ array $shares) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $oldShares,
- array $added,
- array $removed) {
+ array $calendarData,
+ array $oldShares,
+ array $added,
+ array $removed) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData) {
+ array $calendarData) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $calendarId,
- array $calendarData,
- array $shares,
- array $mutations) {
+ array $calendarData,
+ array $shares,
+ array $mutations) {
parent::__construct();
$this->calendarId = $calendarId;
$this->calendarData = $calendarData;
* @since 20.0.0
*/
public function __construct(int $addressBookId,
- array $addressBookData,
- array $shares,
- array $cardData) {
+ array $addressBookData,
+ array $shares,
+ array $cardData) {
parent::__construct();
$this->addressBookId = $addressBookId;
$this->addressBookData = $addressBookData;
* @since 20.0.0
*/
public function __construct(int $addressBookId,
- array $addressBookData,
- array $shares,
- array $cardData) {
+ array $addressBookData,
+ array $shares,
+ array $cardData) {
parent::__construct();
$this->addressBookId = $addressBookId;
$this->addressBookData = $addressBookData;
* @since 27.0.0
*/
public function __construct(int $sourceAddressBookId,
- array $sourceAddressBookData,
- int $targetAddressBookId,
- array $targetAddressBookData,
- array $sourceShares,
- array $targetShares,
- array $objectData) {
+ array $sourceAddressBookData,
+ int $targetAddressBookId,
+ array $targetAddressBookData,
+ array $sourceShares,
+ array $targetShares,
+ array $objectData) {
parent::__construct();
$this->sourceAddressBookId = $sourceAddressBookId;
$this->sourceAddressBookData = $sourceAddressBookData;
* @since 20.0.0
*/
public function __construct(int $addressBookId,
- array $addressBookData,
- array $shares,
- array $cardData) {
+ array $addressBookData,
+ array $shares,
+ array $cardData) {
parent::__construct();
$this->addressBookId = $addressBookId;
$this->addressBookData = $addressBookData;
* @since 20.0.0
*/
public function __construct(int $subscriptionId,
- array $subscriptionData) {
+ array $subscriptionData) {
parent::__construct();
$this->subscriptionId = $subscriptionId;
$this->subscriptionData = $subscriptionData;
* @since 20.0.0
*/
public function __construct(int $subscriptionId,
- array $subscriptionData,
- array $shares) {
+ array $subscriptionData,
+ array $shares) {
parent::__construct();
$this->subscriptionId = $subscriptionId;
$this->subscriptionData = $subscriptionData;
* @since 20.0.0
*/
public function __construct(int $subscriptionId,
- array $subscriptionData,
- array $shares,
- array $mutations) {
+ array $subscriptionData,
+ array $shares,
+ array $mutations) {
parent::__construct();
$this->subscriptionId = $subscriptionId;
$this->subscriptionData = $subscriptionData;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
-use OCP\Files\Search\ISearchComparison;
use OCP\Files\Search\ISearchOperator;
use OCP\Files\Search\ISearchOrder;
use OCP\Files\Search\ISearchQuery;
throw new \InvalidArgumentException('Invalid argument 2 for ' . $trimmedType . ' operation, expected literal');
}
$value = $operator->arguments[1]->value;
+ // no break
case Operator::OPERATION_IS_DEFINED:
if (!($operator->arguments[0] instanceof SearchPropertyDefinition)) {
throw new \InvalidArgumentException('Invalid argument 1 for ' . $trimmedType . ' operation, expected property');
return '';
}
- switch ($property->dataType) {
+ switch ($property->dataType) {
case SearchPropertyDefinition::DATATYPE_BOOLEAN:
return $value === 'yes';
case SearchPropertyDefinition::DATATYPE_DECIMAL:
*/
namespace OCA\DAV\Files;
-use Sabre\DAV\INode;
use SearchDAV\Backend\ISearchBackend;
use SearchDAV\Query\Query;
private $themingDefaults;
public function __construct(IUserManager $userManager,
- SyncService $syncService,
- CalDavBackend $calDav,
- CardDavBackend $cardDav,
- Defaults $themingDefaults) {
+ SyncService $syncService,
+ CalDavBackend $calDav,
+ CardDavBackend $cardDav,
+ Defaults $themingDefaults) {
$this->userManager = $userManager;
$this->syncService = $syncService;
$this->calDav = $calDav;
private $logger;
public function __construct(ActivityBackend $activityBackend,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->activityBackend = $activityBackend;
$this->logger = $logger;
}
private $logger;
public function __construct(ActivityBackend $activityBackend,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->activityBackend = $activityBackend;
$this->logger = $logger;
}
private $logger;
public function __construct(IEventDispatcher $dispatcher,
- IUserSession $userSession,
- Principal $principalConnector,
- IMailer $mailer,
- LoggerInterface $logger) {
+ IUserSession $userSession,
+ Principal $principalConnector,
+ IMailer $mailer,
+ LoggerInterface $logger) {
$this->dispatcher = $dispatcher;
$this->userSession = $userSession;
$this->principalConnector = $principalConnector;
private $logger;
public function __construct(IConfig $config,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->config = $config;
$this->logger = $logger;
}
private $logger;
public function __construct(ReminderBackend $reminderBackend,
- ReminderService $reminderService,
- CalDavBackend $calDavBackend,
- LoggerInterface $logger) {
+ ReminderService $reminderService,
+ CalDavBackend $calDavBackend,
+ LoggerInterface $logger) {
$this->reminderBackend = $reminderBackend;
$this->reminderService = $reminderService;
$this->calDavBackend = $calDavBackend;
private LoggerInterface $logger;
public function __construct(Backend $activityBackend,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->activityBackend = $activityBackend;
$this->logger = $logger;
}
private LoggerInterface $logger;
public function __construct(Backend $activityBackend,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->activityBackend = $activityBackend;
$this->logger = $logger;
}
*/
namespace OCA\DAV\Listener;
-use OCA\DAV\CardDAV\Activity\Provider\Card;
use OCA\DAV\CardDAV\Activity\Backend as ActivityBackend;
+use OCA\DAV\CardDAV\Activity\Provider\Card;
use OCA\DAV\Events\CardCreatedEvent;
use OCA\DAV\Events\CardDeletedEvent;
use OCA\DAV\Events\CardUpdatedEvent;
private $logger;
public function __construct(ActivityBackend $activityBackend,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->activityBackend = $activityBackend;
$this->logger = $logger;
}
*/
class OutOfOfficeListener implements IEventListener {
public function __construct(private ServerFactory $serverFactory,
- private IConfig $appConfig,
- private LoggerInterface $logger) {
+ private IConfig $appConfig,
+ private LoggerInterface $logger) {
}
public function handle(Event $event): void {
} finally {
fclose($stream);
}
- } else if ($event instanceof OutOfOfficeChangedEvent) {
+ } elseif ($event instanceof OutOfOfficeChangedEvent) {
$userId = $event->getData()->getUser()->getUID();
$principal = "principals/users/$userId";
fclose($stream);
}
}
- } else if ($event instanceof OutOfOfficeClearedEvent) {
+ } elseif ($event instanceof OutOfOfficeClearedEvent) {
$userId = $event->getData()->getUser()->getUID();
$principal = "principals/users/$userId";
private LoggerInterface $logger;
public function __construct(IJobList $jobList, RefreshWebcalService $refreshWebcalService, ReminderBackend $reminderBackend,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->jobList = $jobList;
$this->refreshWebcalService = $refreshWebcalService;
$this->reminderBackend = $reminderBackend;
* @param IConfig $config
*/
public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
+ IJobList $jobList,
+ IConfig $config) {
$this->db = $db;
$this->jobList = $jobList;
$this->config = $config;
* @param ITimeFactory $timeFactory
*/
public function __construct(IDBConnection $db,
- CalDavBackend $calDavBackend,
- ILogger $logger,
- IJobList $jobList,
- ITimeFactory $timeFactory) {
+ CalDavBackend $calDavBackend,
+ ILogger $logger,
+ IJobList $jobList,
+ ITimeFactory $timeFactory) {
$this->db = $db;
$this->calDavBackend = $calDavBackend;
$this->logger = $logger;
* @param IConfig $config
*/
public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
+ IJobList $jobList,
+ IConfig $config) {
$this->db = $db;
$this->jobList = $jobList;
$this->config = $config;
* @param ITimeFactory $timeFactory
*/
public function __construct(IDBConnection $db,
- CardDavBackend $davBackend,
- ILogger $logger,
- IJobList $jobList,
- ITimeFactory $timeFactory) {
+ CardDavBackend $davBackend,
+ ILogger $logger,
+ IJobList $jobList,
+ ITimeFactory $timeFactory) {
$this->db = $db;
$this->davBackend = $davBackend;
$this->logger = $logger;
private $jobList;
public function __construct(IConfig $config,
- IUserManager $userManager,
- IRootFolder $rootFolder,
- IJobList $jobList) {
+ IUserManager $userManager,
+ IRootFolder $rootFolder,
+ IJobList $jobList) {
$this->config = $config;
$this->userManager = $userManager;
$this->rootFolder = $rootFolder;
* @param IConfig $config
*/
public function __construct(IJobList $jobList,
- IConfig $config) {
+ IConfig $config) {
$this->jobList = $jobList;
$this->config = $config;
}
* @param IConfig $config
*/
public function __construct(IDBConnection $db,
- IJobList $jobList,
- IConfig $config) {
+ IJobList $jobList,
+ IConfig $config) {
$this->db = $db;
$this->jobList = $jobList;
$this->config = $config;
* @inheritdoc
*/
public function run(IOutput $output) {
- $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid');
+ $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendars', 'calendarid');
$output->info(sprintf('%d events without a calendar have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid');
+ $orphanItems = $this->removeOrphanChildren('calendarobjects_props', 'calendarobjects', 'objectid');
$output->info(sprintf('%d properties without an events have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid');
+ $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendars', 'calendarid');
$output->info(sprintf('%d changes without a calendar have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid');
+ $orphanItems = $this->removeOrphanChildren('calendarobjects', 'calendarsubscriptions', 'calendarid');
$output->info(sprintf('%d cached events without a calendar subscription have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid');
+ $orphanItems = $this->removeOrphanChildren('calendarchanges', 'calendarsubscriptions', 'calendarid');
$output->info(sprintf('%d changes without a calendar subscription have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid');
+ $orphanItems = $this->removeOrphanChildren('cards', 'addressbooks', 'addressbookid');
$output->info(sprintf('%d contacts without an addressbook have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid');
+ $orphanItems = $this->removeOrphanChildren('cards_properties', 'cards', 'cardid');
$output->info(sprintf('%d properties without a contact have been cleaned up', $orphanItems));
- $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid');
+ $orphanItems = $this->removeOrphanChildren('addressbookchanges', 'addressbooks', 'addressbookid');
$output->info(sprintf('%d changes without an addressbook have been cleaned up', $orphanItems));
}
*/
namespace OCA\DAV\Migration;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
if (!$schema->hasTable('directlink')) {
$table = $schema->createTable('directlink');
- $table->addColumn('id',Types::BIGINT, [
+ $table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'length' => 11,
*/
namespace OCA\DAV\Migration;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
*/
namespace OCA\DAV\Migration;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
*/
namespace OCA\DAV\Migration;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OCA\DAV\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OCA\DAV\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
*/
namespace OCA\DAV\Migration;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OCA\DAV\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
*/
namespace OCA\DAV\Migration;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
* @since 17.0.0
*/
public function changeSchema(IOutput $output,
- \Closure $schemaClosure,
- array $options):?ISchemaWrapper {
+ \Closure $schemaClosure,
+ array $options):?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
use OCP\IUserManager;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
-use Psr\Container\ContainerExceptionInterface;
-use Psr\Container\NotFoundExceptionInterface;
use Psr\Log\LoggerInterface;
use Throwable;
class Version1027Date20230504122946 extends SimpleMigrationStep {
public function __construct(private SyncService $syncService,
- private LoggerInterface $logger,
- private IUserManager $userManager,
- private IConfig $config) {}
+ private LoggerInterface $logger,
+ private IUserManager $userManager,
+ private IConfig $config) {
+ }
/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
-<?php declare(strict_types = 1);
+<?php
+
+declare(strict_types = 1);
/**
* @copyright 2021 Carl Schwan <carl@carlschwan.eu>
*
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\IRootFolder;
use OCP\IConfig;
-use OCP\IGroupManager;
use Psr\Log\LoggerInterface;
use Sabre\DAV\SimpleCollection;
* @param CalDavBackend $backend
*/
public function __construct(IAppManager $appManager,
- IL10N $l10n,
- IURLGenerator $urlGenerator,
- CalDavBackend $backend) {
+ IL10N $l10n,
+ IURLGenerator $urlGenerator,
+ CalDavBackend $backend) {
$this->appManager = $appManager;
$this->l10n = $l10n;
$this->urlGenerator = $urlGenerator;
);
$searchResultIndex = array_combine(
- array_map(fn($event) => $event['calendarid'] . '-' . $event['uri'], $searchResults),
+ array_map(fn ($event) => $event['calendarid'] . '-' . $event['uri'], $searchResults),
array_fill(0, count($searchResults), null),
);
foreach ($attendeeSearchResults as $attendeeResult) {
$this->eventDispatcher->dispatchTyped(new OutOfOfficeClearedEvent($eventData));
}
}
-
protected ?string $userId;
public function __construct(IConfig $config,
- IInitialState $initialState,
- ?string $userId,
- private LoggerInterface $logger,
- private IAvailabilityCoordinator $coordinator,
- private AbsenceMapper $absenceMapper) {
+ IInitialState $initialState,
+ ?string $userId,
+ private LoggerInterface $logger,
+ private IAvailabilityCoordinator $coordinator,
+ private AbsenceMapper $absenceMapper) {
$this->config = $config;
$this->initialState = $initialState;
$this->userId = $userId;
use OCA\DAV\AppInfo\Application;
use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
use OCP\AppFramework\Services\IInitialState;
+use OCP\IConfig;
use OCP\IURLGenerator;
use OCP\Settings\IDelegatedSettings;
}
}
- $tags = array_filter(array_map(function(string $tagId) {
+ $tags = array_filter(array_map(function (string $tagId) {
return $this->cachedTags[$tagId] ?? null;
}, $tagIds));
- $uncachedTagIds = array_filter($tagIds, function(string $tagId): bool {
+ $uncachedTagIds = array_filter($tagIds, function (string $tagId): bool {
return !isset($this->cachedTags[$tagId]);
});
$tags += $retrievedTags;
}
- return array_filter($tags, function(ISystemTag $tag) use ($user) {
+ return array_filter($tags, function (ISystemTag $tag) use ($user) {
return $this->tagManager->canUserSeeTag($tag, $user);
});
}
private $cleanupService;
public function __construct(PrincipalBackend\BackendInterface $principalBackend,
- string $principalPrefix,
- CleanupService $cleanupService) {
+ string $principalPrefix,
+ CleanupService $cleanupService) {
parent::__construct($principalBackend, $principalPrefix);
$this->cleanupService = $cleanupService;
}
namespace OCA\DAV\UserMigration;
-use function substr;
use OCA\DAV\AppInfo\Application;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Throwable;
+use function substr;
class CalendarMigrator implements IMigrator, ISizeEstimationMigrator {
namespace OCA\DAV\UserMigration;
-use function sort;
-use function substr;
use OCA\DAV\AppInfo\Application;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\Plugin as CardDAVPlugin;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Throwable;
+use function sort;
+use function substr;
class ContactsMigrator implements IMigrator, ISizeEstimationMigrator {
namespace OCA\DAV\Tests\integration\UserMigration;
-use function scandir;
use OCA\DAV\AppInfo\Application;
use OCA\DAV\UserMigration\CalendarMigrator;
use OCP\AppFramework\App;
use Sabre\VObject\UUIDUtil;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
+use function scandir;
/**
* @group DB
namespace OCA\DAV\Tests\integration\UserMigration;
-use function scandir;
use OCA\DAV\AppInfo\Application;
use OCA\DAV\UserMigration\ContactsMigrator;
use OCP\AppFramework\App;
use Sabre\VObject\UUIDUtil;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
+use function scandir;
/**
* @group DB
*/
namespace OCA\DAV\Tests\unit\CalDAV;
+use OC\KnownUser\KnownUserService;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CalDAV\Proxy\ProxyMapper;
use OCA\DAV\Connector\Sabre\Principal;
use OCP\L10N\IFactory;
use OCP\Security\ISecureRandom;
use OCP\Share\IManager as ShareManager;
-use OC\KnownUser\KnownUserService;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet;
use OCP\Constants;
use PHPUnit\Framework\MockObject\MockObject;
use Sabre\VObject\Component\VCalendar;
-use Sabre\VObject\Component\VEvent;
use Test\TestCase;
class CalendarObjectTest extends TestCase {
$backend->expects($this->once())
->method('createFromString')
- ->with('someid.ics', self::callback(fn($data): bool => preg_match('/BEGIN:VEVENT(.|\r\n)+STATUS:CANCELLED/', $data) === 1));
+ ->with('someid.ics', self::callback(fn ($data): bool => preg_match('/BEGIN:VEVENT(.|\r\n)+STATUS:CANCELLED/', $data) === 1));
$calendarObject->delete();
}
use OCA\DAV\CalDAV\EventComparisonService;
use Sabre\VObject\Component\VCalendar;
-use Sabre\VObject\Component\VEvent;
use Test\TestCase;
-class EventComparisonServiceTest extends TestCase
-{
+class EventComparisonServiceTest extends TestCase {
/** @var EventComparisonService */
private $eventComparisonService;
- protected function setUp(): void
- {
+ protected function setUp(): void {
$this->eventComparisonService = new EventComparisonService();
}
- public function testNoModifiedEvent(): void
- {
+ public function testNoModifiedEvent(): void {
$vCalendarOld = new VCalendar();
$vCalendarNew = new VCalendar();
$this->assertEmpty($result['new']);
}
- public function testNewEvent(): void
- {
+ public function testNewEvent(): void {
$vCalendarOld = null;
$vCalendarNew = new VCalendar();
$this->assertEquals([$vEventNew], $result['new']);
}
- public function testModifiedUnmodifiedEvent(): void
- {
+ public function testModifiedUnmodifiedEvent(): void {
$vCalendarOld = new VCalendar();
$vCalendarNew = new VCalendar();
$config = $this->createMock(IConfig::class);
/** @var MockObject | LoggerInterface $logger */
$logger = $this->createMock(LoggerInterface::class);
- $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config,$logger);
+ $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger);
$children = $c->getChildren();
$this->assertEquals(2, count($children));
$children = $c->getMultipleChildren(['event-0', 'event-1', 'event-2']);
$config = $this->createMock(IConfig::class);
/** @var MockObject | LoggerInterface $logger */
$logger = $this->createMock(LoggerInterface::class);
- $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config,$logger);
+ $c = new PublicCalendar($backend, $calendarInfo, $this->l10n, $config, $logger);
$this->assertEquals(count($c->getChildren()), 2);
$this->timeFactory->expects($this->once())
->method('getDateTime')
->with()
- ->willReturn(DateTime::createFromFormat(DateTime::ATOM, '2023-02-03T13:28:00+00:00'));;
+ ->willReturn(DateTime::createFromFormat(DateTime::ATOM, '2023-02-03T13:28:00+00:00'));
+ ;
$this->reminderService->onCalendarObjectCreate($objectData);
}
use Sabre\VObject\Component\VCalendar;
use Sabre\VObject\Component\VEvent;
use Sabre\VObject\ITip\Message;
-use Sabre\VObject\Property;
use Test\TestCase;
use function array_merge;
->willReturn('yes');
$this->service->expects(self::once())
->method('createInvitationToken')
- ->with($message,$newVevent, '1496912700')
+ ->with($message, $newVevent, '1496912700')
->willReturn('token');
$this->service->expects(self::once())
->method('addResponseButtons')
use Sabre\VObject\Property\ICalendar\DateTime;
use Test\TestCase;
-class IMipServiceTest extends TestCase
-{
+class IMipServiceTest extends TestCase {
/** @var URLGenerator|MockObject */
private $urlGenerator;
/** @var IMipService */
private $service;
- protected function setUp(): void
- {
+ protected function setUp(): void {
$this->urlGenerator = $this->createMock(URLGenerator::class);
$this->config = $this->createMock(IConfig::class);
$this->db = $this->createMock(IDBConnection::class);
);
}
- public function testGetFrom(): void
- {
+ public function testGetFrom(): void {
$senderName = "Detective McQueen";
$default = "Twin Lakes Police Department - Darkside Division";
$expected = "Detective McQueen via Twin Lakes Police Department - Darkside Division";
$this->assertEquals($expected, $actual);
}
- public function testBuildBodyDataCreated(): void
- {
+ public function testBuildBodyDataCreated(): void {
$vCalendar = new VCalendar();
$oldVevent = null;
$newVevent = new VEvent($vCalendar, 'two', [
$this->assertEquals($expected, $actual);
}
- public function testBuildBodyDataUpdate(): void
- {
+ public function testBuildBodyDataUpdate(): void {
$vCalendar = new VCalendar();
$oldVevent = new VEvent($vCalendar, 'two', [
'UID' => 'uid-1234',
$this->assertEquals($expected, $actual);
}
- public function testGetLastOccurrenceRRULE(): void
- {
+ public function testGetLastOccurrenceRRULE(): void {
$vCalendar = new VCalendar();
$vCalendar->add('VEVENT', [
'UID' => 'uid-1234',
$this->assertEquals(1454284800, $occurrence);
}
- public function testGetLastOccurrenceEndDate(): void
- {
+ public function testGetLastOccurrenceEndDate(): void {
$vCalendar = new VCalendar();
$vCalendar->add('VEVENT', [
'UID' => 'uid-1234',
$this->assertEquals(1483228800, $occurrence);
}
- public function testGetLastOccurrenceDuration(): void
- {
+ public function testGetLastOccurrenceDuration(): void {
$vCalendar = new VCalendar();
$vCalendar->add('VEVENT', [
'UID' => 'uid-1234',
$this->assertEquals(1458864000, $occurrence);
}
- public function testGetLastOccurrenceAllDay(): void
- {
+ public function testGetLastOccurrenceAllDay(): void {
$vCalendar = new VCalendar();
$vEvent = $vCalendar->add('VEVENT', [
'UID' => 'uid-1234',
$this->assertEquals(1451692800, $occurrence);
}
- public function testGetLastOccurrenceFallback(): void
- {
+ public function testGetLastOccurrenceFallback(): void {
$vCalendar = new VCalendar();
$vCalendar->add('VEVENT', [
'UID' => 'uid-1234',
use OCA\DAV\CardDAV\AddressBook;
use OCA\DAV\CardDAV\Card;
use OCA\DAV\CardDAV\CardDavBackend;
-use OCA\DAV\DAV\CustomPropertiesBackend;
use OCP\IL10N;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
-use OCP\IURLGenerator;
use OCP\IImage;
+use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
$this->shareManager->expects($this->once())
->method('checkPassword')->with(
- $this->equalTo($share),
- $this->equalTo('password')
- )->willReturn(true);
+ $this->equalTo($share),
+ $this->equalTo('password')
+ )->willReturn(true);
$result = $this->invokePrivate($this->auth, 'validateUserPass', ['username', 'password']);
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin;
use OCP\IConfig;
use PHPUnit\Framework\MockObject\MockObject;
-use Test\TestCase;
use Sabre\HTTP\RequestInterface;
+use Test\TestCase;
/**
* Class BlockLegacyClientPluginTest
public function testSerialization(): void {
// create xml doc
- $DOM = new \DOMDocument('1.0','utf-8');
+ $DOM = new \DOMDocument('1.0', 'utf-8');
$DOM->formatOutput = true;
- $error = $DOM->createElementNS('DAV:','d:error');
+ $error = $DOM->createElementNS('DAV:', 'd:error');
$error->setAttribute('xmlns:s', \Sabre\DAV\Server::NS_SABREDAV);
$DOM->appendChild($error);
public function testSerialization(): void {
// create xml doc
- $DOM = new \DOMDocument('1.0','utf-8');
+ $DOM = new \DOMDocument('1.0', 'utf-8');
$DOM->formatOutput = true;
- $error = $DOM->createElementNS('DAV:','d:error');
+ $error = $DOM->createElementNS('DAV:', 'd:error');
$error->setAttribute('xmlns:s', \Sabre\DAV\Server::NS_SABREDAV);
$DOM->appendChild($error);
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
-use OC\Log;
use OC\SystemConfig;
use OCA\DAV\Connector\Sabre\Exception\InvalidPath;
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
use OCA\DAV\Exception\ServerMaintenanceMode;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\NotFound;
-use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\Server;
use Test\TestCase;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\Storage;
use OCP\ICache;
-use OCP\Share\IAttributes;
use OCP\Share\IManager;
use OCP\Share\IShare;
$info->method('getInternalPath')
->willReturn($internalPath);
$info->method('getMountPoint')
- ->willReturnCallback(function() use ($shared) {
+ ->willReturnCallback(function () use ($shared) {
if ($shared) {
return $this->createMock(SharedMount::class);
} else {
*/
namespace OCA\DAV\Tests\unit\DAV;
+use OCA\DAV\Connector\Sabre\Exception\Forbidden;
+use OCA\DAV\Connector\Sabre\File as DavFile;
use OCA\DAV\DAV\ViewOnlyPlugin;
use OCA\Files_Sharing\SharedStorage;
-use OCA\DAV\Connector\Sabre\File as DavFile;
-use OCA\Files_Versions\Versions\IVersion;
use OCA\Files_Versions\Sabre\VersionFile;
+use OCA\Files_Versions\Versions\IVersion;
use OCP\Files\File;
use OCP\Files\Storage\IStorage;
use OCP\Share\IAttributes;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Server;
use Sabre\DAV\Tree;
-use Test\TestCase;
use Sabre\HTTP\RequestInterface;
-use OCA\DAV\Connector\Sabre\Exception\Forbidden;
+use Test\TestCase;
class ViewOnlyPluginTest extends TestCase {
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
use OC\Files\View;
-use OCA\DAV\Connector\Sabre\ObjectTree;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Connector\Sabre\File;
use OCA\DAV\Connector\Sabre\FilesPlugin;
+use OCA\DAV\Connector\Sabre\ObjectTree;
use OCA\DAV\Files\FileSearchBackend;
use OCP\Files\FileInfo;
use OCP\Files\Folder;
namespace OCA\DAV\Tests\unit\DAV;
-use Test\TestCase;
use \OCA\DAV\BulkUpload\MultipartRequestParser;
+use Test\TestCase;
class MultipartRequestParserTest extends TestCase {
private function getValidBodyObject() {
$body .= '--'.$boundary."--";
- $stream = fopen('php://temp','r+');
+ $stream = fopen('php://temp', 'r+');
fwrite($stream, $body);
rewind($stream);
$user->method('getUID')->willReturn('john.doe');
$query = $this->createMock(ISearchQuery::class);
$seachTermFilter = $this->createMock(IFilter::class);
- $query->method('getFilter')->willReturnCallback(function($name) use ($seachTermFilter) {
+ $query->method('getFilter')->willReturnCallback(function ($name) use ($seachTermFilter) {
return match ($name) {
'term' => $seachTermFilter,
default => null,
use OCA\DAV\Settings\CalDAVSettings;
use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
use OCP\AppFramework\Services\IInitialState;
+use OCP\IConfig;
use OCP\IURLGenerator;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
public function testGetForm(): void {
$this->config->method('getAppValue')
->withConsecutive(
- ['dav', 'sendInvitations', 'yes'],
- ['dav', 'generateBirthdayCalendar', 'yes'],
- ['dav', 'sendEventReminders', 'yes'],
- ['dav', 'sendEventRemindersToSharedUsers', 'yes'],
- ['dav', 'sendEventRemindersPush', 'yes'],
+ ['dav', 'sendInvitations', 'yes'],
+ ['dav', 'generateBirthdayCalendar', 'yes'],
+ ['dav', 'sendEventReminders', 'yes'],
+ ['dav', 'sendEventRemindersToSharedUsers', 'yes'],
+ ['dav', 'sendEventRemindersPush', 'yes'],
)
->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes'));
$this->urlGenerator
$tonofnodes = [];
$tonofdata = "";
for ($i = 0; $i < 101; $i++) {
- $thisdata = rand(0,100); // variable length and content
+ $thisdata = rand(0, 100); // variable length and content
$tonofdata .= $thisdata;
- array_push($tonofnodes, $this->buildNode($i,$thisdata));
+ array_push($tonofnodes, $this->buildNode($i, $thisdata));
}
return[
* @param QuestionHelper $questionHelper
*/
public function __construct(Util $util,
- IConfig $config,
- QuestionHelper $questionHelper) {
+ IConfig $config,
+ QuestionHelper $questionHelper) {
$this->util = $util;
$this->config = $config;
$this->questionHelper = $questionHelper;
* @param QuestionHelper $questionHelper
*/
public function __construct(Util $util,
- IConfig $config,
- QuestionHelper $questionHelper) {
+ IConfig $config,
+ QuestionHelper $questionHelper) {
$this->util = $util;
$this->config = $config;
$this->questionHelper = $questionHelper;
use OCP\Encryption\IManager;
use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Config\IUserMountCache;
-use OCP\Files\Folder;
use OCP\Files\File;
+use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\IUser;
* @param QuestionHelper $questionHelper
*/
public function __construct(Util $util,
- IConfig $config,
- IUserManager $userManager,
- QuestionHelper $questionHelper) {
+ IConfig $config,
+ IUserManager $userManager,
+ QuestionHelper $questionHelper) {
$this->util = $util;
$this->questionHelper = $questionHelper;
$this->userManager = $userManager;
* @param QuestionHelper $questionHelper
*/
public function __construct(Util $util,
- IConfig $config,
- QuestionHelper $questionHelper,
- IUserManager $userManager) {
+ IConfig $config,
+ QuestionHelper $questionHelper,
+ IUserManager $userManager) {
parent::__construct();
$this->util = $util;
* @param Recovery $recovery
*/
public function __construct($AppName,
- IRequest $request,
- IConfig $config,
- IL10N $l10n,
- Recovery $recovery) {
+ IRequest $request,
+ IConfig $config,
+ IL10N $l10n,
+ Recovery $recovery) {
parent::__construct($AppName, $request);
$this->config = $config;
$this->l = $l10n;
* @param Util $util
*/
public function __construct($AppName,
- IRequest $request,
- IL10N $l10n,
- IUserManager $userManager,
- IUserSession $userSession,
- KeyManager $keyManager,
- Crypt $crypt,
- Session $session,
- ISession $ocSession,
- Util $util
-) {
+ IRequest $request,
+ IL10N $l10n,
+ IUserManager $userManager,
+ IUserSession $userSession,
+ KeyManager $keyManager,
+ Crypt $crypt,
+ Session $session,
+ ISession $ocSession,
+ Util $util
+ ) {
parent::__construct($AppName, $request);
$this->l = $l10n;
$this->userSession = $userSession;
* @param IManager $encryptionManager
*/
public function __construct($AppName,
- IRequest $request,
- IL10N $l10n,
- Session $session,
- IManager $encryptionManager
- ) {
+ IRequest $request,
+ IL10N $l10n,
+ Session $session,
+ IManager $encryptionManager
+ ) {
parent::__construct($AppName, $request);
$this->l = $l10n;
$this->session = $session;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IUserSession;
-use Psr\Log\LoggerInterface;
use phpseclib\Crypt\RC4;
+use Psr\Log\LoggerInterface;
/**
* Class Crypt provides the encryption implementation of the default Nextcloud
$this->logger->error('Encryption could not update users encryption password');
}
- // NOTE: Session does not need to be updated as the
- // private key has not changed, only the passphrase
- // used to decrypt it has changed
+ // NOTE: Session does not need to be updated as the
+ // private key has not changed, only the passphrase
+ // used to decrypt it has changed
} else { // admin changed the password for a different user, create new keys and re-encrypt file keys
$userId = $params['uid'];
$this->initMountPoints($userId);
* @param View $view
*/
public function __construct(IUserSession $userSession,
- Crypt $crypt,
- KeyManager $keyManager,
- IConfig $config,
- IFile $file,
- View $view) {
+ Crypt $crypt,
+ KeyManager $keyManager,
+ IConfig $config,
+ IFile $file,
+ View $view) {
$this->user = ($userSession->isLoggedIn()) ? $userSession->getUser() : null;
$this->crypt = $crypt;
$this->keyManager = $keyManager;
private $keyManager;
public function __construct(Crypt $crypt,
- KeyManager $keyManager) {
+ KeyManager $keyManager) {
$this->crypt = $crypt;
$this->keyManager = $keyManager;
}
<p id="encryptHomeStorageSetting">
<input type="checkbox" class="checkbox" name="encrypt_home_storage" id="encryptHomeStorage"
value="1" <?php if ($_['encryptHomeStorage']) {
- print_unescaped('checked="checked"');
-} ?> />
+ print_unescaped('checked="checked"');
+ } ?> />
<label for="encryptHomeStorage"><?php p($l->t('Encrypt the home storage'));?></label></br>
<em><?php p($l->t("Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted")); ?></em>
</p>
<br/><br/>
<p name="changeRecoveryPasswordBlock" id="encryptionChangeRecoveryKey" <?php if ($_['recoveryEnabled'] === '0') {
- print_unescaped('class="hidden"');
-}?>>
+ print_unescaped('class="hidden"');
+ }?>>
<?php p($l->t("Change recovery key password:")); ?>
<span class="msg"></span>
<br/>
<?php
- /** @var array $_ */
- /** @var \OCP\IL10N $l */
+/** @var array $_ */
+/** @var \OCP\IL10N $l */
script('encryption', 'settings-personal');
?>
<form id="ocDefaultEncryptionModule" class="section">
<br />
<?php p($l->t("Set your old private key password to your current log-in password:")); ?>
<?php if ($_["recoveryEnabledForUser"]):
- p($l->t(" If you don't remember your old password you can ask your administrator to recover your files."));
+ p($l->t(" If you don't remember your old password you can ask your administrator to recover your files."));
endif; ?>
<br />
<input
use OCA\Encryption\Crypto\Crypt;
use OCP\IConfig;
use OCP\IL10N;
-use Psr\Log\LoggerInterface;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class CryptTest extends TestCase {
use OCA\Encryption\Session;
use OCA\Encryption\Users\Setup;
use OCA\Encryption\Util;
-use Psr\Log\LoggerInterface;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
/**
use OCP\Files\Cache\ICache;
use OCP\Files\Storage;
use OCP\IConfig;
-use Psr\Log\LoggerInterface;
use OCP\IUserSession;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class KeyManagerTest extends TestCase {
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IL10N;
-use Psr\Log\LoggerInterface;
use OCP\ISession;
use OCP\IUserManager;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class AdminTest extends TestCase {
}
private function registerCloudFederationProvider(ICloudFederationProviderManager $manager,
- IAppContainer $appContainer): void {
+ IAppContainer $appContainer): void {
$manager->addCloudFederationProvider('file',
'Federated Files Sharing',
function () use ($appContainer): CloudFederationProviderFiles {
private int $interval = 600;
public function __construct(Notifications $notifications,
- ITimeFactory $time) {
+ ITimeFactory $time) {
parent::__construct($time);
$this->notifications = $notifications;
}
use OCA\FederatedFileSharing\AddressHandler;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\FederatedFileSharing\Notifications;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\AppFramework\OCS\OCSException;
use OCP\AppFramework\OCSController;
-use OCP\App\IAppManager;
use OCP\Constants;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\Exceptions\ProviderCouldNotAddShareException;
private $eventDispatcher;
public function __construct(string $appName,
- IRequest $request,
- FederatedShareProvider $federatedShareProvider,
- IDBConnection $connection,
- Share\IManager $shareManager,
- Notifications $notifications,
- AddressHandler $addressHandler,
- IUserManager $userManager,
- ICloudIdManager $cloudIdManager,
- LoggerInterface $logger,
- ICloudFederationFactory $cloudFederationFactory,
- ICloudFederationProviderManager $cloudFederationProviderManager,
- IEventDispatcher $eventDispatcher
+ IRequest $request,
+ FederatedShareProvider $federatedShareProvider,
+ IDBConnection $connection,
+ Share\IManager $shareManager,
+ Notifications $notifications,
+ AddressHandler $addressHandler,
+ IUserManager $userManager,
+ ICloudIdManager $cloudIdManager,
+ LoggerInterface $logger,
+ ICloudFederationFactory $cloudFederationFactory,
+ ICloudFederationProviderManager $cloudFederationProviderManager,
+ IEventDispatcher $eventDispatcher
) {
parent::__construct($appName, $request);
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file');
$provider->shareReceived($share);
if ($sharedByFederatedId === $ownerFederatedId) {
- $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was created by "%s" and shared with "%s"', [$name, $ownerFederatedId, $shareWith]));
+ $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was created by "%s" and shared with "%s"', [$name, $ownerFederatedId, $shareWith]));
} else {
- $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was shared by "%s" (resource owner is: "%s") and shared with "%s"', [$name, $sharedByFederatedId, $ownerFederatedId, $shareWith]));
+ $this->eventDispatcher->dispatchTyped(new CriticalActionPerformedEvent('A new federated share with "%s" was shared by "%s" (resource owner is: "%s") and shared with "%s"', [$name, $sharedByFederatedId, $ownerFederatedId, $shareWith]));
}
} catch (ProviderDoesNotExistsException $e) {
throw new OCSException('Server does not support federated cloud sharing', 503);
* DefaultShareProvider constructor.
*/
public function __construct(
- private IDBConnection $dbConnection,
- private AddressHandler $addressHandler,
- private Notifications $notifications,
- private TokenHandler $tokenHandler,
- private IL10N $l,
- private IRootFolder $rootFolder,
- private IConfig $config,
- private IUserManager $userManager,
- private ICloudIdManager $cloudIdManager,
- private \OCP\GlobalScale\IConfig $gsConfig,
- private ICloudFederationProviderManager $cloudFederationProviderManager,
- private LoggerInterface $logger,
+ private IDBConnection $dbConnection,
+ private AddressHandler $addressHandler,
+ private Notifications $notifications,
+ private TokenHandler $tokenHandler,
+ private IL10N $l,
+ private IRootFolder $rootFolder,
+ private IConfig $config,
+ private IUserManager $userManager,
+ private ICloudIdManager $cloudIdManager,
+ private \OCP\GlobalScale\IConfig $gsConfig,
+ private ICloudFederationProviderManager $cloudFederationProviderManager,
+ private LoggerInterface $logger,
) {
}
namespace OCA\FederatedFileSharing\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
'default' => '',
]);
$table->setPrimaryKey(['share_id'], 'federated_res_pk');
-// $table->addUniqueIndex(['share_id'], 'share_id_index');
+ // $table->addUniqueIndex(['share_id'], 'share_id_index');
}
return $schema;
}
use Closure;
use Doctrine\DBAL\Types\Type;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Defaults;
-use OCP\IUserSession;
use OCP\IURLGenerator;
+use OCP\IUserSession;
use OCP\Settings\ISettings;
class Personal implements ISettings {
use OC\Federation\CloudIdManager;
use OCA\FederatedFileSharing\AddressHandler;
use OCP\Contacts\IManager;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\ICacheFactory;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\IUserManager;
-use OCP\EventDispatcher\IEventDispatcher;
class AddressHandlerTest extends \Test\TestCase {
/** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
use OCP\IUserSession;
use OCP\Share\IManager;
use OCP\Share\IShare;
-use Psr\Log\LoggerInterface;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
class MountPublicLinkControllerTest extends \Test\TestCase {
/** @var IContactsManager|MockObject */
* @param string $expectedReturnData
*/
public function testCreateFederatedShare($shareWith,
- $outgoingSharesAllowed,
- $validShareWith,
- $token,
- $validToken,
- $createSuccessful,
- $expectedReturnData,
- $permissions
+ $outgoingSharesAllowed,
+ $validShareWith,
+ $token,
+ $validToken,
+ $createSuccessful,
+ $expectedReturnData,
+ $permissions
) {
$this->federatedShareProvider->expects($this->any())
->method('isOutgoingServer2serverShareEnabled')
use OCA\FederatedFileSharing\Controller\RequestHandlerController;
use OCP\AppFramework\Http\DataResponse;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudFederationFactory;
use OCP\Federation\ICloudFederationProvider;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\Federation\ICloudFederationShare;
use OCP\Federation\ICloudIdManager;
-use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDBConnection;
use OCP\IRequest;
use OCP\IUserManager;
public function testCreateShare() {
$this->cloudFederationFactory->expects($this->once())->method('getCloudFederationShare')
->with(
- $this->user2,
- 'name',
- '',
- 1,
- $this->ownerCloudId,
- $this->owner,
- $this->user1CloudId,
- $this->user1,
- 'token',
- 'user',
- 'file'
+ $this->user2,
+ 'name',
+ '',
+ 1,
+ $this->ownerCloudId,
+ $this->owner,
+ $this->user1CloudId,
+ $this->user1,
+ 'token',
+ 'user',
+ 'file'
)->willReturn($this->cloudFederationShare);
/** @var ICloudFederationProvider|\PHPUnit\Framework\MockObject\MockObject $provider */
$deadline = $currentTime - $this->maxLifespan;
if ($created < $deadline) {
$this->retainJob = false;
- $this->trustedServers->setServerStatus($target,TrustedServers::STATUS_FAILURE);
+ $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE);
return;
}
$result = json_decode($body, true);
if (isset($result['ocs']['data']['sharedSecret'])) {
$this->trustedServers->addSharedSecret(
- $target,
- $result['ocs']['data']['sharedSecret']
+ $target,
+ $result['ocs']['data']['sharedSecret']
);
} else {
$this->logger->error(
*/
namespace OCA\Federation\Command;
+use OCA\Federation\SyncFederationAddressBooks as SyncService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use OCA\Federation\SyncFederationAddressBooks as SyncService;
class SyncFederationAddressBooks extends Command {
private SyncService $syncService;
private TrustedServers $trustedServers;
public function __construct(string $AppName,
- IRequest $request,
- IL10N $l10n,
- TrustedServers $trustedServers
+ IRequest $request,
+ IL10N $l10n,
+ TrustedServers $trustedServers
) {
parent::__construct($AppName, $request);
$this->l = $l10n;
namespace OCA\Federation;
use OC\Files\Filesystem;
-use OCP\HintException;
-use OCP\IDBConnection;
use OCP\DB\Exception as DBException;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\HintException;
+use OCP\IDBConnection;
use OCP\IL10N;
/**
namespace OCA\Federation\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
private LoggerInterface $logger;
public function __construct(DbHandler $dbHandler,
- SyncService $syncService,
- IDiscoveryService $ocsDiscoveryService,
- LoggerInterface $logger
+ SyncService $syncService,
+ IDiscoveryService $ocsDiscoveryService,
+ LoggerInterface $logger
) {
$this->syncService = $syncService;
$this->dbHandler = $dbHandler;
*/
namespace OCA\Federation;
-use OCP\BackgroundJob\TimedJob;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use Psr\Log\LoggerInterface;
class SyncJob extends TimedJob {
use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Federation\Events\TrustedServerRemovedEvent;
use OCP\HintException;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\Security\ISecureRandom;
-use OCP\DB\Exception as DBException;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Federation\Events\TrustedServerRemovedEvent;
use Psr\Log\LoggerInterface;
class TrustedServers {
use OCP\AppFramework\Http;
use OCP\HintException;
use OCP\IL10N;
-use Test\TestCase;
use Psr\Log\LoggerInterface;
+use Test\TestCase;
class AddServerMiddlewareTest extends TestCase {
*/
namespace OCA\Federation\Tests;
-use Psr\Log\LoggerInterface;
use OC\OCS\DiscoveryService;
use OCA\Federation\DbHandler;
use OCA\Federation\SyncFederationAddressBooks;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
class SyncFederationAddressbooksTest extends \Test\TestCase {
use OCA\Federation\TrustedServers;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
use OCP\IConfig;
use OCP\Security\ISecureRandom;
-use OCP\EventDispatcher\IEventDispatcher;
-use Test\TestCase;
use Psr\Log\LoggerInterface;
+use Test\TestCase;
class TrustedServersTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | TrustedServers */
protected $fileIsEncrypted = false;
public function __construct(IFactory $languageFactory,
- IURLGenerator $url,
- IManager $activityManager,
- IUserManager $userManager,
- IRootFolder $rootFolder,
- ICloudIdManager $cloudIdManager,
- IContactsManager $contactsManager,
- IEventMerger $eventMerger) {
+ IURLGenerator $url,
+ IManager $activityManager,
+ IUserManager $userManager,
+ IRootFolder $rootFolder,
+ ICloudIdManager $cloudIdManager,
+ IContactsManager $contactsManager,
+ IEventMerger $eventMerger) {
$this->languageFactory = $languageFactory;
$this->url = $url;
$this->activityManager = $activityManager;
use OCA\Files\Collaboration\Resources\ResourceProvider;
use OCA\Files\Controller\ApiController;
use OCA\Files\DirectEditingCapabilities;
-use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
use OCA\Files\Listener\LoadSidebarListener;
use OCA\Files\Listener\RenderReferenceEventListener;
use OCP\Collaboration\Resources\IProviderManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
-use OCP\IL10N;
use OCP\IPreview;
-use OCP\ISearch;
use OCP\IRequest;
+use OCP\ISearch;
use OCP\IServerContainer;
use OCP\ITagManager;
use OCP\IUserSession;
private IManager $manager;
public function __construct(ITimeFactory $time,
- IManager $manager) {
+ IManager $manager) {
parent::__construct($time);
$this->interval = self::INTERVAL_MINUTES;
$this->manager = $manager;
*/
namespace OCA\Files\BackgroundJob;
+use OC\Lock\DBLockingProvider;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
-use OC\Lock\DBLockingProvider;
/**
* Clean up all file locks that are expired for the DB file locking provider
namespace OCA\Files\BackgroundJob;
-use OCA\Files\Controller\OpenLocalEditorController;
use OCA\Files\Db\OpenLocalEditorMapper;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob;
private NotificationManager $notificationManager,
private TransferOwnershipMapper $mapper,
private IRootFolder $rootFolder,
- ) {
+ ) {
parent::__construct($timeFactory);
}
*/
namespace OCA\Files\Collaboration\Resources;
+use OCP\Collaboration\Resources\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Server;
-use OCP\Collaboration\Resources\IManager;
use OCP\Share\Events\ShareCreatedEvent;
use OCP\Share\Events\ShareDeletedEvent;
use OCP\Share\Events\ShareDeletedFromSelfEvent;
protected $nodes = [];
public function __construct(IRootFolder $rootFolder,
- IPreview $preview,
- IURLGenerator $urlGenerator) {
+ IPreview $preview,
+ IURLGenerator $urlGenerator) {
$this->rootFolder = $rootFolder;
$this->preview = $preview;
$this->urlGenerator = $urlGenerator;
use OC\Core\Command\Info\FileUtils;
use OCP\Files\Folder;
-use OCP\Files\File;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
namespace OCA\Files\Command;
-
use OC\Core\Command\Info\FileUtils;
use OCP\Files\File;
use Symfony\Component\Console\Command\Command;
namespace OCA\Files\Command;
use OC\Core\Command\Info\FileUtils;
-use OCP\Files\Folder;
use OCP\Files\File;
+use OCP\Files\Folder;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
namespace OCA\Files\Command\Object;
-use OCP\DB\QueryBuilder\IQueryBuilder;
-use OCP\IDBConnection;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
namespace OCA\Files\Command\Object;
-use OCP\Files\File;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
->setDescription('Write a file to the object store')
->addArgument('input', InputArgument::REQUIRED, "Source local path, use - to read from STDIN")
->addArgument('object', InputArgument::REQUIRED, "Object to write")
- ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket where to store the object, only required in cases where it can't be determined from the config");;
+ ->addOption('bucket', 'b', InputOption::VALUE_REQUIRED, "Bucket where to store the object, only required in cases where it can't be determined from the config");
+ ;
}
public function execute(InputInterface $input, OutputInterface $output): int {
namespace OCA\Files\Command;
-
use OC\Core\Command\Info\FileUtils;
use OCP\Files\File;
use OCP\Files\Folder;
++$this->errorsCounter;
});
- $this->eventDispatcher->addListener(NodeAddedToCache::class, function() {
+ $this->eventDispatcher->addListener(NodeAddedToCache::class, function () {
++$this->newCounter;
});
- $this->eventDispatcher->addListener(FileCacheUpdated::class, function() {
+ $this->eventDispatcher->addListener(FileCacheUpdated::class, function () {
++$this->updatedCounter;
});
- $this->eventDispatcher->addListener(NodeRemovedFromCache::class, function() {
+ $this->eventDispatcher->addListener(NodeRemovedFromCache::class, function () {
++$this->removedCounter;
});
use OCA\Files\Exception\TransferOwnershipException;
use OCA\Files\Service\OwnershipTransferService;
+use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
-use OCP\IConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
InputOption::VALUE_OPTIONAL,
'transfer incoming user file shares to destination user. Usage: --transfer-incoming-shares=1 (value required)',
'2'
- );
+ );
}
protected function execute(InputInterface $input, OutputInterface $output): int {
private ViewConfig $viewConfig;
public function __construct(string $appName,
- IRequest $request,
- IUserSession $userSession,
- TagService $tagService,
- IPreview $previewManager,
- IManager $shareManager,
- IConfig $config,
- ?Folder $userFolder,
- UserConfig $userConfig,
- ViewConfig $viewConfig) {
+ IRequest $request,
+ IUserSession $userSession,
+ TagService $tagService,
+ IPreview $previewManager,
+ IManager $shareManager,
+ IConfig $config,
+ ?Folder $userFolder,
+ UserConfig $userConfig,
+ ViewConfig $viewConfig) {
parent::__construct($appName, $request);
$this->userSession = $userSession;
$this->tagService = $tagService;
private IManager $directEditingManager,
private DirectEditingService $directEditingService,
private LoggerInterface $logger
- ) {
+ ) {
parent::__construct($appName, $request, $corsMethods, $corsAllowedHeaders, $corsMaxAge);
}
$templatePath = $this->templateManager->initializeTemplateDirectory($templatePath, null, $copySystemTemplates);
return new DataResponse([
'template_path' => $templatePath,
- 'templates' => array_map(fn(TemplateFileCreator $creator) => $creator->jsonSerialize(), $this->templateManager->listCreators()),
+ 'templates' => array_map(fn (TemplateFileCreator $creator) => $creator->jsonSerialize(), $this->templateManager->listCreators()),
]);
} catch (\Exception $e) {
throw new OCSForbiddenException($e->getMessage());
use OCA\Files\BackgroundJob\TransferOwnership;
use OCA\Files\Db\TransferOwnership as TransferOwnershipEntity;
use OCA\Files\Db\TransferOwnershipMapper;
-use OCP\Files\IHomeStorage;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
+use OCP\Files\IHomeStorage;
use OCP\Files\IRootFolder;
use OCP\IRequest;
use OCP\IUserManager;
private $rootFolder;
public function __construct(string $appName,
- IRequest $request,
- string $userId,
- NotificationManager $notificationManager,
- ITimeFactory $timeFactory,
- IJobList $jobList,
- TransferOwnershipMapper $mapper,
- IUserManager $userManager,
- IRootFolder $rootFolder) {
+ IRequest $request,
+ string $userId,
+ NotificationManager $notificationManager,
+ ITimeFactory $timeFactory,
+ IJobList $jobList,
+ TransferOwnershipMapper $mapper,
+ IUserManager $userManager,
+ IRootFolder $rootFolder) {
parent::__construct($appName, $request);
$this->userId = $userId;
*/
namespace OCA\Files\Controller;
-use OC\AppFramework\Http;
use OCA\Files\Activity\Helper;
use OCA\Files\AppInfo\Application;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
if ($fileid !== null && $view !== 'trashbin') {
try {
return $this->redirectToFileIfInTrashbin((int) $fileid);
- } catch (NotFoundException $e) {}
+ } catch (NotFoundException $e) {
+ }
}
// Load the files we need
try {
// If view is files, we use the directory, otherwise we use the root storage
- $storageInfo = $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/');
+ $storageInfo = $this->getStorageInfo(($view === 'files' && $dir) ? $dir : '/');
} catch(\Exception $e) {
$storageInfo = $this->getStorageInfo();
}
try {
$this->redirectToFileIfInTrashbin($fileId);
- } catch (NotFoundException $e) {}
+ } catch (NotFoundException $e) {
+ }
if (!empty($nodes)) {
$node = current($nodes);
*
* @since 17.0.0
*/
-class LoadAdditionalScriptsEvent extends Event {}
\ No newline at end of file
+class LoadAdditionalScriptsEvent extends Event {
+}
$schema = $schemaClosure();
$table = $schema->createTable('open_local_editor');
- $table->addColumn('id',Types::BIGINT, [
+ $table->addColumn('id', Types::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'length' => 20,
private $timeFactory;
public function __construct(IFactory $l10nFactory,
- IURLGenerator $urlGenerator,
- TransferOwnershipMapper $mapper,
- IManager $notificationManager,
- IUserManager $userManager,
- ITimeFactory $timeFactory) {
+ IURLGenerator $urlGenerator,
+ TransferOwnershipMapper $mapper,
+ IManager $notificationManager,
+ IUserManager $userManager,
+ ITimeFactory $timeFactory) {
$this->l10nFactory = $l10nFactory;
$this->urlGenerator = $urlGenerator;
$this->mapper = $mapper;
<?php
+
declare(strict_types=1);
/**
namespace OCA\Files\Search;
use InvalidArgumentException;
-use OCP\Files\Search\ISearchOperator;
-use OCP\IPreview;
-use OCP\Search\FilterDefinition;
-use OCP\Search\IFilter;
-use OCP\Search\IFilteringProvider;
-use OCP\Share\IShare;
use OC\Files\Search\SearchBinaryOperator;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchOrder;
use OC\Files\Search\SearchQuery;
+use OC\Search\Filter\GroupFilter;
+use OC\Search\Filter\UserFilter;
use OCP\Files\FileInfo;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\Search\ISearchComparison;
+use OCP\Files\Search\ISearchOperator;
use OCP\Files\Search\ISearchOrder;
use OCP\IL10N;
+use OCP\IPreview;
use OCP\IURLGenerator;
use OCP\IUser;
+use OCP\Search\FilterDefinition;
+use OCP\Search\IFilter;
+use OCP\Search\IFilteringProvider;
use OCP\Search\ISearchQuery;
use OCP\Search\SearchResult;
use OCP\Search\SearchResultEntry;
-use OC\Search\Filter\GroupFilter;
-use OC\Search\Filter\UserFilter;
+use OCP\Share\IShare;
class FilesSearchProvider implements IFilteringProvider {
/** @var IL10N */
private $userManager;
public function __construct(IEncryptionManager $manager,
- IShareManager $shareManager,
- IMountManager $mountManager,
- IUserMountCache $userMountCache,
- IUserManager $userManager) {
+ IShareManager $shareManager,
+ IMountManager $mountManager,
+ IUserMountCache $userMountCache,
+ IUserManager $userManager) {
$this->encryptionManager = $manager;
$this->shareManager = $shareManager;
$this->mountManager = $mountManager;
* @throws \OC\User\NoUserException
*/
public function transfer(IUser $sourceUser,
- IUser $destinationUser,
- string $path,
- ?OutputInterface $output = null,
- bool $move = false,
- bool $firstLogin = false,
- bool $transferIncomingShares = false): void {
+ IUser $destinationUser,
+ string $path,
+ ?OutputInterface $output = null,
+ bool $move = false,
+ bool $firstLogin = false,
+ bool $transferIncomingShares = false): void {
$output = $output ?? new NullOutput();
$sourceUid = $sourceUser->getUID();
$destinationUid = $destinationUser->getUID();
* @throws \Exception
*/
protected function analyse(string $sourceUid,
- string $destinationUid,
- string $sourcePath,
- View $view,
- OutputInterface $output): void {
+ string $destinationUid,
+ string $sourcePath,
+ View $view,
+ OutputInterface $output): void {
$output->writeln('Validating quota');
$size = $view->getFileInfo($sourcePath, false)->getSize(false);
$freeSpace = $view->free_space($destinationUid . '/files/');
}
private function collectUsersShares(string $sourceUid,
- OutputInterface $output,
- View $view,
- string $path): array {
+ OutputInterface $output,
+ View $view,
+ string $path): array {
$output->writeln("Collecting all share information for files and folders of $sourceUid ...");
$shares = [];
}
private function collectIncomingShares(string $sourceUid,
- OutputInterface $output,
- View $view,
- bool $addKeys = false): array {
+ OutputInterface $output,
+ View $view,
+ bool $addKeys = false): array {
$output->writeln("Collecting all incoming share information for files and folders of $sourceUid ...");
$shares = [];
* @throws TransferOwnershipException
*/
protected function transferFiles(string $sourceUid,
- string $sourcePath,
- string $finalTarget,
- View $view,
- OutputInterface $output): void {
+ string $sourcePath,
+ string $finalTarget,
+ View $view,
+ OutputInterface $output): void {
$output->writeln("Transferring files to $finalTarget ...");
// This change will help user to transfer the folder specified using --path option.
}
private function restoreShares(string $sourceUid,
- string $destinationUid,
- array $shares,
- OutputInterface $output) {
+ string $destinationUid,
+ array $shares,
+ OutputInterface $output) {
$output->writeln("Restoring shares ...");
$progress = new ProgressBar($output, count($shares));
}
private function transferIncomingShares(string $sourceUid,
- string $destinationUid,
- array $sourceShares,
- array $destinationShares,
- OutputInterface $output,
- string $path,
- string $finalTarget,
- bool $move): void {
+ string $destinationUid,
+ array $sourceShares,
+ array $destinationShares,
+ OutputInterface $output,
+ string $path,
+ string $finalTarget,
+ bool $move): void {
$output->writeln("Restoring incoming shares ...");
$progress = new ProgressBar($output, count($sourceShares));
$prefix = "$destinationUid/files";
use OCP\IUserSession;
class UserConfig {
- const ALLOWED_CONFIGS = [
+ public const ALLOWED_CONFIGS = [
[
// Whether to crop the files previews or not in the files list
'key' => 'crop_image_previews',
* @return string[]
*/
public function getAllowedConfigKeys(): array {
- return array_map(function($config) {
+ return array_map(function ($config) {
return $config['key'];
}, self::ALLOWED_CONFIGS);
}
}
$userId = $this->user->getUID();
- $userConfigs = array_map(function(string $key) use ($userId) {
+ $userConfigs = array_map(function (string $key) use ($userId) {
$value = $this->config->getUserValue($userId, Application::APP_ID, $key, $this->getDefaultConfigValue($key));
// If the default is expected to be a boolean, we need to cast the value
if (is_bool($this->getDefaultConfigValue($key)) && is_string($value)) {
use OCP\IUserSession;
class ViewConfig {
- const CONFIG_KEY = 'files_views_configs';
- const ALLOWED_CONFIGS = [
+ public const CONFIG_KEY = 'files_views_configs';
+ public const ALLOWED_CONFIGS = [
[
// The default sorting key for the files list view
'key' => 'sorting_mode',
* @return string[]
*/
public function getAllowedConfigKeys(): array {
- return array_map(function($config) {
+ return array_map(function ($config) {
return $config['key'];
}, self::ALLOWED_CONFIGS);
}
}
// Extend undefined values with defaults
- return array_reduce(self::ALLOWED_CONFIGS, function($carry, $config) use ($view, $configs) {
+ return array_reduce(self::ALLOWED_CONFIGS, function ($carry, $config) use ($view, $configs) {
$key = $config['key'];
$carry[$key] = $configs[$view][$key] ?? $this->getDefaultConfigValue($key);
return $carry;
$configs = json_decode($this->config->getUserValue($userId, Application::APP_ID, self::CONFIG_KEY, '[]'), true);
$views = array_keys($configs);
- return array_reduce($views, function($carry, $view) use ($configs) {
+ return array_reduce($views, function ($carry, $view) use ($configs) {
$carry[$view] = $this->getConfig($view);
return $carry;
}, []);
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use OCP\Share\IManager;
-use OCP\Server;
use OCP\IConfig;
use OCP\IUserSession;
+use OCP\Server;
+use OCP\Share\IManager;
$config = Server::get(IConfig::class);
$userSession = Server::get(IUserSession::class);
<ul class="with-icon" tabindex="0">
<?php
$pinned = 0;
- foreach ($_['navigationItems'] as $item) {
- $pinned = NavigationListElements($item, $l, $pinned);
- }
+ foreach ($_['navigationItems'] as $item) {
+ $pinned = NavigationListElements($item, $l, $pinned);
+ }
?>
</ul>
</div>
<?php if (isset($item['expandedState'])) { ?> data-expandedstate="<?php p($item['expandedState']); ?>" <?php } ?>
class="nav-<?php p($item['id']) ?>
<?php if (isset($item['classes'])) {
- p($item['classes']);
- } ?>
+ p($item['classes']);
+ } ?>
<?php p($pinned === 1 ? 'first-pinned' : '') ?>
<?php if (isset($item['defaultExpandedState']) && $item['defaultExpandedState']) { ?> open<?php } ?>"
<?php if (isset($item['folderPosition'])) { ?> folderposition="<?php p($item['folderPosition']); ?>" <?php } ?>>
<?php
- NavigationElementMenu($item);
+ NavigationElementMenu($item);
if (isset($item['sublist'])) {
?>
<button class="collapse app-navigation-noclose" aria-expanded="<?= !empty($item['defaultExpandedState']) ? 'true' : 'false' ?>"
use OCP\Federation\ICloudIdManager;
use OCP\Files\IRootFolder;
use OCP\IURLGenerator;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
use PHPUnit\Framework\MockObject\MockObject;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\TimedJob;
-use OCP\Security\ICredentialsManager;
use OCP\IUser;
use OCP\IUserManager;
+use OCP\Security\ICredentialsManager;
class CredentialsCleanup extends TimedJob {
private $credentialsManager;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\BackendService;
use OCA\Files_External\Service\GlobalStoragesService;
-use OCA\Files_External\Service\UserStoragesService;
use OCA\Files_External\Service\StoragesService;
+use OCA\Files_External\Service\UserStoragesService;
use OCP\IUserManager;
use OCP\IUserSession;
use Symfony\Component\Console\Input\ArrayInput;
namespace OCA\Files_External\Command;
use OC\Core\Command\Base;
-use OCA\Files_External\Lib\Auth\AuthMechanism;
-use OCA\Files_External\Lib\Backend\Backend;
use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
private UserStoragesService $userStoragesService,
private UserGlobalStoragesService $userGlobalStoragesService,
private ClockInterface $clock,
- ) {}
+ ) {
+ }
/**
* Process storage ready for mounting
namespace OCA\Files_External\Config;
use OC\Files\Mount\MountPoint;
-use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Lib\Auth\Password\SessionCredentials;
+use OCA\Files_External\Lib\StorageConfig;
class ExternalMountPoint extends MountPoint {
namespace OCA\Files_External\Config;
-
use OCP\Files\Mount\ISystemMountPoint;
class SystemMountPoint extends ExternalMountPoint implements ISystemMountPoint {
* @param IGroupManager $groupManager
*/
public function __construct($appName,
- IRequest $request,
- RSA $rsaMechanism,
- GlobalAuth $globalAuth,
- IUserSession $userSession,
- IGroupManager $groupManager) {
+ IRequest $request,
+ RSA $rsaMechanism,
+ GlobalAuth $globalAuth,
+ IUserSession $userSession,
+ IGroupManager $groupManager) {
parent::__construct($appName, $request);
$this->rsaMechanism = $rsaMechanism;
$this->globalAuth = $globalAuth;
use OCA\Files_External\Lib\Auth\AuthMechanism;
use OCA\Files_External\Lib\Backend\Backend;
-use OCA\Files_External\Lib\DefinitionParameter;
use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\NotFoundException;
use OCA\Files_External\Lib\FrontendDefinitionTrait;
use OCA\Files_External\Lib\IdentifierTrait;
+use OCA\Files_External\Lib\IFrontendDefinition;
+use OCA\Files_External\Lib\IIdentifier;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Lib\StorageModifierTrait;
use OCA\Files_External\Lib\VisibilityTrait;
-use OCA\Files_External\Lib\IIdentifier;
-use OCA\Files_External\Lib\IFrontendDefinition;
/**
* Authentication mechanism
use OCA\Files_External\Lib\DependencyTrait;
use OCA\Files_External\Lib\FrontendDefinitionTrait;
use OCA\Files_External\Lib\IdentifierTrait;
+use OCA\Files_External\Lib\IFrontendDefinition;
+use OCA\Files_External\Lib\IIdentifier;
use OCA\Files_External\Lib\PriorityTrait;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Lib\StorageModifierTrait;
use OCA\Files_External\Lib\VisibilityTrait;
-use OCA\Files_External\Lib\IIdentifier;
-use OCA\Files_External\Lib\IFrontendDefinition;
use OCP\Files\Storage\IStorage;
/**
$placeholder = substr($placeholder, 1);
}
switch ($placeholder[0]) {
- case '!':
- $type = DefinitionParameter::VALUE_BOOLEAN;
- $placeholder = substr($placeholder, 1);
- break;
- case '*':
- $type = DefinitionParameter::VALUE_PASSWORD;
- $placeholder = substr($placeholder, 1);
- break;
- case '#':
- $type = DefinitionParameter::VALUE_HIDDEN;
- $placeholder = substr($placeholder, 1);
- break;
+ case '!':
+ $type = DefinitionParameter::VALUE_BOOLEAN;
+ $placeholder = substr($placeholder, 1);
+ break;
+ case '*':
+ $type = DefinitionParameter::VALUE_PASSWORD;
+ $placeholder = substr($placeholder, 1);
+ break;
+ case '#':
+ $type = DefinitionParameter::VALUE_HIDDEN;
+ $placeholder = substr($placeholder, 1);
+ break;
}
$this->addParameter((new DefinitionParameter($name, $placeholder))
->setType($type)
*/
namespace OCA\Files_External\Lib\Storage;
-use Aws\Result;
use Aws\S3\Exception\S3Exception;
-use Aws\S3\S3Client;
use Icewind\Streams\CallbackWrapper;
use Icewind\Streams\IteratorDirectory;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\Cache\CacheEntry;
use OC\Files\ObjectStore\S3ConnectionTrait;
use OC\Files\ObjectStore\S3ObjectTrait;
+use OCP\Cache\CappedMemoryCache;
use OCP\Constants;
use OCP\Files\FileInfo;
use OCP\Files\IMimeTypeDetector;
+use OCP\ICache;
use OCP\ICacheFactory;
-use OCP\IMemcache;
use OCP\Server;
-use OCP\ICache;
use Psr\Log\LoggerInterface;
class AmazonS3 extends \OC\Files\Storage\Common {
use Icewind\Streams\CountWrapper;
use Icewind\Streams\IteratorDirectory;
use Icewind\Streams\RetryWrapper;
-use OC\Files\Filesystem;
use OC\Files\Storage\Common;
use OCP\Constants;
use OCP\Files\FileInfo;
protected $client;
private IMimeTypeDetector $mimeTypeDetector;
- const COPY_CHUNK_SIZE = 8 * 1024 * 1024;
+ public const COPY_CHUNK_SIZE = 8 * 1024 * 1024;
/**
* @param string $host protocol://server:port
$path .= '/';
}
-// $path = str_replace('%23', '#', $path); // the prefix is sent as a query param, so revert the encoding of #
+ // $path = str_replace('%23', '#', $path); // the prefix is sent as a query param, so revert the encoding of #
try {
$files = [];
*/
namespace OCA\Files_External\Listener;
-use OCA\Files_External\AppInfo\Application;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\Files_External\AppInfo\Application;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
public function __construct(
private IConfig $config,
private IInitialState $initialState,
- ) {}
+ ) {
+ }
public function handle(Event $event): void {
if (!($event instanceof LoadAdditionalScriptsEvent)) {
namespace OCA\Files_External\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
<?php
+
declare(strict_types=1);
/**
<?php
-use \OCA\Files_External\Lib\Backend\Backend;
use \OCA\Files_External\Lib\Auth\AuthMechanism;
+use \OCA\Files_External\Lib\Backend\Backend;
use \OCA\Files_External\Lib\DefinitionParameter;
use \OCA\Files_External\Service\BackendService;
$canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting'];
- $l->t("Enable encryption");
- $l->t("Enable previews");
- $l->t("Enable sharing");
- $l->t("Check for changes");
- $l->t("Never");
- $l->t("Once every direct access");
- $l->t('Read only');
+$l->t("Enable encryption");
+$l->t("Enable previews");
+$l->t("Enable sharing");
+$l->t("Check for changes");
+$l->t("Never");
+$l->t("Once every direct access");
+$l->t('Read only');
- script('files_external', [
- 'settings',
- 'templates'
- ]);
- style('files_external', 'settings');
+script('files_external', [
+ 'settings',
+ 'templates'
+]);
+style('files_external', 'settings');
- // load custom JS
- foreach ($_['backends'] as $backend) {
- /** @var Backend $backend */
- $scripts = $backend->getCustomJs();
- foreach ($scripts as $script) {
- script('files_external', $script);
- }
+// load custom JS
+foreach ($_['backends'] as $backend) {
+ /** @var Backend $backend */
+ $scripts = $backend->getCustomJs();
+ foreach ($scripts as $script) {
+ script('files_external', $script);
}
- foreach ($_['authMechanisms'] as $authMechanism) {
- /** @var AuthMechanism $authMechanism */
- $scripts = $authMechanism->getCustomJs();
- foreach ($scripts as $script) {
- script('files_external', $script);
- }
+}
+foreach ($_['authMechanisms'] as $authMechanism) {
+ /** @var AuthMechanism $authMechanism */
+ $scripts = $authMechanism->getCustomJs();
+ foreach ($scripts as $script) {
+ script('files_external', $script);
}
+}
- function writeParameterInput($parameter, $options, $classes = []) {
- $value = '';
- if (isset($options[$parameter->getName()])) {
- $value = $options[$parameter->getName()];
- }
- $placeholder = $parameter->getText();
- $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL);
+function writeParameterInput($parameter, $options, $classes = []) {
+ $value = '';
+ if (isset($options[$parameter->getName()])) {
+ $value = $options[$parameter->getName()];
+ }
+ $placeholder = $parameter->getText();
+ $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL);
- switch ($parameter->getType()) {
+ switch ($parameter->getType()) {
case DefinitionParameter::VALUE_PASSWORD: ?>
<?php if ($is_optional) {
- $classes[] = 'optional';
- } ?>
+ $classes[] = 'optional';
+ } ?>
<input type="password"
<?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?>
data-parameter="<?php p($parameter->getName()); ?>"
placeholder="<?php p($placeholder); ?>"
/>
<?php
- break;
+ break;
case DefinitionParameter::VALUE_BOOLEAN: ?>
<?php $checkboxId = uniqid("checkbox_"); ?>
<div>
break;
default: ?>
<?php if ($is_optional) {
- $classes[] = 'optional';
- } ?>
+ $classes[] = 'optional';
+ } ?>
<input type="text"
<?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?>
data-parameter="<?php p($parameter->getName()); ?>"
placeholder="<?php p($placeholder); ?>"
/>
<?php
- }
}
+}
?>
<div class="emptyfilelist emptycontent hidden">
<a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-external-storage')); ?>"></a>
<p class="settings-hint"><?php p($l->t('External storage enables you to mount external storage services and devices as secondary Nextcloud storage devices. You may also allow users to mount their own external storage services.')); ?></p>
<?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) {
- print_unescaped(''.$_['dependencies'].'');
-} ?>
+ print_unescaped(''.$_['dependencies'].'');
+ } ?>
<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
<thead>
<tr>
<th><?php p($l->t('Authentication')); ?></th>
<th><?php p($l->t('Configuration')); ?></th>
<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) {
- print_unescaped('<th>'.$l->t('Available for').'</th>');
-} ?>
+ print_unescaped('<th>'.$l->t('Available for').'</th>');
+ } ?>
<th> </th>
<th> </th>
<th> </th>
<?php p($l->t('Add storage')); ?>
</option>
<?php
- $sortedBackends = array_filter($_['backends'], function ($backend) use ($_) {
- return $backend->isVisibleFor($_['visibilityType']);
- });
- uasort($sortedBackends, function ($a, $b) {
- return strcasecmp($a->getText(), $b->getText());
- });
- ?>
+ $sortedBackends = array_filter($_['backends'], function ($backend) use ($_) {
+ return $backend->isVisibleFor($_['visibilityType']);
+ });
+uasort($sortedBackends, function ($a, $b) {
+ return strcasecmp($a->getText(), $b->getText());
+});
+?>
<?php foreach ($sortedBackends as $backend): ?>
<?php if ($backend->getDeprecateTo() || (!$canCreateNewLocalStorage && $backend->getIdentifier() == "local")) {
- continue;
- } // ignore deprecated backends?>
+ continue;
+ } // ignore deprecated backends?>
<option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option>
<?php endforeach; ?>
</select>
<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?>
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox"
value="1" <?php if ($_['allowUserMounting']) {
- print_unescaped(' checked="checked"');
- } ?> />
+ print_unescaped(' checked="checked"');
+ } ?> />
<label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span>
<p id="userMountingBackends"<?php if (!$_['allowUserMounting']): ?> class="hidden"<?php endif; ?>>
$userBackends = array_filter($_['backends'], function ($backend) {
return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL);
});
- ?>
- <?php $i = 0; foreach ($userBackends as $backend): ?>
+ ?>
+ <?php $i = 0;
+ foreach ($userBackends as $backend): ?>
<?php if ($deprecateTo = $backend->getDeprecateTo()): ?>
<input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" />
<?php else: ?>
<input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) {
- print_unescaped(' checked="checked"');
- } ?> />
+ print_unescaped(' checked="checked"');
+ } ?> />
<label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend->getText()); ?></label> <br />
<?php endif; ?>
<?php $i++; ?>
use OCP\IRequest;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class GlobalStoragesControllerTest extends StoragesControllerTest {
protected function setUp(): void {
use OCP\IRequest;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class UserStoragesControllerTest extends StoragesControllerTest {
use OCP\Security\ICredentialsManager;
use OCP\User\Events\PasswordUpdatedEvent;
use OCP\User\Events\UserLoggedInEvent;
-use Test\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
/**
* @group DB
use OC\Files\SetupManagerFactory;
use OCA\Files_External\Lib\PersonalMount;
use OCA\Files_External\Lib\StorageConfig;
-use OCP\Diagnostics\IEventLogger;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Files\Config\IMountProviderCollection;
-use OCP\IUserManager;
use Test\TestCase;
class PersonalMountTest extends TestCase {
<?php
+
$CONFIG = [
"apps_paths" => [
[
- "path" => "/var/www/html/apps",
- "url" => "/apps",
+ "path" => "/var/www/html/apps",
+ "url" => "/apps",
"writable" => false,
],
[
- "path" => "/var/www/html/extra-apps",
- "url" => "/extra-apps",
+ "path" => "/var/www/html/extra-apps",
+ "url" => "/extra-apps",
"writable" => true,
],
],
class LoadAdditionalScriptsListener implements IEventListener {
public function __construct(
private IAppManager $appManager,
- ) {}
+ ) {
+ }
public function handle(Event $event): void {
if (!($event instanceof LoadAdditionalScriptsEvent)) {
class NodeDeletedListener implements IEventListener {
public function __construct(
private ReminderService $reminderService,
- ) {}
+ ) {
+ }
public function handle(Event $event): void {
if (!($event instanceof NodeDeletedEvent)) {
class UserDeletedListener implements IEventListener {
public function __construct(
private ReminderService $reminderService,
- ) {}
+ ) {
+ }
public function handle(Event $event): void {
if (!($event instanceof UserDeletedEvent)) {
protected IFactory $l10nFactory,
protected IURLGenerator $urlGenerator,
protected IRootFolder $root,
- ) {}
+ ) {
+ }
public function getID(): string {
return Application::APP_ID;
protected ReminderMapper $reminderMapper,
protected IRootFolder $root,
protected LoggerInterface $logger,
- ) {}
+ ) {
+ }
/**
* @throws DoesNotExistException
protected $displayNames = [];
public function __construct(IFactory $languageFactory,
- IURLGenerator $url,
- IManager $activityManager,
- IUserManager $userManager,
- ICloudIdManager $cloudIdManager,
- IContactsManager $contactsManager,
- IEventMerger $eventMerger) {
+ IURLGenerator $url,
+ IManager $activityManager,
+ IUserManager $userManager,
+ ICloudIdManager $cloudIdManager,
+ IContactsManager $contactsManager,
+ IEventMerger $eventMerger) {
$this->languageFactory = $languageFactory;
$this->url = $url;
$this->activityManager = $activityManager;
protected $groupDisplayNames = [];
public function __construct(IFactory $languageFactory,
- IURLGenerator $url,
- IManager $activityManager,
- IUserManager $userManager,
- ICloudIdManager $cloudIdManager,
- IContactsManager $contactsManager,
- IEventMerger $eventMerger,
- IGroupManager $groupManager) {
+ IURLGenerator $url,
+ IManager $activityManager,
+ IUserManager $userManager,
+ ICloudIdManager $cloudIdManager,
+ IContactsManager $contactsManager,
+ IEventMerger $eventMerger,
+ IGroupManager $groupManager) {
parent::__construct($languageFactory, $url, $activityManager, $userManager, $cloudIdManager, $contactsManager, $eventMerger);
$this->groupManager = $groupManager;
}
public const SUBJECT_REMOTE_SHARE_UNSHARED = 'remote_share_unshared';
public function __construct(IFactory $languageFactory,
- IURLGenerator $url,
- IManager $activityManager,
- IUserManager $userManager,
- ICloudIdManager $cloudIdManager,
- IContactsManager $contactsManager,
- IEventMerger $eventMerger) {
+ IURLGenerator $url,
+ IManager $activityManager,
+ IUserManager $userManager,
+ ICloudIdManager $cloudIdManager,
+ IContactsManager $contactsManager,
+ IEventMerger $eventMerger) {
parent::__construct($languageFactory, $url, $activityManager, $userManager, $cloudIdManager, $contactsManager, $eventMerger);
}
use OC\Group\DisplayNameCache as GroupDisplayNameCache;
use OC\Share\Share;
use OC\User\DisplayNameCache;
+use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\Files\Event\LoadSidebar;
use OCA\Files_Sharing\Capabilities;
-use OCA\Files_Sharing\Event\BeforeTemplateRenderedEvent;
use OCA\Files_Sharing\External\Manager;
use OCA\Files_Sharing\External\MountProvider as ExternalMountProvider;
use OCA\Files_Sharing\Helper;
use OCA\Files_Sharing\MountProvider;
use OCA\Files_Sharing\Notification\Listener;
use OCA\Files_Sharing\Notification\Notifier;
-use OCA\Files\Event\LoadAdditionalScriptsEvent;
-use OCA\Files\Event\LoadSidebar;
use OCA\Files_Sharing\ShareBackend\File;
use OCA\Files_Sharing\ShareBackend\Folder;
use OCA\Files_Sharing\ViewOnly;
use OCP\Files\Search\ISearchComparison;
use OCP\Files\Search\ISearchOperator;
use OCP\Files\StorageNotAvailableException;
-use OCP\ICacheFactory;
-use OCP\IUserManager;
use OCP\Share\IShare;
/**
namespace OCA\Files_Sharing\Collaboration;
use OCP\Collaboration\AutoComplete\ISorter;
-use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\IUserSession;
namespace OCA\Files_Sharing\Command;
-
-use Symfony\Component\Console\Question\ConfirmationQuestion;
use OC\Core\Command\Base;
use OCA\Files_Sharing\OrphanHelper;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Question\ConfirmationQuestion;
class DeleteOrphanShares extends Base {
private OrphanHelper $orphanHelper;
private $shareManager;
public function __construct(ITimeFactory $time,
- NotificationManager $notificationManager,
- IDBConnection $connection,
- ShareManager $shareManager) {
+ NotificationManager $notificationManager,
+ IDBConnection $connection,
+ ShareManager $shareManager) {
parent::__construct();
$this->notificationManager = $notificationManager;
//Current time
$minTime = $this->time->getDateTime();
$minTime->add(new \DateInterval('P1D'));
- $minTime->setTime(0,0,0);
+ $minTime->setTime(0, 0, 0);
$maxTime = clone $minTime;
$maxTime->setTime(23, 59, 59);
private $serverContainer;
public function __construct(string $appName,
- IRequest $request,
- ShareManager $shareManager,
- string $UserId,
- IUserManager $userManager,
- IGroupManager $groupManager,
- IRootFolder $rootFolder,
- IAppManager $appManager,
- IServerContainer $serverContainer) {
+ IRequest $request,
+ ShareManager $shareManager,
+ string $UserId,
+ IUserManager $userManager,
+ IGroupManager $groupManager,
+ IRootFolder $rootFolder,
+ IAppManager $appManager,
+ IServerContainer $serverContainer) {
parent::__construct($appName, $request);
$this->shareManager = $shareManager;
private $share;
public function __construct(string $appName,
- IRequest $request,
- ShareManager $shareManger,
- ISession $session,
- IPreview $previewManager) {
+ IRequest $request,
+ ShareManager $shareManger,
+ ISession $session,
+ IPreview $previewManager) {
parent::__construct($appName, $request, $session);
$this->shareManager = $shareManger;
private $userId;
public function __construct(IRequest $request,
- IConfig $config,
- string $userId) {
+ IConfig $config,
+ string $userId) {
parent::__construct(Application::APP_ID, $request);
$this->config = $config;
$result['share_with'] = $share->getSharedWith();
$result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith();
$result['share_with_displayname_unique'] = $sharedWith !== null ? (
- !empty($sharedWith->getSystemEMailAddress()) ? $sharedWith->getSystemEMailAddress() : $sharedWith->getUID()
+ !empty($sharedWith->getSystemEMailAddress()) ? $sharedWith->getSystemEMailAddress() : $sharedWith->getUID()
) : $share->getSharedWith();
$userStatuses = $this->userStatusManager->getUserStatuses([$share->getSharedWith()]);
$result['attributes'] = null;
if ($attributes = $share->getAttributes()) {
- $result['attributes'] = (string)\json_encode($attributes->toArray());
+ $result['attributes'] = (string)\json_encode($attributes->toArray());
}
return $result;
}
if (!$this->hasPermission($newPermissions, Constants::PERMISSION_READ) && (
- $this->hasPermission($newPermissions, Constants::PERMISSION_UPDATE) || $this->hasPermission($newPermissions, Constants::PERMISSION_DELETE)
- )) {
+ $this->hasPermission($newPermissions, Constants::PERMISSION_UPDATE) || $this->hasPermission($newPermissions, Constants::PERMISSION_DELETE)
+ )) {
throw new OCSBadRequestException($this->l->t('Share must have READ permission if UPDATE or DELETE permission is set'));
}
}
use OCP\Share;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager as ShareManager;
-use OCP\Share\IShare;
use OCP\Share\IPublicShareTemplateFactory;
+use OCP\Share\IShare;
use OCP\Template;
/**
* @param string $filePath
*/
protected function publishActivity($subject,
- array $parameters,
- $affectedUser,
- $fileId,
- $filePath) {
+ array $parameters,
+ $affectedUser,
+ $fileId,
+ $filePath) {
$event = $this->activityManager->generateEvent();
$event->setApp('files_sharing')
->setType('public_links')
* @param IManager $shareManager
*/
public function __construct(string $appName,
- IRequest $request,
- IManager $shareManager) {
+ IRequest $request,
+ IManager $shareManager) {
parent::__construct($appName, $request);
$this->shareManager = $shareManager;
*/
namespace OCA\Files_Sharing\Controller;
-use OCP\Constants;
-use function array_slice;
-use function array_values;
use Generator;
use OC\Collaboration\Collaborators\SearchResult;
use OCA\Files_Sharing\ResponseDefinitions;
use OCP\Collaboration\Collaborators\ISearch;
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\Collaboration\Collaborators\SearchResultType;
+use OCP\Constants;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IURLGenerator;
-use OCP\Share\IShare;
use OCP\Share\IManager;
+use OCP\Share\IShare;
+use function array_slice;
+use function array_values;
use function usort;
/**
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\FileInfo;
use OCP\Files\Folder;
-use OCP\Files\NotFoundException;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IPreview;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
-use OCP\Share\IShare;
use OCP\Share\IPublicShareTemplateProvider;
+use OCP\Share\IShare;
use OCP\Template;
use OCP\Util;
*/
namespace OCA\Files_Sharing\External;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Federation\ICloudIdManager;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
use OCP\IDBConnection;
-use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IUser;
class MountProvider implements IMountProvider {
*/
namespace OCA\Files_Sharing\Listener;
-use OCA\Files_Sharing\AppInfo\Application;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\Files_Sharing\AppInfo\Application;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Share\IManager;
namespace OCA\Files_Sharing\Listener;
-use OCA\Files_Sharing\AppInfo\Application;
use OCA\Files\Event\LoadSidebar;
+use OCA\Files_Sharing\AppInfo\Application;
+use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
-use OCP\Util;
-use OCP\AppFramework\Services\IInitialState;
use OCP\Share\IManager;
+use OCP\Util;
/**
* @template-implements IEventListener<Event>
*/
-class LoadSidebarListener implements IEventListener
-{
+class LoadSidebarListener implements IEventListener {
- public function __construct(private IInitialState $initialState, private IManager $shareManager)
- {
+ public function __construct(private IInitialState $initialState, private IManager $shareManager) {
}
- public function handle(Event $event): void
- {
+ public function handle(Event $event): void {
if (!($event instanceof LoadSidebar)) {
return;
}
private $l;
public function __construct(IManager $shareManager,
- IL10N $l) {
+ IL10N $l) {
$this->shareManager = $shareManager;
$this->l = $l;
}
protected $request;
public function __construct(string $appName,
- IConfig $config,
- IAppManager $appManager,
- IControllerMethodReflector $reflector,
- IManager $shareManager,
- IRequest $request
- ) {
+ IConfig $config,
+ IAppManager $appManager,
+ IControllerMethodReflector $reflector,
+ IManager $shareManager,
+ IRequest $request
+ ) {
$this->appName = $appName;
$this->config = $config;
$this->appManager = $appManager;
$query = $this->connection->getQueryBuilder();
$query->update('share')
- ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST))
+ ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST))
->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_EMAIL)));
$query->execute();
}
use Closure;
use Doctrine\DBAL\Types\Type;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OCA\Files_Sharing\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OCA\Files_Sharing\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
*/
namespace OCA\Files_Sharing;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\View;
use OCA\Files_Sharing\Event\ShareMountedEvent;
+use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\IMountProvider;
use OCP\Files\Storage\IStorageFactory;
protected $url;
public function __construct(IFactory $l10nFactory,
- IManager $shareManager,
- IRootFolder $rootFolder,
- IGroupManager $groupManager,
- IUserManager $userManager,
- IURLGenerator $url) {
+ IManager $shareManager,
+ IRootFolder $rootFolder,
+ IGroupManager $groupManager,
+ IUserManager $userManager,
+ IURLGenerator $url) {
$this->l10nFactory = $l10nFactory;
$this->shareManager = $shareManager;
$this->rootFolder = $rootFolder;
<?php
+
declare(strict_types=1);
/**
namespace OCA\Files_Sharing;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\Filesystem;
use OC\Files\Mount\MountPoint;
use OC\Files\Mount\MoveableMount;
use OC\Files\View;
+use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\InvalidateMountCacheEvent;
use OCP\Files\Storage\IStorageFactory;
use OC\Files\Cache\Watcher;
use OC\Files\ObjectStore\HomeObjectStoreStorage;
use OC\Files\Storage\Common;
-use OC\Files\Storage\Home;
-use OC\User\DisplayNameCache;
-use OCP\Files\Folder;
-use OCP\Files\IHomeStorage;
-use OCP\Files\Node;
use OC\Files\Storage\FailedStorage;
+use OC\Files\Storage\Home;
use OC\Files\Storage\Wrapper\PermissionsMask;
+use OC\User\DisplayNameCache;
use OC\User\NoUserException;
use OCA\Files_External\Config\ExternalMountPoint;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
+use OCP\Files\Folder;
+use OCP\Files\IHomeStorage;
use OCP\Files\IRootFolder;
+use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IDisableEncryptionStorage;
use OCP\Files\Storage\IStorage;
use OC\Files\Mount\MountPoint;
use OCP\Constants;
-use OCP\Share\IShare;
use OCP\Files\Folder;
+use OCP\Share\IShare;
class Updater {
echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [
'<span id="show-terms-dialog">', '</span>'
]);
- ?>
+ ?>
</div>
<?php } ?>
</div>
use OC\Files\Cache\Scanner;
use OC\Files\Filesystem;
-use OC\Files\SetupManager;
use OCA\Files_Sharing\Controller\ShareAPIController;
use OCP\App\IAppManager;
use OCP\AppFramework\OCS\OCSBadRequestException;
*/
namespace OCA\Files_Sharing\Tests;
-use OCP\Files\Events\BeforeDirectFileDownloadEvent;
-use OCP\Files\Events\BeforeZipCreatedEvent;
-use Psr\Log\LoggerInterface;
-use OC\Share20\Manager;
use OC\EventDispatcher\EventDispatcher;
+use OC\Share20\Manager;
use OCA\Files_Sharing\AppInfo\Application;
use OCA\Files_Sharing\SharedStorage;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Events\BeforeDirectFileDownloadEvent;
+use OCP\Files\Events\BeforeZipCreatedEvent;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\IUserSession;
use OCP\Share\IAttributes;
use OCP\Share\IShare;
+use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher;
use Test\TestCase;
public function testGetFolderContentsInRoot() {
$results = $this->user2View->getDirectoryContent('/');
- $results = (array_filter($results, function($file) {
+ $results = (array_filter($results, function ($file) {
return $file->getName() !== 'welcome.txt';
}));
self::assertEquals([
'welcome.txt',
'simplefile.txt'
- ], array_map(function($node) {
+ ], array_map(function ($node) {
return $node->getFileInfo()['name'];
}, $recents));
}
namespace OCA\Files_Sharing\Tests\Controllers;
use OCA\Files_Sharing\Controller\ExternalSharesController;
+use OCA\Files_Sharing\External\Manager;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\JSONResponse;
+use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
+use OCP\Http\Client\IResponse;
use OCP\IConfig;
use OCP\IRequest;
-use OCP\Http\Client\IResponse;
-use OCP\Http\Client\IClient;
-use OCA\Files_Sharing\External\Manager;
use PHPUnit\Framework\MockObject\MockObject;
/**
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
use OCP\Files\Storage;
-use OCP\Files\Storage\IStorage;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IGroupManager;
use OCP\Share\IAttributes as IShareAttributes;
use OCP\Share\IManager;
use OCP\Share\IShare;
-use Test\TestCase;
use OCP\UserStatus\IManager as IUserStatusManager;
+use Test\TestCase;
/**
* Class ShareAPIControllerTest
*/
public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
- $shareTime, $expiration, $parent, $target, $mail_send, $note = '', $token = null,
- $password = null, $label = '', $attributes = null) {
+ $shareTime, $expiration, $parent, $target, $mail_send, $note = '', $token = null,
+ $password = null, $label = '', $attributes = null) {
$share = $this->getMockBuilder(IShare::class)->getMock();
$share->method('getId')->willReturn($id);
$share->method('getShareType')->willReturn($shareType);
$this->shareManager->expects($this->once())->method('createShare')->with(
$this->callback(function (\OCP\Share\IShare $share) use ($path) {
$date = new \DateTime('2000-01-01');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
return $share->getNode() === $path &&
$share->getShareType() === IShare::TYPE_LINK &&
$this->shareManager->expects($this->once())->method('updateShare')->with(
$this->callback(function (\OCP\Share\IShare $share) {
$date = new \DateTime('2000-01-01');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
return $share->getPermissions() === (\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE) &&
$share->getPassword() === 'password' &&
$ocs = $this->mockFormatShare();
$date = new \DateTime('2000-01-01');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
[$userFolder, $node] = $this->getNonSharedUserFolder();
$node->method('getId')->willReturn(42);
$ocs = $this->mockFormatShare();
$date = new \DateTime('2000-01-01');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
[$userFolder, $node] = $this->getNonSharedUserFolder();
$userFolder->method('getById')
$ocs = $this->mockFormatShare();
$date = new \DateTime('2000-01-01');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
[$userFolder, $node] = $this->getNonSharedUserFolder();
$userFolder->method('getById')
$ocs = $this->mockFormatShare();
$date = new \DateTime('2000-01-01');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
[$userFolder, $node] = $this->getNonSharedUserFolder();
$userFolder->method('getById')
$ocs = $this->mockFormatShare();
$date = new \DateTime('2000-01-01');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
[$userFolder, $node] = $this->getNonSharedUserFolder();
$node->method('getId')
$this->shareManager->expects($this->once())->method('updateShare')->with(
$this->callback(function (\OCP\Share\IShare $share) {
$date = new \DateTime('2010-12-23');
- $date->setTime(0,0,0);
+ $date->setTime(0, 0, 0);
return $share->getPermissions() === \OCP\Constants::PERMISSION_ALL &&
$share->getPassword() === 'password' &&
use OC\Files\Filesystem;
use OC\Files\Node\Folder;
+use OC\Share20\Manager;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Controller\ShareController;
+use OCA\Files_Sharing\DefaultPublicShareTemplateProvider;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
+use OCP\Activity\IManager;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\Template\ExternalShareMenuAction;
use OCP\AppFramework\Http\Template\LinkMenuAction;
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use OCP\AppFramework\Http\Template\SimpleMenuAction;
use OCP\Constants;
+use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\File;
+use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Files\Storage;
use OCP\IConfig;
use OCP\IUserManager;
use OCP\Security\ISecureRandom;
use OCP\Share\Exceptions\ShareNotFound;
+use OCP\Share\IPublicShareTemplateFactory;
use OCP\Share\IShare;
use PHPUnit\Framework\MockObject\MockObject;
-use OCP\Activity\IManager;
-use OCP\Files\IRootFolder;
-use OCP\Defaults;
-use OC\Share20\Manager;
-use OCA\Files_Sharing\DefaultPublicShareTemplateProvider;
-use OCP\Share\IPublicShareTemplateFactory;
/**
* @group DB
use OCP\IConfig;
use OCP\IRequest;
use OCP\IURLGenerator;
-use OCP\Share\IShare;
use OCP\Share\IManager;
+use OCP\Share\IShare;
use PHPUnit\Framework\MockObject\MockObject;
/**
$caches = [];
$cacheFactory = $this->createMock(ICacheFactory::class);
$cacheFactory->method('createLocal')
- ->willReturnCallback(function(string $prefix) use (&$caches) {
+ ->willReturnCallback(function (string $prefix) use (&$caches) {
if (!isset($caches[$prefix])) {
$caches[$prefix] = new ArrayCache($prefix);
}
return $caches[$prefix];
});
$cacheFactory->method('createDistributed')
- ->willReturnCallback(function(string $prefix) use (&$caches) {
+ ->willReturnCallback(function (string $prefix) use (&$caches) {
if (!isset($caches[$prefix])) {
$caches[$prefix] = new ArrayCache($prefix);
}
namespace OCA\Files_Sharing\Tests;
use OC\Files\Filesystem;
+use OC\User\DisplayNameCache;
use OCA\Files_Sharing\AppInfo\Application;
use OCA\Files_Sharing\External\MountProvider as ExternalMountProvider;
use OCA\Files_Sharing\MountProvider;
use OCP\Files\Config\IMountProviderCollection;
use OCP\Share\IShare;
use Test\Traits\MountProviderTrait;
-use OC\User\DisplayNameCache;
/**
* Class TestCase
use OCA\Files_Trashbin\Trash\ITrashManager;
use OCA\Files_Trashbin\Trash\TrashManager;
use OCA\Files_Trashbin\UserMigration\TrashbinMigrator;
+use OCP\App\IAppManager;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
-use OCP\App\IAppManager;
use OCP\ILogger;
use OCP\IServerContainer;
*/
namespace OCA\Files_Trashbin\BackgroundJob;
-use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files_Trashbin\Expiration;
use OCA\Files_Trashbin\Helper;
use OCA\Files_Trashbin\Trashbin;
* @param Expiration|null $expiration
*/
public function __construct(IUserManager $userManager = null,
- Expiration $expiration = null) {
+ Expiration $expiration = null) {
parent::__construct();
$this->userManager = $userManager;
/** @var bool */
private $canPurgeToSaveSpace;
- public function __construct(IConfig $config,ITimeFactory $timeFactory) {
+ public function __construct(IConfig $config, ITimeFactory $timeFactory) {
$this->timeFactory = $timeFactory;
$this->setRetentionObligation($config->getSystemValue('trashbin_retention_obligation', 'auto'));
}
<?php
+
declare(strict_types=1);
/**
*/
namespace OCA\Files_Trashbin\Listeners;
-use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\Files_Trashbin\AppInfo\Application;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Util;
namespace OCA\Files_Trashbin\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
*/
namespace OCA\Files_Trashbin\Sabre;
+use OCA\DAV\Connector\Sabre\FilesPlugin;
use OCP\IPreview;
use Sabre\DAV\INode;
-use Sabre\DAV\Server;
use Sabre\DAV\PropFind;
+use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-use OCA\DAV\Connector\Sabre\FilesPlugin;
class TrashbinPlugin extends ServerPlugin {
public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename';
public function listTrashFolder(ITrashItem $folder): array {
$user = $folder->getUser();
$entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID());
- return $this->mapTrashItems($entries, $user ,$folder);
+ return $this->mapTrashItems($entries, $user, $folder);
}
public function restoreItem(ITrashItem $item) {
namespace OCA\Files_Trashbin\Trash;
use OCP\Files\FileInfo;
-use OCP\FilesMetadata\Model\IFilesMetadata;
use OCP\IUser;
class TrashItem implements ITrashItem {
*/
namespace OCA\Files_Trashbin;
-use OC_User;
use OC\Files\Cache\Cache;
use OC\Files\Cache\CacheEntry;
use OC\Files\Cache\CacheQueryBuilder;
use OC\Files\Filesystem;
use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\View;
+use OC_User;
use OCA\Files_Trashbin\AppInfo\Application;
use OCA\Files_Trashbin\Command\Expire;
-use OCP\AppFramework\Utility\ITimeFactory;
use OCP\App\IAppManager;
+use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\NotFoundException;
->setParameter('id', $id)
->setParameter('timestamp', $timestamp)
->setParameter('location', $location)
- ;
+ ;
$qb->executeStatement();
}
public function testGetMaxAgeAsTimestamp($configValue, $expectedMaxAgeTimestamp) {
$mockedConfig = $this->getMockedConfig($configValue);
$mockedTimeFactory = $this->getMockedTimeFactory(
- self::FAKE_TIME_NOW
+ self::FAKE_TIME_NOW
);
$expiration = new Expiration($mockedConfig, $mockedTimeFactory);
use OCP\Files\Events\Node\BeforeNodeDeletedEvent;
use OCP\Files\Events\Node\BeforeNodeRenamedEvent;
use OCP\Files\Events\Node\BeforeNodeTouchedEvent;
+use OCP\Files\Events\Node\BeforeNodeWrittenEvent;
use OCP\Files\Events\Node\NodeCopiedEvent;
+use OCP\Files\Events\Node\NodeCreatedEvent;
use OCP\Files\Events\Node\NodeDeletedEvent;
use OCP\Files\Events\Node\NodeRenamedEvent;
-use OCP\Files\Events\Node\BeforeNodeWrittenEvent;
-use OCP\Files\Events\Node\NodeCreatedEvent;
use OCP\Files\Events\Node\NodeTouchedEvent;
use OCP\Files\Events\Node\NodeWrittenEvent;
use OCP\IConfig;
namespace OCA\Files_Versions\Db;
-use OCA\Files_Versions\Db\VersionEntity;
-use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;
-use OCP\DB\IResult;
+use OCP\IDBConnection;
/**
* @extends QBMapper<VersionEntity>
if (!ctype_digit($minValue) && $minValue !== 'auto') {
$isValid = false;
$this->logger->warning(
- $minValue . ' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
- ['app' => 'files_versions']
+ $minValue . ' is not a valid value for minimal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
+ ['app' => 'files_versions']
);
}
if (!ctype_digit($maxValue) && $maxValue !== 'auto') {
$isValid = false;
$this->logger->warning(
- $maxValue . ' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
- ['app' => 'files_versions']
+ $maxValue . ' is not a valid value for maximal versions retention obligation. Check versions_retention_obligation in your config.php. Falling back to auto.',
+ ['app' => 'files_versions']
);
}
public function propFind(PropFind $propFind, INode $node): void {
if ($node instanceof VersionFile) {
- $propFind->handle(self::VERSION_LABEL, fn() => $node->getLabel());
+ $propFind->handle(self::VERSION_LABEL, fn () => $node->getLabel());
$propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType()));
}
}
use OCA\Files_Versions\Versions\INameableVersionBackend;
use OCA\Files_Versions\Versions\IVersion;
use OCA\Files_Versions\Versions\IVersionManager;
-use OCP\Files\FileInfo;
use OCP\Files\NotFoundException;
use Sabre\DAV\Exception\Forbidden;
use Sabre\DAV\Exception\NotFound;
namespace OCA\Files_Versions;
+use OC\Files\Filesystem;
use OC\Files\Search\SearchBinaryOperator;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
-use OC_User;
-use OC\Files\Filesystem;
use OC\Files\View;
+use OC_User;
use OCA\Files_Sharing\SharedMount;
use OCA\Files_Versions\AppInfo\Application;
use OCA\Files_Versions\Command\Expire;
use OCA\Files_Versions\Events\CreateVersionEvent;
use OCA\Files_Versions\Versions\IVersionManager;
use OCP\AppFramework\Db\DoesNotExistException;
+use OCP\Command\IBus;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\FileInfo;
use OCP\Files\Folder;
+use OCP\Files\IMimeTypeDetector;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
-use OCP\Command\IBus;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Files\IMimeTypeDetector;
use OCP\Files\NotFoundException;
use OCP\Files\Search\ISearchBinaryOperator;
use OCP\Files\Search\ISearchComparison;
use OCP\Files\Folder;
use OCP\Files\IMimeTypeLoader;
use OCP\Files\IRootFolder;
-use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
use OCP\IUser;
use OCP\Files\Lock\ILock;
use OCP\Files\Lock\ILockManager;
use OCP\Files\Lock\LockContext;
-use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
use OCP\IUser;
use OCP\Lock\ManuallyLockedException;
public function rollback(IVersion $version) {
$backend = $version->getBackend();
- $result = self::handleAppLocks(fn(): ?bool => $backend->rollback($version));
+ $result = self::handleAppLocks(fn (): ?bool => $backend->rollback($version));
// rollback doesn't have a return type yet and some implementations don't return anything
if ($result === null || $result === true) {
\OC_Hook::emit('\OCP\Versions', 'rollback', [
$lockContext = new LockContext($root, ILock::TYPE_APP, $owner);
$lockManager = \OC::$server->get(ILockManager::class);
$result = null;
- $lockManager->runInScope($lockContext, function() use ($callback, &$result) {
+ $lockManager->runInScope($lockContext, function () use ($callback, &$result) {
$result = $callback();
});
return $result;
namespace OCA\files_versions\tests;
use OCA\Files_Versions\Expiration;
-use OCA\Files_Versions\Hooks;
use OCA\Files_Versions\Storage;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IUser;
use Psr\Container\ContainerInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
class Application extends App implements IBootstrap {
public const APP_ID = 'lookup_server_connector';
* @todo move the OCP events and then move the registration to `register`
*/
private function registerEventListeners(IEventDispatcher $dispatcher,
- ContainerInterface $appContainer): void {
+ ContainerInterface $appContainer): void {
$dispatcher->addListener(UserUpdatedEvent::class, function (UserUpdatedEvent $event) use ($appContainer) {
/** @var UpdateLookupServer $updateLookupServer */
$updateLookupServer = $appContainer->get(UpdateLookupServer::class);
* @param Signer $signer
*/
public function __construct(ITimeFactory $time,
- IClientService $clientService,
- IConfig $config,
- IUserManager $userManager,
- IAccountManager $accountManager,
- Signer $signer) {
+ IClientService $clientService,
+ IConfig $config,
+ IUserManager $userManager,
+ IAccountManager $accountManager,
+ Signer $signer) {
parent::__construct($time);
$this->clientService = $clientService;
$this->config = $config;
* @param IConfig $config
*/
public function __construct(IJobList $jobList,
- IConfig $config) {
+ IConfig $config) {
$this->config = $config;
$this->jobList = $jobList;
}
* @param IL10N $l
*/
public function __construct(string $appName,
- IRequest $request,
- IURLGenerator $urlGenerator,
- ClientMapper $clientMapper,
- ISession $session,
- IL10N $l) {
+ IRequest $request,
+ IURLGenerator $urlGenerator,
+ ClientMapper $clientMapper,
+ ISession $session,
+ IL10N $l) {
parent::__construct($appName, $request);
$this->urlGenerator = $urlGenerator;
$this->clientMapper = $clientMapper;
* 303: Redirect to login URL
*/
public function authorize($client_id,
- $state,
- $response_type): TemplateResponse|RedirectResponse {
+ $state,
+ $response_type): TemplateResponse|RedirectResponse {
try {
$client = $this->clientMapper->getByIdentifier($client_id);
} catch (ClientNotFoundException $e) {
*/
namespace OCA\OAuth2\Controller;
-use OCP\Authentication\Token\IProvider as IAuthTokenProvider;
use OCA\OAuth2\Db\AccessTokenMapper;
use OCA\OAuth2\Db\Client;
use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
+use OCP\Authentication\Token\IProvider as IAuthTokenProvider;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IUser;
}
public function addClient(string $name,
- string $redirectUri): JSONResponse {
+ string $redirectUri): JSONResponse {
if (filter_var($redirectUri, FILTER_VALIDATE_URL) === false) {
return new JSONResponse(['message' => $this->l->t('Your redirect URL needs to be a full URL for example: https://yourdomain.com/path')], Http::STATUS_BAD_REQUEST);
}
private $tokenProvider;
public function __construct(IDBConnection $connection,
- ITimeFactory $timeFactory,
- TokenProvider $tokenProvider) {
+ ITimeFactory $timeFactory,
+ TokenProvider $tokenProvider) {
$this->connection = $connection;
$this->time = $timeFactory;
$this->tokenProvider = $tokenProvider;
use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
+use OCP\IURLGenerator;
use OCP\Security\ICrypto;
use OCP\Settings\ISettings;
-use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;
class Admin implements ISettings {
*/
namespace OCA\OAuth2\Tests\Controller;
-use OC\Authentication\Token\IToken;
-use OCP\Authentication\Token\IProvider as IAuthTokenProvider;
use OCA\OAuth2\Controller\SettingsController;
use OCA\OAuth2\Db\AccessTokenMapper;
use OCA\OAuth2\Db\Client;
use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
+use OCP\Authentication\Token\IProvider as IAuthTokenProvider;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IUser;
protected $l10nFactory;
public function __construct(string $appName,
- IRequest $request,
- IUserManager $userManager,
- IConfig $config,
- IGroupManager $groupManager,
- IUserSession $userSession,
- IAccountManager $accountManager,
- IFactory $l10nFactory) {
+ IRequest $request,
+ IUserManager $userManager,
+ IConfig $config,
+ IGroupManager $groupManager,
+ IUserSession $userSession,
+ IAccountManager $accountManager,
+ IFactory $l10nFactory) {
parent::__construct($appName, $request);
$this->userManager = $userManager;
* @param IAppConfig $appConfig
*/
public function __construct(string $appName,
- IRequest $request,
- IConfig $config,
- IAppConfig $appConfig,
- IUserSession $userSession,
- IL10N $l10n,
- IGroupManager $groupManager,
- IManager $settingManager) {
+ IRequest $request,
+ IConfig $config,
+ IAppConfig $appConfig,
+ IUserSession $userSession,
+ IL10N $l10n,
+ IGroupManager $groupManager,
+ IManager $settingManager) {
parent::__construct($appName, $request);
$this->config = $config;
$this->appConfig = $appConfig;
private $logger;
public function __construct(string $appName,
- IRequest $request,
- IUserManager $userManager,
- IConfig $config,
- IGroupManager $groupManager,
- IUserSession $userSession,
- IAccountManager $accountManager,
- IFactory $l10nFactory,
- LoggerInterface $logger) {
+ IRequest $request,
+ IUserManager $userManager,
+ IConfig $config,
+ IGroupManager $groupManager,
+ IUserSession $userSession,
+ IAccountManager $accountManager,
+ IFactory $l10nFactory,
+ LoggerInterface $logger) {
parent::__construct($appName,
$request,
$userManager,
<?php
+
declare(strict_types=1);
/**
public function __construct(L10nFactory $l10n,
- IURLGenerator $urlGenerator,
- IManager $activityManager,
- IUserManager $userManager,
- IGroupManager $groupManager) {
+ IURLGenerator $urlGenerator,
+ IManager $activityManager,
+ IUserManager $userManager,
+ IGroupManager $groupManager) {
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
$this->activityManager = $activityManager;
private $activityManager;
public function __construct(IFactory $languageFactory,
- IURLGenerator $url,
- IUserManager $userManager,
- IManager $activityManager) {
+ IURLGenerator $url,
+ IUserManager $userManager,
+ IManager $activityManager) {
$this->languageFactory = $languageFactory;
$this->url = $url;
$this->userManager = $userManager;
private $config;
public function __construct(IAccountManager $accountManager,
- IUserManager $userManager,
- IClientService $clientService,
- ILogger $logger,
- ITimeFactory $timeFactory,
- IConfig $config
+ IUserManager $userManager,
+ IClientService $clientService,
+ ILogger $logger,
+ ITimeFactory $timeFactory,
+ IConfig $config
) {
parent::__construct($timeFactory);
$this->accountManager = $accountManager;
namespace OCA\Settings\Controller;
use OCP\AppFramework\Controller;
-use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IConfig;
-use OCP\IL10N;
use OCP\IRequest;
-use OCP\IURLGenerator;
-use OCP\IUserSession;
-use OCP\Mail\IMailer;
-use function GuzzleHttp\Promise\queue;
class AISettingsController extends Controller {
* @param LoggerInterface $logger
*/
public function __construct(string $appName,
- IRequest $request,
- IL10N $l10n,
- IConfig $config,
- INavigationManager $navigationManager,
- IAppManager $appManager,
- CategoryFetcher $categoryFetcher,
- AppFetcher $appFetcher,
- IFactory $l10nFactory,
- BundleFetcher $bundleFetcher,
- Installer $installer,
- IURLGenerator $urlGenerator,
- LoggerInterface $logger) {
+ IRequest $request,
+ IL10N $l10n,
+ IConfig $config,
+ INavigationManager $navigationManager,
+ IAppManager $appManager,
+ CategoryFetcher $categoryFetcher,
+ AppFetcher $appFetcher,
+ IFactory $l10nFactory,
+ BundleFetcher $bundleFetcher,
+ Installer $installer,
+ IURLGenerator $urlGenerator,
+ LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->l10n = $l10n;
$this->config = $config;
* @param LoggerInterface $logger
*/
public function __construct(string $appName,
- IRequest $request,
- IProvider $tokenProvider,
- ISession $session,
- ISecureRandom $random,
- ?string $userId,
- IUserSession $userSession,
- IManager $activityManager,
- RemoteWipe $remoteWipe,
- LoggerInterface $logger) {
+ IRequest $request,
+ IProvider $tokenProvider,
+ ISession $session,
+ ISecureRandom $random,
+ ?string $userId,
+ IUserSession $userSession,
+ IManager $activityManager,
+ RemoteWipe $remoteWipe,
+ LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->tokenProvider = $tokenProvider;
$this->uid = $userId;
use OC\Settings\AuthorizedGroup;
use OCA\Settings\Service\AuthorizedGroupService;
use OCA\Settings\Service\NotFoundException;
+use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\DataResponse;
use OCP\DB\Exception;
use OCP\IRequest;
-use OCP\AppFramework\Http\DataResponse;
-use OCP\AppFramework\Controller;
class AuthorizedGroupController extends Controller {
/** @var AuthorizedGroupService $authorizedGroupService */
private IAppManager $appManager;
public function __construct(string $appName,
- IRequest $request,
- ?string $userId,
- IUserManager $userManager,
- IUserSession $userSession,
- IGroupManager $groupManager,
- IAppManager $appManager,
- IL10N $l) {
+ IRequest $request,
+ ?string $userId,
+ IUserManager $userManager,
+ IUserSession $userSession,
+ IGroupManager $groupManager,
+ IAppManager $appManager,
+ IL10N $l) {
parent::__construct($appName, $request);
$this->userId = $userId;
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IURLGenerator;
-use OCP\IConfig;
#[IgnoreOpenAPI]
class HelpController extends Controller {
* @param IMailer $mailer
*/
public function __construct($appName,
- IRequest $request,
- IL10N $l10n,
- IConfig $config,
- IUserSession $userSession,
- IURLGenerator $urlGenerator,
- IMailer $mailer) {
+ IRequest $request,
+ IL10N $l10n,
+ IConfig $config,
+ IUserSession $userSession,
+ IURLGenerator $urlGenerator,
+ IMailer $mailer) {
parent::__construct($appName, $request);
$this->l10n = $l10n;
$this->config = $config;
* @return DataResponse
*/
public function setMailSettings($mail_domain,
- $mail_from_address,
- $mail_smtpmode,
- $mail_smtpsecure,
- $mail_smtphost,
- $mail_smtpauth,
- $mail_smtpport,
- $mail_sendmailmode) {
+ $mail_from_address,
+ $mail_smtpmode,
+ $mail_smtpsecure,
+ $mail_smtphost,
+ $mail_smtpauth,
+ $mail_smtpport,
+ $mail_sendmailmode) {
$params = get_defined_vars();
$configs = [];
foreach ($params as $key => $value) {
private $mandatoryTwoFactor;
public function __construct(string $appName,
- IRequest $request,
- MandatoryTwoFactor $mandatoryTwoFactor) {
+ IRequest $request,
+ MandatoryTwoFactor $mandatoryTwoFactor) {
parent::__construct($appName, $request);
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
* @return DataResponse
*/
public function setUserSettings(?string $avatarScope = null,
- ?string $displayname = null,
- ?string $displaynameScope = null,
- ?string $phone = null,
- ?string $phoneScope = null,
- ?string $email = null,
- ?string $emailScope = null,
- ?string $website = null,
- ?string $websiteScope = null,
- ?string $address = null,
- ?string $addressScope = null,
- ?string $twitter = null,
- ?string $twitterScope = null,
- ?string $fediverse = null,
- ?string $fediverseScope = null
+ ?string $displayname = null,
+ ?string $displaynameScope = null,
+ ?string $phone = null,
+ ?string $phoneScope = null,
+ ?string $email = null,
+ ?string $emailScope = null,
+ ?string $website = null,
+ ?string $websiteScope = null,
+ ?string $address = null,
+ ?string $addressScope = null,
+ ?string $twitter = null,
+ ?string $twitterScope = null,
+ ?string $fediverse = null,
+ ?string $fediverseScope = null
) {
$user = $this->userSession->getUser();
if (!$user instanceof IUser) {
protected $defaults;
public function __construct(IActivityManager $activityManager,
- IGroupManager $groupManager,
- IUserManager $userManager,
- IUserSession $userSession,
- IURLGenerator $urlGenerator,
- IMailer $mailer,
- IConfig $config,
- IFactory $languageFactory,
- Defaults $defaults) {
+ IGroupManager $groupManager,
+ IUserManager $userManager,
+ IUserSession $userSession,
+ IURLGenerator $urlGenerator,
+ IMailer $mailer,
+ IConfig $config,
+ IFactory $languageFactory,
+ Defaults $defaults) {
$this->activityManager = $activityManager;
$this->groupManager = $groupManager;
$this->userManager = $userManager;
private $logger;
public function __construct(IActivityManager $activityManager,
- IUserSession $userSession,
- LoggerInterface $logger) {
+ IUserSession $userSession,
+ LoggerInterface $logger) {
$this->activityManager = $activityManager;
$this->userSession = $userSession;
$this->logger = $logger;
* @param string $fromAddress
*/
public function __construct(Defaults $themingDefaults,
- IURLGenerator $urlGenerator,
- IFactory $l10nFactory,
- IMailer $mailer,
- ISecureRandom $secureRandom,
- ITimeFactory $timeFactory,
- IConfig $config,
- ICrypto $crypto,
- $fromAddress) {
+ IURLGenerator $urlGenerator,
+ IFactory $l10nFactory,
+ IMailer $mailer,
+ ISecureRandom $secureRandom,
+ ITimeFactory $timeFactory,
+ IConfig $config,
+ ICrypto $crypto,
+ $fromAddress) {
$this->themingDefaults = $themingDefaults;
$this->urlGenerator = $urlGenerator;
$this->l10nFactory = $l10nFactory;
* @throws \Exception If mail could not be sent
*/
public function sendMail(IUser $user,
- IEMailTemplate $emailTemplate): void {
+ IEMailTemplate $emailTemplate): void {
// Be sure to never try to send to an empty e-mail
$email = $user->getEMailAddress();
* @param IL10N $l10n
*/
public function __construct(ControllerMethodReflector $reflector,
- $isSubAdmin,
- IL10N $l10n) {
+ $isSubAdmin,
+ IL10N $l10n) {
$this->reflector = $reflector;
$this->isSubAdmin = $isSubAdmin;
$this->l10n = $l10n;
protected $l;
public function __construct(IManager $settingsManager,
- IGroupManager $groupManager,
- IURLGenerator $urlGenerator,
- IL10N $l) {
+ IGroupManager $groupManager,
+ IURLGenerator $urlGenerator,
+ IL10N $l) {
$this->settingsManager = $settingsManager;
$this->groupManager = $groupManager;
$this->urlGenerator = $urlGenerator;
namespace OCA\Settings\Service;
-use OCP\AppFramework\Db\DoesNotExistException;
-use OCP\AppFramework\Db\MultipleObjectsReturnedException;
-
use OC\Settings\AuthorizedGroup;
use OC\Settings\AuthorizedGroupMapper;
+
+use OCP\AppFramework\Db\DoesNotExistException;
+use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\DB\Exception;
use OCP\IGroup;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IGroupManager;
+use OCP\IURLGenerator;
use OCP\Settings\IDelegatedSettings;
use OCP\Settings\IManager;
use OCP\Settings\ISettings;
-use OCP\IURLGenerator;
class Delegation implements ISettings {
private IManager $settingManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\Encryption\IManager;
-use OCP\IUserManager;
use OCP\IURLGenerator;
+use OCP\IUserManager;
use OCP\Settings\ISettings;
class Security implements ISettings {
private IURLGenerator $urlGenerator;
public function __construct(IManager $manager,
- IUserManager $userManager,
- MandatoryTwoFactor $mandatoryTwoFactor,
- IInitialState $initialState,
- IURLGenerator $urlGenerator) {
+ IUserManager $userManager,
+ MandatoryTwoFactor $mandatoryTwoFactor,
+ IInitialState $initialState,
+ IURLGenerator $urlGenerator) {
$this->manager = $manager;
$this->userManager = $userManager;
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
private IURLGenerator $urlGenerator;
public function __construct(IDBConnection $connection,
- IInitialState $initialStateService,
- ProfileManager $profileManager,
- ITimeFactory $timeFactory,
- IURLGenerator $urlGenerator,
- IConfig $config,
- IL10N $l) {
+ IInitialState $initialStateService,
+ ProfileManager $profileManager,
+ ITimeFactory $timeFactory,
+ IURLGenerator $urlGenerator,
+ IConfig $config,
+ IL10N $l) {
$this->connection = $connection;
$this->initialStateService = $initialStateService;
$this->profileManager = $profileManager;
namespace OCA\Settings\Settings\Personal;
+use OC\Profile\ProfileManager;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\L10N\IFactory;
-use OC\Profile\ProfileManager;
use OCP\Notification\IManager;
use OCP\Settings\ISettings;
*/
namespace OCA\Settings\Settings\Personal\Security;
-use OCP\AppFramework\Services\IInitialState;
-use OCP\IUserSession;
-use function array_map;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Token\INamedToken;
use OC\Authentication\Token\IProvider as IAuthTokenProvider;
use OC\Authentication\Token\IToken;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\AppFramework\Services\IInitialState;
use OCP\ISession;
+use OCP\IUserSession;
use OCP\Session\Exceptions\SessionNotAvailableException;
use OCP\Settings\ISettings;
+use function array_map;
class Authtokens implements ISettings {
private $userSession;
public function __construct(IAuthTokenProvider $tokenProvider,
- ISession $session,
- IUserSession $userSession,
- IInitialState $initialState,
- ?string $UserId) {
+ ISession $session,
+ IUserSession $userSession,
+ IInitialState $initialState,
+ ?string $UserId) {
$this->tokenProvider = $tokenProvider;
$this->session = $session;
$this->initialState = $initialState;
private $uid;
public function __construct(IUserManager $userManager,
- ?string $UserId) {
+ ?string $UserId) {
$this->userManager = $userManager;
$this->uid = $UserId;
}
use Exception;
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
-use OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider;
-use function array_filter;
-use function array_map;
-use function is_null;
use OC\Authentication\TwoFactorAuth\ProviderLoader;
+use OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings;
use OCP\IConfig;
use OCP\IUserSession;
use OCP\Settings\ISettings;
+use function array_filter;
+use function array_map;
+use function is_null;
class TwoFactor implements ISettings {
private $config;
public function __construct(ProviderLoader $providerLoader,
- MandatoryTwoFactor $mandatoryTwoFactor,
- IUserSession $userSession,
- IConfig $config,
- ?string $UserId) {
+ MandatoryTwoFactor $mandatoryTwoFactor,
+ IUserSession $userSession,
+ IConfig $config,
+ ?string $UserId) {
$this->providerLoader = $providerLoader;
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
$this->userSession = $userSession;
private $manager;
public function __construct(PublicKeyCredentialMapper $mapper,
- string $UserId,
- IInitialStateService $initialStateService,
- Manager $manager) {
+ string $UserId,
+ IInitialStateService $initialStateService,
+ Manager $manager) {
$this->mapper = $mapper;
$this->uid = $UserId;
$this->initialStateService = $initialStateService;
private $urlGenerator;
public function __construct(IRegistry $registry,
- IEventDispatcher $eventDispatcher,
- IRootFolder $rootFolder,
- IUserSession $userSession,
- IInitialState $initialState,
- IURLGenerator $urlGenerator) {
+ IEventDispatcher $eventDispatcher,
+ IRootFolder $rootFolder,
+ IUserSession $userSession,
+ IInitialState $initialState,
+ IURLGenerator $urlGenerator) {
$this->registry = $registry;
$this->eventDispatcher = $eventDispatcher;
$this->rootFolder = $rootFolder;
<ul>
<li>
<a class="icon-user <?php if ($_['mode'] === 'user') {
- p('active');
- } ?>" <?php if ($_['mode'] === 'user') { print_unescaped('aria-current="page"'); } ?>
+ p('active');
+ } ?>" <?php if ($_['mode'] === 'user') {
+ print_unescaped('aria-current="page"');
+ } ?>
href="<?php print_unescaped($_['urlUserDocs']); ?>">
<span class="help-list__text">
<?php p($l->t('User documentation')); ?>
<?php if ($_['admin']) { ?>
<li>
<a class="icon-user-admin <?php if ($_['mode'] === 'admin') {
- p('active');
- } ?>" <?php if ($_['mode'] === 'admin') { print_unescaped('aria-current="page"'); } ?>
+ p('active');
+ } ?>" <?php if ($_['mode'] === 'admin') {
+ print_unescaped('aria-current="page"');
+ } ?>
href="<?php print_unescaped($_['urlAdminDocs']); ?>">
<span class="help-list__text">
<?php p($l->t('Administrator documentation')); ?>
if (isset($form['form'])) {?>
<div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div>
<?php }
-} ?>
+ } ?>
<?php
/**
- * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
+ * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
/** @var \OCP\IL10N $l */
/** @var array $_ */
<p>
<label id="mail_smtpsecure_label" for="mail_smtpsecure"
<?php if ($_['mail_smtpmode'] !== 'smtp') {
- print_unescaped(' class="hidden"');
- } ?>>
+ print_unescaped(' class="hidden"');
+ } ?>>
<?php p($l->t('Encryption')); ?>
</label>
<select name="mail_smtpsecure" id="mail_smtpsecure"
<?php if ($_['mail_smtpmode'] !== 'smtp') {
- print_unescaped(' class="hidden"');
- } ?>>
+ print_unescaped(' class="hidden"');
+ } ?>>
<?php foreach ($mail_smtpsecure as $secure => $name):
$selected = '';
if ($secure == $_['mail_smtpsecure']):
</form>
<form class="mail_settings" id="mail_credentials_settings">
<p id="mail_credentials" <?php if (!$_['mail_smtpauth'] || $_['mail_smtpmode'] !== 'smtp') {
- print_unescaped(' class="hidden"');
- } ?>>
+ print_unescaped(' class="hidden"');
+ } ?>>
<label for="mail_smtpname"><?php p($l->t('Credentials')); ?></label>
<input type="text" name="mail_smtpname" id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>"
value="<?php p($_['mail_smtpname']) ?>" />
</div>
<div id="postsetupchecks" data-check-wellknown="<?php if ($_['checkForWorkingWellKnownSetup']) {
- p('true');
-} else {
- p('false');
-} ?>">
+ p('true');
+ } else {
+ p('false');
+ } ?>">
<ul class="errors hidden"></ul>
<ul class="warnings hidden"></ul>
<ul class="info hidden"></ul>
*
*/
- # used for Personal/Additional settings as fallback for legacy settings
+# used for Personal/Additional settings as fallback for legacy settings
<?php
}
}
- ?>
+?>
</ul>
</nav>
<?php
}
}
- ?>
+?>
</ul>
</nav>
</div>
$l->t('Subscribe to our newsletter'),
],
-'{facebookopen}<img width="50" src="{facebookimage}" title="{facebooktext}" alt="{facebooktext}">{linkclose}
+ '{facebookopen}<img width="50" src="{facebookimage}" title="{facebooktext}" alt="{facebooktext}">{linkclose}
{twitteropen}<img width="50" src="{twitterimage}" title="{twittertext}" alt="{twittertext}">{linkclose}
{mastodonopen}<img width="50" src="{mastodonimage}" title="{mastodontext}" alt="{mastodontext}">{linkclose}
{rssopen}<img class="img-circle" width="50" src="{rssimage}" title="{rsstext}" alt="{rsstext}">{linkclose}
/** @var \OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings $provider */
$provider = $data['provider'];
- //Handle 2FA provider icons and theme
- if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
- $icon = $provider->getDarkIcon();
- //fallback icon if the 2factor provider doesn't provide an icon.
- } else {
- $icon = image_path('core', 'actions/password.svg');
- }
- /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */
- $settings = $data['settings'];
- ?>
+ //Handle 2FA provider icons and theme
+ if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
+ $icon = $provider->getDarkIcon();
+ //fallback icon if the 2factor provider doesn't provide an icon.
+ } else {
+ $icon = image_path('core', 'actions/password.svg');
+ }
+ /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */
+ $settings = $data['settings'];
+ ?>
<h3>
<img class="two-factor-provider-settings-icon" src="<?php p($icon) ?>" alt="">
<?php p($provider->getDisplayName()) ?>
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
+use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Mail\IEMailTemplate;
use OCP\Mail\IMailer;
-use OCP\IURLGenerator;
/**
* @package Tests\Settings\Controller
* @param ?string $oldDisplayName
*/
public function testSaveUserSettings($data,
- $oldEmailAddress,
- $oldDisplayName
+ $oldEmailAddress,
+ $oldDisplayName
) {
$controller = $this->getController();
$user = $this->createMock(IUser::class);
* @param bool $expected
*/
public function testCanAdminChangeUserPasswords($encryptionEnabled,
- $encryptionModuleLoaded,
- $masterKeyEnabled,
- $expected) {
+ $encryptionModuleLoaded,
+ $masterKeyEnabled,
+ $expected) {
$controller = $this->getController();
$this->encryptionManager->expects($this->any())
use OCA\Settings\Settings\Admin\Security;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
-use OCP\IUserManager;
use OCP\IURLGenerator;
+use OCP\IUserManager;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
use OCP\IDBConnection;
-use OCP\IUrlGenerator;
use OCP\IL10N;
+use OCP\IUrlGenerator;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
use OCA\Settings\SetupChecks\PhpDefaultCharset;
use OCP\IL10N;
use OCP\SetupCheck\SetupResult;
-use Test\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
class PhpDefaultCharsetTest extends TestCase {
/** @var IL10N|MockObject */
private $appManager;
public function __construct(IManager $manager,
- SettingsManager $settingsManager,
- IAppManager $appManager) {
+ SettingsManager $settingsManager,
+ IAppManager $appManager) {
$this->manager = $manager;
$this->settingsManager = $settingsManager;
$this->appManager = $appManager;
* @param IShareHelper $shareHelper
*/
public function __construct(IGroupManager $groupManager,
- IManager $activityManager,
- IUserSession $session,
- IConfig $config,
- ISystemTagManager $tagManager,
- IAppManager $appManager,
- IMountProviderCollection $mountCollection,
- IRootFolder $rootFolder,
- IShareHelper $shareHelper) {
+ IManager $activityManager,
+ IUserSession $session,
+ IConfig $config,
+ ISystemTagManager $tagManager,
+ IAppManager $appManager,
+ IMountProviderCollection $mountCollection,
+ IRootFolder $rootFolder,
+ IShareHelper $shareHelper) {
$this->groupManager = $groupManager;
$this->activityManager = $activityManager;
$this->session = $session;
namespace OCA\SystemTags\AppInfo;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
-use OCA\SystemTags\Search\TagSearchProvider;
use OCA\SystemTags\Activity\Listener;
use OCA\SystemTags\Capabilities;
+use OCA\SystemTags\Search\TagSearchProvider;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
<?php
+
declare(strict_types=1);
/**
*/
namespace OCA\SystemTags\Search;
-use OC\Files\Search\SearchBinaryOperator;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchOrder;
use OC\Files\Search\SearchQuery;
-use OCP\SystemTag\ISystemTag;
-use OCP\SystemTag\ISystemTagManager;
-use OCP\SystemTag\ISystemTagObjectMapper;
use OCP\Files\FileInfo;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\IRootFolder;
-use OCP\Files\Search\ISearchComparison;
use OCP\Files\Node;
+use OCP\Files\Search\ISearchComparison;
use OCP\Files\Search\ISearchOrder;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Search\ISearchQuery;
use OCP\Search\SearchResult;
use OCP\Search\SearchResultEntry;
+use OCP\SystemTag\ISystemTag;
+use OCP\SystemTag\ISystemTagManager;
+use OCP\SystemTag\ISystemTagObjectMapper;
use RecursiveArrayIterator;
use RecursiveIteratorIterator;
// do search
$searchResults = $userFolder->search($fileQuery);
- $resultIds = array_map(function(Node $node) {
+ $resultIds = array_map(function (Node $node) {
return $node->getId();
}, $searchResults);
$matchedTags = $this->objectMapper->getTagIdsForObjects($resultIds, 'files');
// prepare direct tag results
- $tagResults = array_map(function(ISystemTag $tag) {
+ $tagResults = array_map(function (ISystemTag $tag) {
$thumbnailUrl = '';
$link = $this->urlGenerator->linkToRoute(
'files.view.index'
* @var ISystemTag[]
*/
$tags = $this->tagManager->getTagsByIds($tagInfo);
- $tagNames = array_map(function($tag) {
+ $tagNames = array_map(function ($tag) {
return $tag->getName();
- }, array_filter($tags, function($tag) {
+ }, array_filter($tags, function ($tag) {
return $tag->isUserVisible();
}));
// show the tag that you have searched for first
- usort($tagNames, function($tagName) use($query) {
+ usort($tagNames, function ($tagName) use ($query) {
return strpos($tagName, $query->getTerm()) !== false? -1 : 1;
});
use OCA\Testing\AlternativeHomeUserBackend;
use OCA\Testing\Provider\FakeText2ImageProvider;
-use OCA\Testing\Provider\FakeTranslationProvider;
use OCA\Testing\Provider\FakeTextProcessingProvider;
+use OCA\Testing\Provider\FakeTranslationProvider;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
* @param IConfig $config
*/
public function __construct($appName,
- IRequest $request,
- IConfig $config) {
+ IRequest $request,
+ IConfig $config) {
parent::__construct($appName, $request);
$this->config = $config;
}
* @param IRootFolder $rootFolder
*/
public function __construct($appName,
- IRequest $request,
- ILockingProvider $lockingProvider,
- FakeDBLockingProvider $fakeDBLockingProvider,
- IDBConnection $connection,
- IConfig $config,
- IRootFolder $rootFolder) {
+ IRequest $request,
+ ILockingProvider $lockingProvider,
+ FakeDBLockingProvider $fakeDBLockingProvider,
+ IDBConnection $connection,
+ IConfig $config,
+ IRootFolder $rootFolder) {
parent::__construct($appName, $request);
$this->lockingProvider = $lockingProvider;
*/
namespace OCA\Testing\Locking;
+use OC\Lock\DBLockingProvider;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IDBConnection;
-use Psr\Log\LoggerInterface;
-use OC\Lock\DBLockingProvider;
class FakeDBLockingProvider extends DBLockingProvider {
// Lock for 10 hours just to be sure
*/
namespace OCA\Theming;
-use Exception;
use OCA\Theming\AppInfo\Application;
use OCA\Theming\Service\BackgroundService;
use OCP\Capabilities\IPublicCapability;
if ($backgroundImage === BackgroundService::BACKGROUND_CUSTOM) {
$backgroundPlain = false;
$background = $this->url->linkToRouteAbsolute('theming.userTheme.getBackground');
- } else if (isset(BackgroundService::SHIPPED_BACKGROUNDS[$backgroundImage])) {
+ } elseif (isset(BackgroundService::SHIPPED_BACKGROUNDS[$backgroundImage])) {
$backgroundPlain = false;
$background = $this->url->linkTo(Application::APP_ID, "img/background/$backgroundImage");
- } else if ($backgroundImage !== BackgroundService::BACKGROUND_DEFAULT) {
+ } elseif ($backgroundImage !== BackgroundService::BACKGROUND_DEFAULT) {
$backgroundPlain = true;
$background = $color;
}
if ($icon === false || $icon === '') {
return new NotFoundResponse();
}
- $iconFileName = $this->imageManager->setCachedImage('icon-' . $app . '-' . $color . str_replace('/', '_', $image), $icon);
+ $iconFileName = $this->imageManager->setCachedImage('icon-' . $app . '-' . $color . str_replace('/', '_', $image), $icon);
}
$response = new FileDisplayResponse($iconFileName, Http::STATUS_OK, ['Content-Type' => 'image/svg+xml']);
$response->cacheFor(86400, false, true);
* @package OCA\Theming\Controller
*/
class ThemingController extends Controller {
- const VALID_UPLOAD_KEYS = ['header', 'logo', 'logoheader', 'background', 'favicon'];
+ public const VALID_UPLOAD_KEYS = ['header', 'logo', 'logoheader', 'background', 'favicon'];
private ThemingDefaults $themingDefaults;
private IL10N $l10n;
}
$theme = $themes[$themeId];
- $customCss = $theme->getCustomCss();
+ $customCss = $theme->getCustomCss();
// Generate variables
$variables = '';
// If not set, we'll rely on the body class
$compiler = new Compiler();
$compiledCss = $compiler->compileString("[data-theme-$themeId] { $variables $customCss }");
- $css = $compiledCss->getCss();;
+ $css = $compiledCss->getCss();
+ ;
}
try {
[
[
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getTouchIcon',
- ['app' => $app]) . '?v=' . $cacheBusterValue,
+ ['app' => $app]) . '?v=' . $cacheBusterValue,
'type' => 'image/png',
'sizes' => '512x512'
],
[
'src' => $this->urlGenerator->linkToRoute('theming.Icon.getFavicon',
- ['app' => $app]) . '?v=' . $cacheBusterValue,
+ ['app' => $app]) . '?v=' . $cacheBusterValue,
'type' => 'image/svg+xml',
'sizes' => '16x16'
]
private BackgroundService $backgroundService;
public function __construct(string $appName,
- IRequest $request,
- IConfig $config,
- IUserSession $userSession,
- ThemesService $themesService,
- ThemingDefaults $themingDefaults,
- BackgroundService $backgroundService) {
+ IRequest $request,
+ IConfig $config,
+ IUserSession $userSession,
+ ThemesService $themesService,
+ ThemingDefaults $themingDefaults,
+ BackgroundService $backgroundService) {
parent::__construct($appName, $request);
$this->config = $config;
$this->userSession = $userSession;
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
*/
interface ITheme {
- const TYPE_THEME = 1;
- const TYPE_FONT = 2;
+ public const TYPE_THEME = 1;
+ public const TYPE_FONT = 2;
/**
* Unique theme id
$icon->setImageFormat("png32");
$clone = clone $icon;
- $clone->scaleImage(16,0);
+ $clone->scaleImage(16, 0);
$favicon->addImage($clone);
$clone = clone $icon;
- $clone->scaleImage(32,0);
+ $clone->scaleImage(32, 0);
$favicon->addImage($clone);
$clone = clone $icon;
- $clone->scaleImage(64,0);
+ $clone->scaleImage(64, 0);
$favicon->addImage($clone);
$clone = clone $icon;
- $clone->scaleImage(128,0);
+ $clone->scaleImage(128, 0);
$favicon->addImage($clone);
$data = $favicon->getImagesBlob();
$this->config->getUserValue($userId, Application::APP_ID, 'background_color', BackgroundService::DEFAULT_COLOR),
);
- /**
+ /**
* Admin background. `backgroundColor` if disabled,
* mime type if defined and empty by default
*/
$this->initialState->provideInitialState(
'themingDefaultBackground',
- $this->config->getAppValue('theming', 'backgroundMime', ''),
+ $this->config->getAppValue('theming', 'backgroundMime', ''),
);
$this->initialState->provideInitialState(
'defaultShippedBackground',
- BackgroundService::DEFAULT_BACKGROUND_IMAGE,
+ BackgroundService::DEFAULT_BACKGROUND_IMAGE,
);
/** List of all shipped backgrounds */
$this->initialState->provideInitialState(
'shippedBackgrounds',
- BackgroundService::SHIPPED_BACKGROUNDS,
+ BackgroundService::SHIPPED_BACKGROUNDS,
);
}
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
-use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IL10N;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
$images = $this->appData->getFolder('images');
$output->info('Migrating administration images');
- // get or init the global folder if any
+ // get or init the global folder if any
try {
$global = $this->appData->getFolder('global');
} catch (NotFoundException $e) {
* MigrateUserConfig constructor.
*/
public function __construct(IConfig $config,
- IUserManager $userManager,
- ThemesService $themesService,
- DarkTheme $darkTheme,
- DarkHighContrastTheme $darkHighContrastTheme,
- HighContrastTheme $highContrastTheme,
- DyslexiaFont $dyslexiaFont) {
+ IUserManager $userManager,
+ ThemesService $themesService,
+ DarkTheme $darkTheme,
+ DarkHighContrastTheme $darkHighContrastTheme,
+ HighContrastTheme $highContrastTheme,
+ DyslexiaFont $dyslexiaFont) {
$this->config = $config;
$this->userManager = $userManager;
$this->themesService = $themesService;
if ($highcontrast || $theme) {
if ($theme === 'dark' && $highcontrast === 'highcontrast') {
$config[] = $this->darkHighContrastTheme->getId();
- } else if ($theme === 'dark') {
+ } elseif ($theme === 'dark') {
$config[] = $this->darkTheme->getId();
- } else if ($highcontrast === 'highcontrast') {
+ } elseif ($highcontrast === 'highcontrast') {
$config[] = $this->highContrastTheme->getId();
}
}
<?php
+
declare(strict_types=1);
/**
private ThemingDefaults $themingDefaults;
public function __construct(IRootFolder $rootFolder,
- IAppData $appData,
- IConfig $config,
- ?string $userId,
- ThemingDefaults $themingDefaults) {
+ IAppData $appData,
+ IConfig $config,
+ ?string $userId,
+ ThemingDefaults $themingDefaults) {
if ($userId === null) {
return;
}
*/
namespace OCA\Theming\Service;
-use OCA\Theming\AppInfo\Application;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
use OCP\IConfig;
*/
namespace OCA\Theming\Service;
-use OCA\Theming\AppInfo\Application;
use OCA\Theming\Themes\DefaultTheme;
use OCA\Theming\Util;
use OCP\IConfig;
private ?string $userId;
public function __construct(IURLGenerator $urlGenerator,
- ThemesService $themesService,
- DefaultTheme $defaultTheme,
- Util $util,
- IConfig $config,
- IUserSession $userSession) {
+ ThemesService $themesService,
+ DefaultTheme $defaultTheme,
+ Util $util,
+ IConfig $config,
+ IUserSession $userSession) {
$this->urlGenerator = $urlGenerator;
$this->themesService = $themesService;
$this->defaultTheme = $defaultTheme;
public function injectHeaders() {
$themes = $this->themesService->getThemes();
$defaultTheme = $themes[$this->defaultTheme->getId()];
- $mediaThemes = array_filter($themes, function($theme) {
+ $mediaThemes = array_filter($themes, function ($theme) {
// Check if the theme provides a media query
return (bool)$theme->getMediaQuery();
});
private array $themesProviders;
public function __construct(IUserSession $userSession,
- IConfig $config,
- DefaultTheme $defaultTheme,
- LightTheme $lightTheme,
- DarkTheme $darkTheme,
- HighContrastTheme $highContrastTheme,
- DarkHighContrastTheme $darkHighContrastTheme,
- DyslexiaFont $dyslexiaFont) {
+ IConfig $config,
+ DefaultTheme $defaultTheme,
+ LightTheme $lightTheme,
+ DarkTheme $darkTheme,
+ HighContrastTheme $highContrastTheme,
+ DarkHighContrastTheme $darkHighContrastTheme,
+ DyslexiaFont $dyslexiaFont) {
$this->userSession = $userSession;
$this->config = $config;
// Register themes
$this->themesProviders = [
- $defaultTheme->getId() => $defaultTheme,
- $lightTheme->getId() => $lightTheme,
- $darkTheme->getId() => $darkTheme,
- $highContrastTheme->getId() => $highContrastTheme,
- $darkHighContrastTheme->getId() => $darkHighContrastTheme,
- $dyslexiaFont->getId() => $dyslexiaFont,
+ $defaultTheme->getId() => $defaultTheme,
+ $lightTheme->getId() => $lightTheme,
+ $darkTheme->getId() => $darkTheme,
+ $highContrastTheme->getId() => $highContrastTheme,
+ $darkHighContrastTheme->getId() => $darkHighContrastTheme,
+ $dyslexiaFont->getId() => $dyslexiaFont,
];
}
/**
* Get the list of all registered themes
- *
+ *
* @return ITheme[]
*/
public function getThemes(): array {
/**
* Enable a theme for the logged-in user
- *
+ *
* @param ITheme $theme the theme to enable
* @return string[] the enabled themes
*/
}
/** @var ITheme[] */
- $themes = array_filter(array_map(function($themeId) {
+ $themes = array_filter(array_map(function ($themeId) {
return $this->getThemes()[$themeId];
}, $themesIds));
// Filtering all themes with the same type
- $filteredThemes = array_filter($themes, function(ITheme $t) use ($theme) {
+ $filteredThemes = array_filter($themes, function (ITheme $t) use ($theme) {
return $theme->getType() === $t->getType();
});
// Retrieve IDs only
/** @var string[] */
- $filteredThemesIds = array_map(function(ITheme $t) {
+ $filteredThemesIds = array_map(function (ITheme $t) {
return $t->getId();
}, array_values($filteredThemes));
/**
* Disable a theme for the logged-in user
- *
+ *
* @param ITheme $theme the theme to disable
* @return string[] the enabled themes
*/
/**
* Check whether a theme is enabled or not
* for the logged-in user
- *
+ *
* @return bool
*/
public function isEnabled(ITheme $theme): bool {
/**
* Get the list of all enabled themes IDs
* for the logged-in user
- *
+ *
* @return string[]
*/
public function getEnabledThemes(): array {
}
/**
- * Set the list of enabled themes
+ * Set the list of enabled themes
* for the logged-in user
- *
+ *
* @param string[] $themes the list of enabled themes IDs
*/
private function setEnabledThemes(array $themes): void {
$errorMessage = $this->l->t('You are already using a custom theme. Theming app settings might be overwritten by that.');
}
- $allowedMimeTypes = array_reduce(ThemingController::VALID_UPLOAD_KEYS, function($carry, $key) {
+ $allowedMimeTypes = array_reduce(ThemingController::VALID_UPLOAD_KEYS, function ($carry, $key) {
$carry[$key] = $this->imageManager->getSupportedUploadImageFormats($key);
return $carry;
}, []);
public function getForm(): TemplateResponse {
$enforcedTheme = $this->config->getSystemValueString('enforce_theme', '');
- $themes = array_map(function($theme) {
+ $themes = array_map(function ($theme) {
return [
'id' => $theme->getId(),
'type' => $theme->getType(),
}, $this->themesService->getThemes());
if ($enforcedTheme !== '') {
- $themes = array_filter($themes, function($theme) use ($enforcedTheme) {
+ $themes = array_filter($themes, function ($theme) use ($enforcedTheme) {
return $theme['type'] !== ITheme::TYPE_THEME || $theme['id'] === $enforcedTheme;
});
}
* @param IL10N $l
*/
public function __construct(string $appName,
- IURLGenerator $urlGenerator,
- IL10N $l) {
+ IURLGenerator $urlGenerator,
+ IL10N $l) {
$this->appName = $appName;
$this->urlGenerator = $urlGenerator;
$this->l = $l;
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
*/
namespace OCA\Theming\Themes;
-use OCA\Theming\Util;
-use OCA\Theming\ImageManager;
use OCA\Theming\AppInfo\Application;
+use OCA\Theming\ImageManager;
use OCA\Theming\Service\BackgroundService;
+use OCA\Theming\Util;
trait CommonThemeTrait {
public Util $util;
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
$colorMainText = '#ffffff';
$colorMainBackground = '#000000';
- $colorMainBackgroundRGB = join(',', $this->util->hexToRGB($colorMainBackground));
+ $colorMainBackgroundRGB = join(',', $this->util->hexToRGB($colorMainBackground));
return array_merge(
$defaultVariables,
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
public string $primaryColor;
public function __construct(Util $util,
- ThemingDefaults $themingDefaults,
- IUserSession $userSession,
- IURLGenerator $urlGenerator,
- ImageManager $imageManager,
- IConfig $config,
- IL10N $l,
- IAppManager $appManager) {
+ ThemingDefaults $themingDefaults,
+ IUserSession $userSession,
+ IURLGenerator $urlGenerator,
+ ImageManager $imageManager,
+ IConfig $config,
+ IL10N $l,
+ IAppManager $appManager) {
$this->util = $util;
$this->themingDefaults = $themingDefaults;
$this->userSession = $userSession;
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
";
}
}
-
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
$colorMainText = '#000000';
$colorMainBackground = '#ffffff';
- $colorMainBackgroundRGB = join(',', $this->util->hexToRGB($colorMainBackground));
+ $colorMainBackgroundRGB = join(',', $this->util->hexToRGB($colorMainBackground));
return array_merge(
$defaultVariables,
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com>
*/
namespace OCA\Theming\Themes;
-use OCA\Theming\ImageManager;
-use OCA\Theming\ThemingDefaults;
-use OCA\Theming\Util;
use OCA\Theming\ITheme;
-use OCA\Theming\Themes\DefaultTheme;
-use OCP\IConfig;
-use OCP\IL10N;
-use OCP\IURLGenerator;
class LightTheme extends DefaultTheme implements ITheme {
* @param IAppManager $appManager
*/
public function __construct(IConfig $config,
- IL10N $l,
- IUserSession $userSession,
- IURLGenerator $urlGenerator,
- ICacheFactory $cacheFactory,
- Util $util,
- ImageManager $imageManager,
- IAppManager $appManager,
- INavigationManager $navigationManager
+ IL10N $l,
+ IUserSession $userSession,
+ IURLGenerator $urlGenerator,
+ ICacheFactory $cacheFactory,
+ Util $util,
+ ImageManager $imageManager,
+ IAppManager $appManager,
+ INavigationManager $navigationManager
) {
parent::__construct();
$this->config = $config;
*/
namespace OCA\Theming;
+use Mexitek\PHPColors\Color;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\Files\IAppData;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use OCP\IUserSession;
-use Mexitek\PHPColors\Color;
class Util {
use OC\L10N\L10N;
use OCA\Theming\Controller\ThemingController;
-use OCA\Theming\Service\ThemesService;
use OCA\Theming\ImageManager;
+use OCA\Theming\Service\ThemesService;
use OCA\Theming\ThemingDefaults;
use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCA\Theming\Controller\UserThemeController;
use OCA\Theming\ITheme;
use OCA\Theming\Service\BackgroundService;
+use OCA\Theming\Service\ThemesService;
use OCA\Theming\Themes\DarkHighContrastTheme;
use OCA\Theming\Themes\DarkTheme;
use OCA\Theming\Themes\DefaultTheme;
use OCA\Theming\Themes\DyslexiaFont;
use OCA\Theming\Themes\HighContrastTheme;
-use OCA\Theming\Service\ThemesService;
use OCA\Theming\Themes\LightTheme;
use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Http\DataResponse;
$util->expects($this->once())
->method('getAppImage')
->willReturn('notexistingfile');
- $this->assertFalse($iconBuilder->colorSvg('noapp','noimage'));
+ $this->assertFalse($iconBuilder->colorSvg('noapp', 'noimage'));
}
}
use OCA\Theming\AppInfo\Application;
use OCA\Theming\ImageManager;
use OCA\Theming\ITheme;
+use OCA\Theming\Service\ThemesService;
use OCA\Theming\Themes\DarkHighContrastTheme;
use OCA\Theming\Themes\DarkTheme;
use OCA\Theming\Themes\DefaultTheme;
use OCA\Theming\Themes\DyslexiaFont;
use OCA\Theming\Themes\HighContrastTheme;
-use OCA\Theming\Service\ThemesService;
use OCA\Theming\Themes\LightTheme;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
+use OCP\App\IAppManager;
use OCP\IConfig;
use OCP\IL10N;
-use OCP\App\IAppManager;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCA\Theming\AppInfo\Application;
use OCA\Theming\ImageManager;
+use OCA\Theming\ITheme;
use OCA\Theming\Service\ThemesService;
use OCA\Theming\Settings\Personal;
use OCA\Theming\Themes\DarkHighContrastTheme;
use OCA\Theming\Themes\LightTheme;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
-use OCA\Theming\ITheme;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
*/
namespace OCA\Theming\Tests\Service;
-use OC\App\AppManager;
use OC\Route\Router;
use OCA\Theming\ImageManager;
use OCA\Theming\ITheme;
private $jobList;
public function __construct(IRegistry $registry,
- IUserManager $userManager,
- ITimeFactory $timeFactory,
- IManager $notificationManager,
- IJobList $jobList) {
+ IUserManager $userManager,
+ ITimeFactory $timeFactory,
+ IManager $notificationManager,
+ IJobList $jobList) {
parent::__construct($timeFactory);
$this->registry = $registry;
$this->userManager = $userManager;
private $jobList;
public function __construct(IRegistry $registry,
- IJobList $jobList) {
+ IJobList $jobList) {
$this->registry = $registry;
$this->jobList = $jobList;
}
private $jobList;
public function __construct(IRegistry $registry,
- IJobList $jobList) {
+ IJobList $jobList) {
$this->registry = $registry;
$this->jobList = $jobList;
}
* @param AppManager $appManager
*/
public function __construct(string $appName,
- BackupCodeStorage $storage,
- IL10N $l10n,
- AppManager $appManager,
- IInitialStateService $initialStateService) {
+ BackupCodeStorage $storage,
+ IL10N $l10n,
+ AppManager $appManager,
+ IInitialStateService $initialStateService) {
$this->appName = $appName;
$this->l10n = $l10n;
$this->storage = $storage;
private $eventDispatcher;
public function __construct(BackupCodeMapper $mapper,
- ISecureRandom $random,
- IHasher $hasher,
- IEventDispatcher $eventDispatcher) {
+ ISecureRandom $random,
+ IHasher $hasher,
+ IEventDispatcher $eventDispatcher) {
$this->mapper = $mapper;
$this->hasher = $hasher;
$this->random = $random;
];
public function __construct(string $appName,
- IRequest $request,
- IConfig $config,
- IAppManager $appManager,
- AppFetcher $appFetcher,
- IFactory $l10nFactory,
- IUserSession $userSession) {
+ IRequest $request,
+ IConfig $config,
+ IAppManager $appManager,
+ AppFetcher $appFetcher,
+ IFactory $l10nFactory,
+ IUserSession $userSession) {
parent::__construct($appName, $request);
$this->config = $config;
$this->language = $this->l10nFactory->getUserLanguage($this->userSession->getUser());
// Ignore apps that are deployed from git
- $installedApps = array_filter($installedApps, function(string $appId) {
+ $installedApps = array_filter($installedApps, function (string $appId) {
try {
return !file_exists($this->appManager->getAppPath($appId) . '/.git');
} catch (AppPathNotFoundException $e) {
* @param IL10N $l10n
*/
public function __construct($appName,
- IRequest $request,
- IJobList $jobList,
- ISecureRandom $secureRandom,
- IConfig $config,
- ITimeFactory $timeFactory,
- IL10N $l10n) {
+ IRequest $request,
+ IJobList $jobList,
+ ISecureRandom $secureRandom,
+ IConfig $config,
+ ITimeFactory $timeFactory,
+ IL10N $l10n) {
parent::__construct($appName, $request);
$this->jobList = $jobList;
$this->secureRandom = $secureRandom;
*/
namespace OCA\UpdateNotification;
-use OCP\BackgroundJob\TimedJob;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
/**
* @param ITimeFactory $timeFactory
*/
public function __construct(IConfig $config,
- ITimeFactory $timeFactory) {
+ ITimeFactory $timeFactory) {
parent::__construct($timeFactory);
// Run all 10 minutes
parent::setInterval(60 * 10);
<?php
+
declare(strict_types=1);
/**
namespace OCA\UpdateNotification\Settings;
use OC\User\Backend;
-use OCP\User\Backend\ICountUsersBackend;
use OCA\UpdateNotification\UpdateChecker;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\IDateTimeFormatter;
use OCP\IGroupManager;
+use OCP\IUserManager;
use OCP\L10N\IFactory;
use OCP\Settings\ISettings;
use OCP\Support\Subscription\IRegistry;
+use OCP\User\Backend\ICountUsersBackend;
use OCP\Util;
-use OCP\IUserManager;
use Psr\Log\LoggerInterface;
class Admin implements ISettings {
IRegistry $subscriptionRegistry,
IUserManager $userManager,
LoggerInterface $logger,
- IInitialState $initialState
+ IInitialState $initialState
) {
$this->config = $config;
$this->updateChecker = $updateChecker;
* later. See the COPYING file.
*/
\OCP\Util::addScript('updatenotification', 'updatenotification');
- ?>
+?>
<div id="updatenotification"></div>
*/
namespace OCA\UpdateNotification\Tests\Settings;
+use OC\User\Backend;
use OCA\UpdateNotification\Settings\Admin;
use OCA\UpdateNotification\UpdateChecker;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\IDateTimeFormatter;
use OCP\IGroup;
use OCP\L10N\IFactory;
use OCP\L10N\ILanguageIterator;
use OCP\Support\Subscription\IRegistry;
-use OCP\UserInterface;
use OCP\User\Backend\ICountUsersBackend;
-use OCP\AppFramework\Services\IInitialState;
+use OCP\UserInterface;
use OCP\Util;
-use OC\User\Backend;
use Psr\Log\LoggerInterface;
use Test\TestCase;
$this->initialState = $this->createMock(IInitialState::class);
$this->admin = new Admin(
- $this->config,
- $this->updateChecker,
- $this->groupManager,
- $this->dateTimeFormatter,
- $this->l10nFactory,
+ $this->config,
+ $this->updateChecker,
+ $this->groupManager,
+ $this->dateTimeFormatter,
+ $this->l10nFactory,
$this->subscriptionRegistry,
$this->userManager,
$this->logger,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\Mapping\GroupMapping;
+use OCA\User_LDAP\Mapping\UserMapping;
// Check user and app status
\OC_JSON::checkAdminUser();
}
$this->logger->debug('Ready for a paged search', ['app' => 'user_ldap']);
return [true, $pageSize, $this->lastCookie];
- /* ++ Fixing RHDS searches with pages with zero results ++
- * We couldn't get paged searches working with our RHDS for login ($limit = 0),
- * due to pages with zero results.
- * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
- * if we don't have a previous paged search.
- */
+ /* ++ Fixing RHDS searches with pages with zero results ++
+ * We couldn't get paged searches working with our RHDS for login ($limit = 0),
+ * due to pages with zero results.
+ * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
+ * if we don't have a previous paged search.
+ */
} elseif ($this->lastCookie !== '') {
// a search without limit was requested. However, if we do use
// Paged Search once, we always must do it. This requires us to
use OCA\User_LDAP\LDAP;
use OCA\User_LDAP\LoginListener;
use OCA\User_LDAP\Notification\Notifier;
+use OCA\User_LDAP\SetupChecks\LdapInvalidUuids;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User_Proxy;
use OCA\User_LDAP\UserPluginManager;
-use OCA\User_LDAP\SetupChecks\LdapInvalidUuids;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
->setName('ldap:check-user')
->setDescription('checks whether a user exists on LDAP.')
->addArgument(
- 'ocName',
- InputArgument::REQUIRED,
- 'the user name as used in Nextcloud, or the LDAP DN'
- )
+ 'ocName',
+ InputArgument::REQUIRED,
+ 'the user name as used in Nextcloud, or the LDAP DN'
+ )
->addOption(
- 'force',
- null,
- InputOption::VALUE_NONE,
- 'ignores disabled LDAP configuration'
- )
+ 'force',
+ null,
+ InputOption::VALUE_NONE,
+ 'ignores disabled LDAP configuration'
+ )
->addOption(
'update',
null,
->setName('ldap:delete-config')
->setDescription('deletes an existing LDAP configuration')
->addArgument(
- 'configID',
- InputArgument::REQUIRED,
- 'the configuration ID'
- )
+ 'configID',
+ InputArgument::REQUIRED,
+ 'the configuration ID'
+ )
;
}
->setName('ldap:search')
->setDescription('executes a user or group search')
->addArgument(
- 'search',
- InputArgument::REQUIRED,
- 'the search string (can be empty)'
- )
+ 'search',
+ InputArgument::REQUIRED,
+ 'the search string (can be empty)'
+ )
->addOption(
- 'group',
- null,
- InputOption::VALUE_NONE,
- 'searches groups instead of users'
- )
+ 'group',
+ null,
+ InputOption::VALUE_NONE,
+ 'searches groups instead of users'
+ )
->addOption(
- 'offset',
- null,
- InputOption::VALUE_REQUIRED,
- 'The offset of the result set. Needs to be a multiple of limit. defaults to 0.',
- '0'
- )
+ 'offset',
+ null,
+ InputOption::VALUE_REQUIRED,
+ 'The offset of the result set. Needs to be a multiple of limit. defaults to 0.',
+ '0'
+ )
->addOption(
- 'limit',
- null,
- InputOption::VALUE_REQUIRED,
- 'limit the results. 0 means no limit, defaults to 15',
- '15'
- )
+ 'limit',
+ null,
+ InputOption::VALUE_REQUIRED,
+ 'limit the results. 0 means no limit, defaults to 15',
+ '15'
+ )
;
}
->setName('ldap:set-config')
->setDescription('modifies an LDAP configuration')
->addArgument(
- 'configID',
- InputArgument::REQUIRED,
- 'the configuration ID'
- )
+ 'configID',
+ InputArgument::REQUIRED,
+ 'the configuration ID'
+ )
->addArgument(
- 'configKey',
- InputArgument::REQUIRED,
- 'the configuration key'
- )
+ 'configKey',
+ InputArgument::REQUIRED,
+ 'the configuration key'
+ )
->addArgument(
- 'configValue',
- InputArgument::REQUIRED,
- 'the new configuration value'
- )
+ 'configValue',
+ InputArgument::REQUIRED,
+ 'the new configuration value'
+ )
;
}
->setName('ldap:show-config')
->setDescription('shows the LDAP configuration')
->addArgument(
- 'configID',
- InputArgument::OPTIONAL,
- 'will show the configuration of the specified id'
- )
+ 'configID',
+ InputArgument::OPTIONAL,
+ 'will show the configuration of the specified id'
+ )
->addOption(
- 'show-password',
- null,
- InputOption::VALUE_NONE,
- 'show ldap bind password'
- )
+ 'show-password',
+ null,
+ InputOption::VALUE_NONE,
+ 'show ldap bind password'
+ )
->addOption(
- 'output',
- null,
- InputOption::VALUE_OPTIONAL,
- 'Output format (table, plain, json or json_pretty, default is table)',
- 'table'
- )
+ 'output',
+ null,
+ InputOption::VALUE_OPTIONAL,
+ 'Output format (table, plain, json or json_pretty, default is table)',
+ 'table'
+ )
;
}
use function sprintf;
class UuidUpdateReport {
- const UNCHANGED = 0;
- const UNKNOWN = 1;
- const UNREADABLE = 2;
- const UPDATED = 3;
- const UNWRITABLE = 4;
- const UNMAPPED = 5;
+ public const UNCHANGED = 0;
+ public const UNKNOWN = 1;
+ public const UNREADABLE = 2;
+ public const UPDATED = 3;
+ public const UNWRITABLE = 4;
+ public const UNMAPPED = 5;
public $id = '';
public $dn = '';
if (!empty($report->id)) {
$output->writeln(sprintf(' %s: %s',
$report->isUser ? 'User' : 'Group', $report->id));
- } else if (!empty($report->dn)) {
+ } elseif (!empty($report->dn)) {
$output->writeln(sprintf(' DN: %s', $report->dn));
}
}
if ($output->isVerbose()) {
/** @var UuidUpdateReport $report */
foreach ($this->reports[UuidUpdateReport::UNKNOWN] as $report) {
- $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id));
+ $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id));
}
$output->writeln(PHP_EOL . 'Old users can be removed along with their data per occ user:delete.' . PHP_EOL);
}
if ($output->isVerbose()) {
/** @var UuidUpdateReport $report */
foreach ($this->reports[UuidUpdateReport::UNREADABLE] as $report) {
- $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id));
+ $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id));
}
}
}
if ($output->isVerbose()) {
/** @var UuidUpdateReport $report */
foreach ($this->reports[UuidUpdateReport::UNWRITABLE] as $report) {
- $output->writeln(sprintf(' %s: %s',$report->isUser ? 'User' : 'Group', $report->id));
+ $output->writeln(sprintf(' %s: %s', $report->isUser ? 'User' : 'Group', $report->id));
}
}
}
foreach($this->handleMappingBasedUpdates(false) as $_) {
yield;
}
- } else if ($input->getOption('userId')
+ } elseif ($input->getOption('userId')
|| $input->getOption('groupId')
|| $input->getOption('dn')
) {
foreach ($list as $row) {
$access = $backendProxy->getLDAPAccess($row['name']);
if ($access instanceof Access
- && $dn = $mapping->getDNByName($row['name']))
- {
+ && $dn = $mapping->getDNByName($row['name'])) {
if ($uuid = $access->getUUID($dn, $isUser)) {
if ($uuid !== $row['uuid']) {
if ($this->dryRun || $mapping->setUUIDbyDN($uuid, $dn)) {
protected function estimateNumberOfUpdates(InputInterface $input): int {
if ($input->getOption('all')) {
return $this->userMapping->count() + $this->groupMapping->count();
- } else if ($input->getOption('userId')
+ } elseif ($input->getOption('userId')
|| $input->getOption('groupId')
|| $input->getOption('dn')
) {
-<?php declare(strict_types = 1);
+<?php
+
+declare(strict_types = 1);
/**
* @copyright 2022 Carl Schwan <carl@carlschwan.eu>
*
$plugin = $this->which[GroupInterface::COUNT_USERS];
if ($plugin) {
- return $plugin->countUsersInGroup($gid,$search);
+ return $plugin->countUsersInGroup($gid, $search);
}
throw new \Exception('No plugin implements countUsersInGroup in this LDAP Backend.');
}
use OC\ServerNotAvailableException;
use OCA\User_LDAP\User\OfflineUser;
use OCP\Cache\CappedMemoryCache;
-use OCP\GroupInterface;
use OCP\Group\Backend\ABackend;
use OCP\Group\Backend\IDeleteGroupBackend;
use OCP\Group\Backend\IGetDisplayNameBackend;
+use OCP\GroupInterface;
use OCP\IConfig;
use OCP\IUserManager;
use OCP\Server;
protected CappedMemoryCache $sanitizeDnCache;
public function __construct(IConfig $config,
- IDBConnection $connection) {
+ IDBConnection $connection) {
$this->config = $config;
$this->connection = $connection;
$this->sanitizeDnCache = new CappedMemoryCache(10000);
*/
namespace OCA\User_LDAP\Jobs;
-use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\BackgroundJob\TimedJob;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User\DeletedUsersIndex;
use OCA\User_LDAP\User_LDAP;
use OCA\User_LDAP\User_Proxy;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\TimedJob;
/**
* Class CleanUp
*/
namespace OCA\User_LDAP\Jobs;
+use OCA\User_LDAP\Service\UpdateGroupsService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\DB\Exception;
use OCP\IConfig;
-use OCA\User_LDAP\Service\UpdateGroupsService;
use Psr\Log\LoggerInterface;
class UpdateGroups extends TimedJob {
*/
namespace OCA\User_LDAP;
-use OCP\IConfig;
-use OCP\Profiler\IProfiler;
use OC\ServerNotAvailableException;
use OCA\User_LDAP\DataCollector\LdapDataCollector;
use OCA\User_LDAP\Exceptions\ConstraintViolationException;
+use OCP\IConfig;
+use OCP\Profiler\IProfiler;
use Psr\Log\LoggerInterface;
class LDAP implements ILDAPWrapper {
->setParameter('owncloud_name', $row['owncloud_name'])
->setParameter('directory_uuid', $row['directory_uuid'])
->setParameter('ldap_dn_hash', $row['ldap_dn_hash'])
- ;
+ ;
$insert->executeStatement();
}
private $helper;
public function __construct(IConfig $config,
- Helper $helper) {
+ Helper $helper) {
$this->config = $config;
$this->helper = $helper;
}
*/
namespace OCA\User_LDAP\Migration;
-use OCA\User_LDAP\User_Proxy;
use OCA\User_LDAP\Mapping\UserMapping;
+use OCA\User_LDAP\User_Proxy;
class UUIDFixUser extends UUIDFix {
public function __construct(UserMapping $mapper, User_Proxy $proxy) {
namespace OCA\User_LDAP\Migration;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use OCP\DB\Exception;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
-use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\IUserManager;
use OCP\Migration\IOutput;
*/
namespace OCA\User_LDAP\User;
-use OCP\Cache\CappedMemoryCache;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\FilesystemHelper;
+use OCP\Cache\CappedMemoryCache;
use OCP\IAvatarManager;
use OCP\IConfig;
use OCP\IDBConnection;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\Exceptions\AttributeNotSet;
use OCA\User_LDAP\FilesystemHelper;
+use OCP\Accounts\IAccountManager;
+use OCP\Accounts\PropertyDoesNotExistException;
use OCP\IAvatarManager;
use OCP\IConfig;
use OCP\Image;
use OCP\IUser;
use OCP\IUserManager;
-use OCP\Accounts\IAccountManager;
-use OCP\Accounts\PropertyDoesNotExistException;
use OCP\Notification\IManager as INotificationManager;
use OCP\Server;
use Psr\Log\LoggerInterface;
use OCP\IUserBackend;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
-use OCP\UserInterface;
use OCP\User\Backend\ICountMappedUsersBackend;
use OCP\User\Backend\ICountUsersBackend;
use OCP\User\Backend\IProvideEnabledStateBackend;
+use OCP\UserInterface;
use Psr\Log\LoggerInterface;
class User_Proxy extends Proxy implements IUserBackend, UserInterface, IUserLDAP, ICountUsersBackend, ICountMappedUsersBackend, IProvideEnabledStateBackend {
* counts users with a specified attribute
* @return int|false
*/
- public function countUsersWithAttribute(string $attr, bool $existsCheck = false) {
+ public function countUsersWithAttribute(string $attr, bool $existsCheck = false) {
$reqs = ['ldapHost', 'ldapBase', 'ldapUserFilter'];
if (!$this->configuration->usesLdapi()) {
$reqs[] = 'ldapPort';
* @return WizardResult|false the instance's WizardResult instance
* @throws \Exception
*/
- private function determineGroups(string $dbKey, string $confKey, bool $testMemberOf = true) {
+ private function determineGroups(string $dbKey, string $confKey, bool $testMemberOf = true) {
$reqs = ['ldapHost', 'ldapBase'];
if (!$this->configuration->usesLdapi()) {
$reqs[] = 'ldapPort';
* @return WizardResult|false
* @throws \Exception
*/
- public function testLoginName(string $loginName) {
+ public function testLoginName(string $loginName) {
$reqs = ['ldapHost', 'ldapBase', 'ldapUserFilter'];
if (!$this->configuration->usesLdapi()) {
$reqs[] = 'ldapPort';
}
[$memberFilter] = explode('&', $filter);
if ($memberFilter === 'member='.$dn) {
- return [$group1, $group2];
+ return [$group1, $group2];
return [];
} elseif ($memberFilter === 'member='.$group2['dn'][0]) {
return [$group3];
$userBatches = [
0 => array_fill(0, 50, $record),
1 => array_fill(0, 50, $record),
- 2 => array_fill(0, 13, $record),
+ 2 => array_fill(0, 13, $record),
];
$groupBatches = [
$this->userMapper->expects($this->exactly(5))
->method('getList')
->withConsecutive([0, 50], [0, 40], [0, 32], [32, 32], [64, 32])
- ->willReturnOnConsecutiveCalls($userBatches[0], $userBatches[1], $userBatches[2], $userBatches[3], $userBatches[4]);
+ ->willReturnOnConsecutiveCalls($userBatches[0], $userBatches[1], $userBatches[2], $userBatches[3], $userBatches[4]);
$this->groupMapper->expects($this->once())
->method('getList')
$this->expectExceptionMessage('No plugin implements createUser in this LDAP Backend.');
$pluginManager = $this->getUserPluginManager();
- $pluginManager->createUser('foo','bar');
+ $pluginManager->createUser('foo', 'bar');
}
public function testSetPassword() {
$this->expectExceptionMessage('No plugin implements setPassword in this LDAP Backend.');
$pluginManager = $this->getUserPluginManager();
- $pluginManager->setPassword('foo','bar');
+ $pluginManager->setPassword('foo', 'bar');
}
public function testGetHome() {
use OCP\IConfig;
use OCP\IUser;
use OCP\Notification\IManager as INotificationManager;
-use Test\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
+use Test\TestCase;
/**
* Class Test_User_Ldap_Direct
use OCA\UserStatus\Capabilities;
use OCA\UserStatus\Connector\UserStatusProvider;
+use OCA\UserStatus\Dashboard\UserStatusWidget;
use OCA\UserStatus\Listener\BeforeTemplateRenderedListener;
use OCA\UserStatus\Listener\UserDeletedListener;
use OCA\UserStatus\Listener\UserLiveStatusListener;
-use OCA\UserStatus\Dashboard\UserStatusWidget;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
* @param UserStatusMapper $mapper
*/
public function __construct(ITimeFactory $time,
- UserStatusMapper $mapper) {
+ UserStatusMapper $mapper) {
parent::__construct($time);
$this->mapper = $mapper;
namespace OCA\UserStatus\Connector;
use DateTimeImmutable;
-use OCP\UserStatus\IUserStatus;
use OCA\UserStatus\Db;
+use OCP\UserStatus\IUserStatus;
class UserStatus implements IUserStatus {
*/
namespace OCA\UserStatus\Connector;
+use OC\UserStatus\ISettableProvider;
use OCA\UserStatus\Service\StatusService;
use OCP\UserStatus\IProvider;
-use OC\UserStatus\ISettableProvider;
class UserStatusProvider implements IProvider, ISettableProvider {
$statuses = $this->statusService->findByUserIds($uids);
/** @var array<string, UserStatus> $indexed */
$indexed = array_combine(
- array_map(fn(UserStatus $status) => $status->getUserId(), $statuses),
+ array_map(fn (UserStatus $status) => $status->getUserId(), $statuses),
$statuses
);
use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\ResponseDefinitions;
use OCA\UserStatus\Service\StatusService;
-use OCP\AppFramework\Controller;
-use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
private $service;
public function __construct(string $appName,
- IRequest $request,
- IEventDispatcher $eventDispatcher,
- IUserSession $userSession,
- ITimeFactory $timeFactory,
- StatusService $service) {
+ IRequest $request,
+ IEventDispatcher $eventDispatcher,
+ IUserSession $userSession,
+ ITimeFactory $timeFactory,
+ StatusService $service) {
parent::__construct($appName, $request);
$this->eventDispatcher = $eventDispatcher;
$this->userSession = $userSession;
* @param PredefinedStatusService $predefinedStatusService
*/
public function __construct(string $appName,
- IRequest $request,
- PredefinedStatusService $predefinedStatusService) {
+ IRequest $request,
+ PredefinedStatusService $predefinedStatusService) {
parent::__construct($appName, $request);
$this->predefinedStatusService = $predefinedStatusService;
}
* @param StatusService $service
*/
public function __construct(string $appName,
- IRequest $request,
- StatusService $service) {
+ IRequest $request,
+ StatusService $service) {
parent::__construct($appName, $request);
$this->service = $service;
}
* 200: The message was updated successfully
*/
public function setPredefinedMessage(string $messageId,
- ?int $clearAt): DataResponse {
+ ?int $clearAt): DataResponse {
try {
$status = $this->service->setPredefinedMessage($this->userId, $messageId, $clearAt);
$this->service->removeBackupUserStatus($this->userId);
* 200: The message was updated successfully
*/
public function setCustomMessage(?string $statusIcon,
- ?string $message,
- ?int $clearAt): DataResponse {
+ ?string $message,
+ ?int $clearAt): DataResponse {
try {
if (($message !== null && $message !== '') || ($clearAt !== null && $clearAt !== 0)) {
$status = $this->service->setCustomMessage($this->userId, $statusIcon, $message, $clearAt);
use OCA\UserStatus\Service\StatusService;
use OCP\AppFramework\Services\IInitialState;
use OCP\Dashboard\IAPIWidget;
-use OCP\Dashboard\IButtonWidget;
use OCP\Dashboard\IAPIWidgetV2;
use OCP\Dashboard\IIconWidget;
use OCP\Dashboard\IOptionWidget;
use OCP\IUserManager;
use OCP\IUserSession;
use OCP\UserStatus\IUserStatus;
-use OCP\Util;
/**
* Class UserStatusWidget
* @param StatusService $service
*/
public function __construct(IL10N $l10n,
- IDateTimeFormatter $dateTimeFormatter,
- IURLGenerator $urlGenerator,
- IInitialState $initialStateService,
- IUserManager $userManager,
- IUserSession $userSession,
- StatusService $service) {
+ IDateTimeFormatter $dateTimeFormatter,
+ IURLGenerator $urlGenerator,
+ IInitialState $initialStateService,
+ IUserManager $userManager,
+ IUserSession $userSession,
+ StatusService $service) {
$this->l10n = $l10n;
$this->dateTimeFormatter = $dateTimeFormatter;
$this->urlGenerator = $urlGenerator;
public function getItems(string $userId, ?string $since = null, int $limit = 7): array {
$widgetItemsData = $this->getWidgetData($userId, $since, $limit);
- return array_map(function(array $widgetData) {
+ return array_map(function (array $widgetData) {
$formattedDate = $this->dateTimeFormatter->formatTimeSpan($widgetData['timestamp']);
return new WidgetItem(
$widgetData['displayName'],
namespace OCA\UserStatus\Db;
-use Sabre\CalDAV\Schedule\Plugin;
use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\UserStatus\IUserStatus;
+use Sabre\CalDAV\Schedule\Plugin;
/**
* @template-extends QBMapper<UserStatus>
namespace OCA\UserStatus\Listener;
use OCA\UserStatus\Service\StatusService;
-use OCP\EventDispatcher\IEventListener;
use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventListener;
use OCP\User\Events\UserDeletedEvent;
/**
*/
namespace OCA\UserStatus\Listener;
-use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\Connector\UserStatus as ConnectorUserStatus;
+use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\Db\UserStatusMapper;
use OCA\UserStatus\Service\StatusService;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\EventDispatcher\IEventListener;
use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventListener;
use OCP\User\Events\UserLiveStatusEvent;
use OCP\UserStatus\IUserStatus;
private ITimeFactory $timeFactory;
public function __construct(UserStatusMapper $mapper,
- StatusService $statusService,
- ITimeFactory $timeFactory) {
+ StatusService $statusService,
+ ITimeFactory $timeFactory) {
$this->mapper = $mapper;
$this->statusService = $statusService;
$this->timeFactory = $timeFactory;
*/
namespace OCA\UserStatus\Migration;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
<?php
+
declare(strict_types=1);
/**
* @param StatusService $statusService
*/
public function __construct(IUserSession $userSession,
- StatusService $statusService) {
+ StatusService $statusService) {
$this->userSession = $userSession;
$this->statusService = $statusService;
}
use OCA\UserStatus\Exception\StatusMessageTooLongException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\Calendar\ISchedulingInformation;
use OCP\DB\Exception;
use OCP\IConfig;
use OCP\IEmojiHelper;
public const MAXIMUM_MESSAGE_LENGTH = 80;
public function __construct(private UserStatusMapper $mapper,
- private ITimeFactory $timeFactory,
- private PredefinedStatusService $predefinedStatusService,
- private IEmojiHelper $emojiHelper,
- private IConfig $config,
- private IUserManager $userManager,
- private CalendarStatusService $calendarStatusService) {
+ private ITimeFactory $timeFactory,
+ private PredefinedStatusService $predefinedStatusService,
+ private IEmojiHelper $emojiHelper,
+ private IConfig $config,
+ private IUserManager $userManager,
+ private CalendarStatusService $calendarStatusService) {
$this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
$this->shareeEnumerationInGroupOnly = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes';
$this->shareeEnumerationPhone = $this->shareeEnumeration && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_phone', 'no') === 'yes';
* @throws InvalidStatusTypeException
*/
public function setStatus(string $userId,
- string $status,
- ?int $statusTimestamp,
- bool $isUserDefined): UserStatus {
+ string $status,
+ ?int $statusTimestamp,
+ bool $isUserDefined): UserStatus {
try {
$userStatus = $this->mapper->findByUserId($userId);
} catch (DoesNotExistException $ex) {
* @throws InvalidClearAtException
*/
public function setPredefinedMessage(string $userId,
- string $messageId,
- ?int $clearAt): UserStatus {
+ string $messageId,
+ ?int $clearAt): UserStatus {
try {
$userStatus = $this->mapper->findByUserId($userId);
} catch (DoesNotExistException $ex) {
* @throws InvalidMessageIdException
*/
public function setUserStatus(string $userId,
- string $status,
- string $messageId,
- bool $createBackup,
- string $customMessage = null): ?UserStatus {
+ string $status,
+ string $messageId,
+ bool $createBackup,
+ string $customMessage = null): ?UserStatus {
// Check if status-type is valid
if (!in_array($status, self::PRIORITY_ORDERED_STATUSES, true)) {
throw new InvalidStatusTypeException('Status-type "' . $status . '" is not supported');
* @throws StatusMessageTooLongException
*/
public function setCustomMessage(string $userId,
- ?string $statusIcon,
- ?string $message,
- ?int $clearAt): UserStatus {
+ ?string $statusIcon,
+ ?string $message,
+ ?int $clearAt): UserStatus {
try {
$userStatus = $this->mapper->findByUserId($userId);
} catch (DoesNotExistException $ex) {
if (!$userStatus->getIsBackup()
&& $userStatus->getMessageId() === $messageId) {
$statuesToDelete[$userStatus->getUserId()] = $userStatus->getId();
- } else if ($userStatus->getIsBackup()) {
+ } elseif ($userStatus->getIsBackup()) {
$backups[$userStatus->getUserId()] = $userStatus->getId();
}
}
namespace OCA\UserStatus\Tests\Connector;
use OCA\UserStatus\Connector\UserStatus;
-use Test\TestCase;
use OCA\UserStatus\Db;
+use Test\TestCase;
class UserStatusTest extends TestCase {
public function testUserStatus() {
* @dataProvider setStatusDataProvider
*/
public function testSetStatus(string $statusType,
- ?string $statusIcon,
- ?string $message,
- ?int $clearAt,
- bool $expectSuccess,
- bool $expectException,
- ?Throwable $exception,
- bool $expectLogger,
- ?string $expectedLogMessage): void {
+ ?string $statusIcon,
+ ?string $message,
+ ?int $clearAt,
+ bool $expectSuccess,
+ bool $expectException,
+ ?Throwable $exception,
+ bool $expectLogger,
+ ?string $expectedLogMessage): void {
$userStatus = $this->getUserStatus();
if ($expectException) {
* @dataProvider setPredefinedMessageDataProvider
*/
public function testSetPredefinedMessage(string $messageId,
- ?int $clearAt,
- bool $expectSuccess,
- bool $expectException,
- ?Throwable $exception,
- bool $expectLogger,
- ?string $expectedLogMessage): void {
+ ?int $clearAt,
+ bool $expectSuccess,
+ bool $expectException,
+ ?Throwable $exception,
+ bool $expectLogger,
+ ?string $expectedLogMessage): void {
$userStatus = $this->getUserStatus();
if ($expectException) {
* @dataProvider setCustomMessageDataProvider
*/
public function testSetCustomMessage(?string $statusIcon,
- string $message,
- ?int $clearAt,
- bool $expectSuccess,
- bool $expectException,
- ?Throwable $exception,
- bool $expectLogger,
- ?string $expectedLogMessage,
- bool $expectSuccessAsReset = false): void {
+ string $message,
+ ?int $clearAt,
+ bool $expectSuccess,
+ bool $expectException,
+ ?Throwable $exception,
+ bool $expectLogger,
+ ?string $expectedLogMessage,
+ bool $expectSuccessAsReset = false): void {
$userStatus = $this->getUserStatus();
if ($expectException) {
$this->assertEquals('_user1', $user1Status->getUserId());
$this->assertEquals(true, $user1Status->getIsBackup());
$this->assertEquals('Current', $user1Status->getCustomMessage());
- } else if ($hasBackup) {
+ } elseif ($hasBackup) {
$user1Status = $this->mapper->findByUserId('user1', true);
$this->assertEquals('_user1', $user1Status->getUserId());
$this->assertEquals(true, $user1Status->getIsBackup());
* @dataProvider handleEventWithCorrectEventDataProvider
*/
public function testHandleWithCorrectEvent(string $userId,
- string $previousStatus,
- int $previousTimestamp,
- bool $previousIsUserDefined,
- string $eventStatus,
- int $eventTimestamp,
- bool $expectExisting,
- bool $expectUpdate): void {
+ string $previousStatus,
+ int $previousTimestamp,
+ bool $previousIsUserDefined,
+ string $eventStatus,
+ int $eventTimestamp,
+ bool $expectExisting,
+ bool $expectUpdate): void {
$userStatus = new UserStatus();
if ($expectExisting) {
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\Exception;
-use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IEmojiHelper;
use OCP\IUser;
-use OCP\IUserBackend;
use OCP\IUserManager;
use OCP\UserStatus\IUserStatus;
use PHPUnit\Framework\MockObject\MockObject;
* @dataProvider setStatusDataProvider
*/
public function testSetStatus(string $userId,
- string $status,
- ?int $statusTimestamp,
- bool $isUserDefined,
- bool $expectExisting,
- bool $expectSuccess,
- bool $expectTimeFactory,
- bool $expectException,
- ?string $expectedExceptionClass,
- ?string $expectedExceptionMessage): void {
+ string $status,
+ ?int $statusTimestamp,
+ bool $isUserDefined,
+ bool $expectExisting,
+ bool $expectSuccess,
+ bool $expectTimeFactory,
+ bool $expectException,
+ ?string $expectedExceptionClass,
+ ?string $expectedExceptionMessage): void {
$userStatus = new UserStatus();
if ($expectExisting) {
* @dataProvider setPredefinedMessageDataProvider
*/
public function testSetPredefinedMessage(string $userId,
- string $messageId,
- bool $isValidMessageId,
- ?int $clearAt,
- bool $expectExisting,
- bool $expectSuccess,
- bool $expectException,
- ?string $expectedExceptionClass,
- ?string $expectedExceptionMessage): void {
+ string $messageId,
+ bool $isValidMessageId,
+ ?int $clearAt,
+ bool $expectExisting,
+ bool $expectSuccess,
+ bool $expectException,
+ ?string $expectedExceptionClass,
+ ?string $expectedExceptionMessage): void {
$userStatus = new UserStatus();
if ($expectExisting) {
* @dataProvider setCustomMessageDataProvider
*/
public function testSetCustomMessage(string $userId,
- ?string $statusIcon,
- bool $supportsEmoji,
- string $message,
- ?int $clearAt,
- bool $expectExisting,
- bool $expectSuccess,
- bool $expectException,
- ?string $expectedExceptionClass,
- ?string $expectedExceptionMessage): void {
+ ?string $statusIcon,
+ bool $supportsEmoji,
+ string $message,
+ ?int $clearAt,
+ bool $expectExisting,
+ bool $expectSuccess,
+ bool $expectException,
+ ?string $expectedExceptionClass,
+ ?string $expectedExceptionMessage): void {
$userStatus = new UserStatus();
if ($expectExisting) {
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Dashboard\RegisterWidgetEvent;
-use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Util;
/**
*/
namespace OCA\WeatherStatus;
-use OCP\Capabilities\ICapability;
-
use OCA\WeatherStatus\AppInfo\Application;
+use OCP\Capabilities\ICapability;
+
/**
* Class Capabilities
*
<?php
+
declare(strict_types=1);
/**
}
private function registerRuleListeners(IEventDispatcher $dispatcher,
- ContainerInterface $container,
- LoggerInterface $logger): void {
+ ContainerInterface $container,
+ LoggerInterface $logger): void {
/** @var Manager $manager */
$manager = $container->get(Manager::class);
$configuredEvents = $manager->getAllConfiguredEvents();
*/
namespace OCA\WorkflowEngine\BackgroundJobs;
+use OCA\WorkflowEngine\AppInfo\Application;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
-use OCA\WorkflowEngine\AppInfo\Application;
use OCP\Log\RotationTrait;
class Rotate extends TimedJob {
*/
namespace OCA\WorkflowEngine\Check;
+use OC\Files\Storage\Wrapper\Wrapper;
use OCA\Files_Sharing\SharedStorage;
use OCA\WorkflowEngine\Entity\File;
use OCP\Files\Cache\ICache;
use OCP\SystemTag\TagNotFoundException;
use OCP\WorkflowEngine\ICheck;
use OCP\WorkflowEngine\IFileCheck;
-use OC\Files\Storage\Wrapper\Wrapper;
class FileSystemTags implements ICheck, IFileCheck {
use TFileCheck;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Template;
+use OCP\Util;
use function class_exists;
use function function_exists;
-use OCP\Util;
class LoadAdditionalSettingsScriptsListener implements IEventListener {
public function handle(Event $event): void {
namespace OCA\WorkflowEngine;
use Doctrine\DBAL\Exception;
-use OCP\Cache\CappedMemoryCache;
use OCA\WorkflowEngine\AppInfo\Application;
use OCA\WorkflowEngine\Check\FileMimeType;
use OCA\WorkflowEngine\Check\FileName;
use OCA\WorkflowEngine\Service\Logger;
use OCA\WorkflowEngine\Service\RuleMatcher;
use OCP\AppFramework\QueryException;
+use OCP\Cache\CappedMemoryCache;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ICacheFactory;
use Closure;
use Doctrine\DBAL\Schema\Table;
-use OCP\DB\Types;
use OCA\WorkflowEngine\Entity\File;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
*
*/
use GuzzleHttp\Client;
+use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\ServerException;
-use GuzzleHttp\Cookie\CookieJar;
require __DIR__ . '/../../vendor/autoload.php';
* @throws \Exception
*/
public function theResponseShouldContainAPropertyWithValue($key, $value) {
-// $keys = $this->response[0]['value'][1]['value'][0]['value'];
+ // $keys = $this->response[0]['value'][1]['value'][0]['value'];
$keys = $this->getValueFromNamedEntries('{DAV:}response {DAV:}propstat {DAV:}prop', $this->response);
$found = false;
foreach ($keys as $singleKey) {
}
public function createShare($user,
- $path = null,
- $shareType = null,
- $shareWith = null,
- $publicUpload = null,
- $password = null,
- $permissions = null,
- $viewOnly = false) {
+ $path = null,
+ $shareType = null,
+ $shareWith = null,
+ $publicUpload = null,
+ $password = null,
+ $permissions = null,
+ $viewOnly = false) {
$fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares";
$client = new Client();
$options = [
namespace OC\Core\Command;
use OC\Core\Command\User\ListCommand;
-use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
+use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
private $uid;
public function __construct(string $name,
- string $uid) {
+ string $uid) {
parent::__construct();
$this->name = $name;
$this->uid = $uid;
use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\EventDispatcher\IEventDispatcher;
use Symfony\Component\Console\Command\Command;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Types\Type;
-use OCP\DB\Types;
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
+use OCP\DB\Types;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\AbstractAsset;
use Doctrine\DBAL\Schema\Table;
-use OCP\DB\Types;
use OC\DB\Connection;
use OC\DB\ConnectionFactory;
use OC\DB\MigrationService;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\DB\Types;
use OCP\IConfig;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
use OCP\Constants;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\FileInfo;
+use OCP\Files\Folder;
use OCP\Files\IHomeStorage;
use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountPoint;
use OCP\Share\IShare;
use OCP\Util;
use Symfony\Component\Console\Output\OutputInterface;
-use OCP\Files\Folder;
class FileUtils {
public function __construct(
namespace OC\Core\Command\Maintenance;
use Exception;
-use OCP\App\IAppManager;
-use OCP\EventDispatcher\Event;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IConfig;
use OC\Repair\Events\RepairAdvanceEvent;
use OC\Repair\Events\RepairErrorEvent;
use OC\Repair\Events\RepairFinishEvent;
use OC\Repair\Events\RepairStartEvent;
use OC\Repair\Events\RepairStepEvent;
use OC\Repair\Events\RepairWarningEvent;
+use OCP\App\IAppManager;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IConfig;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
namespace OC\Core\Command\Maintenance;
-use Symfony\Component\Console\Command\Command;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IUser;
use OCP\IUserManager;
+use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
namespace OC\Core\Command\Preview;
use OCP\Files\Config\IUserMountCache;
+use OCP\Files\File;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
-use OCP\Files\File;
use OCP\Files\NotFoundException;
use OCP\IPreview;
use Symfony\Component\Console\Command\Command;
*/
namespace OC\Core\Command\TwoFactorAuth;
-use function implode;
use OC\Authentication\TwoFactorAuth\EnforcementState;
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
+use function implode;
class Enforce extends Command {
public function __construct(
}
private function printProviders(string $title, array $providers,
- OutputInterface $output) {
+ OutputInterface $output) {
if (empty($providers)) {
// Ignore and don't print anything
return;
*/
namespace OC\Core\Command;
-use OCP\EventDispatcher\Event;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IConfig;
-use OCP\Util;
use OC\Console\TimestampFormatter;
use OC\DB\MigratorExecuteSqlEvent;
use OC\Installer;
use OC\Repair\Events\RepairStepEvent;
use OC\Repair\Events\RepairWarningEvent;
use OC\Updater;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IConfig;
+use OCP\Util;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
namespace OC\Core\Command\User\AuthTokens;
use DateTimeImmutable;
-use OC\Core\Command\Base;
use OC\Authentication\Token\IProvider;
+use OC\Core\Command\Base;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputArgument;
*/
namespace OC\Core\Command\User\AuthTokens;
-use OC\Core\Command\Base;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
+use OC\Core\Command\Base;
use OCP\IUserManager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
*/
#[UseSession]
public function grantPage(string $stateToken = '',
- string $clientIdentifier = '',
- int $direct = 0): StandaloneTemplateResponse {
+ string $clientIdentifier = '',
+ int $direct = 0): StandaloneTemplateResponse {
if (!$this->isValidToken($stateToken)) {
return $this->stateTokenForbiddenResponse();
}
*/
#[UseSession]
public function generateAppPassword(string $stateToken,
- string $clientIdentifier = '') {
+ string $clientIdentifier = '') {
if (!$this->isValidToken($stateToken)) {
$this->session->remove(self::STATE_NAME);
return $this->stateTokenForbiddenResponse();
*/
#[UseSession]
public function tryLogin(Chain $loginChain,
- string $user = '',
- string $password = '',
- string $redirect_url = null,
- string $timezone = '',
- string $timezone_offset = ''): RedirectResponse {
+ string $user = '',
+ string $password = '',
+ string $redirect_url = null,
+ string $timezone = '',
+ string $timezone_offset = ''): RedirectResponse {
if (!$this->request->passesCSRFCheck()) {
if ($this->userSession->isLoggedIn()) {
// If the user is already logged in and the CSRF check does not pass then
namespace OC\Core\Controller;
use Exception;
+use OC\Authentication\TwoFactorAuth\Manager;
+use OC\Core\Events\BeforePasswordResetEvent;
+use OC\Core\Events\PasswordResetEvent;
+use OC\Core\Exception\ResetPasswordException;
+use OC\Security\RateLimiting\Exception\RateLimitExceededException;
+use OC\Security\RateLimiting\Limiter;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Mail\IMailer;
-use OCP\Security\VerificationToken\IVerificationToken;
use OCP\Security\VerificationToken\InvalidTokenException;
-use OC\Authentication\TwoFactorAuth\Manager;
-use OC\Core\Events\BeforePasswordResetEvent;
-use OC\Core\Events\PasswordResetEvent;
-use OC\Core\Exception\ResetPasswordException;
-use OC\Security\RateLimiting\Exception\RateLimitExceededException;
-use OC\Security\RateLimiting\Limiter;
+use OCP\Security\VerificationToken\IVerificationToken;
use Psr\Log\LoggerInterface;
use function array_filter;
use function count;
namespace OC\Core\Controller;
use OC\Core\Db\ProfileConfigMapper;
+use OC\Profile\ProfileManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCS\OCSBadRequestException;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\IUserSession;
-use OC\Profile\ProfileManager;
class ProfileApiController extends OCSController {
public function __construct(
namespace OC\Core\Controller;
use OC\Profile\ProfileManager;
-use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
-use OCP\Profile\BeforeTemplateRenderedEvent;
use OCP\AppFramework\Controller;
+use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\Profile\BeforeTemplateRenderedEvent;
use OCP\Share\IManager as IShareManager;
use OCP\UserStatus\IManager as IUserStatusManager;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\INavigationManager;
#[IgnoreOpenAPI]
class ProfilePageController extends Controller {
namespace OC\Core\Controller;
-use OCP\Collaboration\Reference\IReferenceManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDownloadResponse;
use OCP\AppFramework\Http\DataResponse;
+use OCP\Collaboration\Reference\IReferenceManager;
use OCP\Files\AppData\IAppDataFactory;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\DB\Exception;
use OCP\IL10N;
use OCP\IRequest;
+use OCP\PreConditionNotMetException;
use OCP\TextProcessing\Exception\TaskFailureException;
+use OCP\TextProcessing\IManager;
use OCP\TextProcessing\ITaskType;
use OCP\TextProcessing\Task;
-use OCP\TextProcessing\IManager;
-use OCP\PreConditionNotMetException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use OCP\Files\NotFoundException;
use OCP\IL10N;
use OCP\IRequest;
+use OCP\PreConditionNotMetException;
use OCP\TextToImage\Exception\TaskFailureException;
use OCP\TextToImage\Exception\TaskNotFoundException;
-use OCP\TextToImage\Task;
use OCP\TextToImage\IManager;
-use OCP\PreConditionNotMetException;
+use OCP\TextToImage\Task;
/**
* @psalm-import-type CoreTextToImageTask from ResponseDefinitions
use InvalidArgumentException;
use OC\Search\SearchComposer;
use OC\Search\SearchQuery;
+use OC\Search\UnsupportedFilter;
use OCA\Core\ResponseDefinitions;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IUserSession;
use OCP\Route\IRouter;
use OCP\Search\ISearchQuery;
-use OC\Search\UnsupportedFilter;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
/**
namespace OC\Core\Db;
-use function json_decode;
-use function json_encode;
use \JsonSerializable;
use OCP\AppFramework\Db\Entity;
use OCP\Profile\ParameterDoesNotExistException;
+use function json_decode;
+use function json_encode;
/**
* @method string getUserId()
*/
namespace OC\Core\Migrations;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OC\Core\Migrations;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
'unsigned' => true,
]);
$table->setPrimaryKey(['objecttype', 'objectid', 'systemtagid'], 'som_pk');
-// $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping');
+ // $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping');
$table->addIndex(['systemtagid', 'objecttype'], 'systag_by_tagid');
}
]);
$table->addIndex(['object_type', 'object_id'], 'comments_marker_object_index');
$table->setPrimaryKey(['user_id', 'object_type', 'object_id'], 'crm_pk');
-// $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index');
+ // $table->addUniqueIndex(['user_id', 'object_type', 'object_id'], 'comments_marker_index');
}
-// if (!$schema->hasTable('credentials')) {
-// $table = $schema->createTable('credentials');
-// $table->addColumn('user', 'string', [
-// 'notnull' => false,
-// 'length' => 64,
-// ]);
-// $table->addColumn('identifier', 'string', [
-// 'notnull' => true,
-// 'length' => 64,
-// ]);
-// $table->addColumn('credentials', 'text', [
-// 'notnull' => false,
-// ]);
-// $table->setPrimaryKey(['user', 'identifier']);
-// $table->addIndex(['user'], 'credentials_user');
-// }
+ // if (!$schema->hasTable('credentials')) {
+ // $table = $schema->createTable('credentials');
+ // $table->addColumn('user', 'string', [
+ // 'notnull' => false,
+ // 'length' => 64,
+ // ]);
+ // $table->addColumn('identifier', 'string', [
+ // 'notnull' => true,
+ // 'length' => 64,
+ // ]);
+ // $table->addColumn('credentials', 'text', [
+ // 'notnull' => false,
+ // ]);
+ // $table->setPrimaryKey(['user', 'identifier']);
+ // $table->addIndex(['user'], 'credentials_user');
+ // }
if (!$schema->hasTable('admin_sections')) {
$table = $schema->createTable('admin_sections');
class Version14000Date20180522074438 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure,
- array $options): ISchemaWrapper {
+ array $options): ISchemaWrapper {
$schema = $schemaClosure();
if (!$schema->hasTable('twofactor_providers')) {
*/
namespace OC\Core\Migrations;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
]);
$table->setPrimaryKey(['collection_id', 'resource_type', 'resource_id'], 'crr_pk');
-// $table->addUniqueIndex(['collection_id', 'resource_type', 'resource_id'], 'collres_unique_res');
+ // $table->addUniqueIndex(['collection_id', 'resource_type', 'resource_id'], 'collres_unique_res');
}
if (!$schema->hasTable('collres_accesscache')) {
]);
$table->setPrimaryKey(['user_id', 'collection_id', 'resource_type', 'resource_id'], 'cra_pk');
-// $table->addUniqueIndex(['user_id', 'collection_id', 'resource_type', 'resource_id'], 'collres_unique_user');
+ // $table->addUniqueIndex(['user_id', 'collection_id', 'resource_type', 'resource_id'], 'collres_unique_user');
$table->addIndex(['user_id', 'resource_type', 'resource_id'], 'collres_user_res');
$table->addIndex(['user_id', 'collection_id'], 'collres_user_coll');
}
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
'default' => 0,
]);
$table->setPrimaryKey(['fileid'], 'fce_pk');
-// $table->addUniqueIndex(['fileid'], 'fce_fileid_idx');
+ // $table->addUniqueIndex(['fileid'], 'fce_fileid_idx');
$table->addIndex(['creation_time'], 'fce_ctime_idx');
$table->addIndex(['upload_time'], 'fce_utime_idx');
}
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
-use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
class Version18000Date20191014105105 extends SimpleMigrationStep {
public function __construct(
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
-use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
class Version18000Date20191204114856 extends SimpleMigrationStep {
public function __construct(
$result = $this->ensureColumnIsNullable($schema, 'share', 'password_by_talk');
$result = $this->ensureColumnIsNullable($schema, 'share', 'hide_download') || $result;
-// $result = $this->ensureColumnIsNullable($schema, 'credentials', 'user') || $result;
+ // $result = $this->ensureColumnIsNullable($schema, 'credentials', 'user') || $result;
$result = $this->ensureColumnIsNullable($schema, 'authtoken', 'password_invalid') || $result;
$result = $this->ensureColumnIsNullable($schema, 'collres_accesscache', 'access') || $result;
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
namespace OC\Core\Migrations;
use Closure;
-use OCP\DB\Types;
use OCP\DB\ISchemaWrapper;
+use OCP\DB\Types;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use Closure;
use OCP\DB\ISchemaWrapper;
-use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
class Version23000Date20210721100600 extends SimpleMigrationStep {
/**
* Therefore it was dropped with Version24000Date20211213081506
* and then recreated with a primary key in Version24000Date20211213081604
*/
-// /** @var ISchemaWrapper $schema */
-// $schema = $schemaClosure();
-//
-// $hasTable = $schema->hasTable(self::TABLE_NAME);
-//
-// if (!$hasTable) {
-// $table = $schema->createTable(self::TABLE_NAME);
-// $table->addColumn('hash', Types::STRING, [
-// 'notnull' => true,
-// 'length' => 128,
-// ]);
-// $table->addColumn('delete_after', Types::DATETIME, [
-// 'notnull' => true,
-// ]);
-// $table->addIndex(['hash'], 'ratelimit_hash');
-// $table->addIndex(['delete_after'], 'ratelimit_delete_after');
-// return $schema;
-// }
+ // /** @var ISchemaWrapper $schema */
+ // $schema = $schemaClosure();
+ //
+ // $hasTable = $schema->hasTable(self::TABLE_NAME);
+ //
+ // if (!$hasTable) {
+ // $table = $schema->createTable(self::TABLE_NAME);
+ // $table->addColumn('hash', Types::STRING, [
+ // 'notnull' => true,
+ // 'length' => 128,
+ // ]);
+ // $table->addColumn('delete_after', Types::DATETIME, [
+ // 'notnull' => true,
+ // ]);
+ // $table->addIndex(['hash'], 'ratelimit_hash');
+ // $table->addIndex(['delete_after'], 'ratelimit_delete_after');
+ // return $schema;
+ // }
return null;
}
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
-use OCP\EventDispatcher\Event;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\IEventSource;
-use OCP\IEventSourceFactory;
-use OCP\IL10N;
-use OCP\ILogger;
use OC\DB\MigratorExecuteSqlEvent;
use OC\Repair\Events\RepairAdvanceEvent;
use OC\Repair\Events\RepairErrorEvent;
use OC\Repair\Events\RepairStartEvent;
use OC\Repair\Events\RepairStepEvent;
use OC\Repair\Events\RepairWarningEvent;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\IEventSource;
+use OCP\IEventSourceFactory;
+use OCP\IL10N;
+use OCP\ILogger;
use OCP\L10N\IFactory;
if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
<?php
- /** @var array $_ */
- /** @var \OCP\IL10N $l */
- \OCP\Util::addStyle('core', 'guest');
- \OCP\Util::addStyle('core', 'publicshareauth');
- \OCP\Util::addScript('core', 'publicshareauth');
- ?>
+/** @var array $_ */
+/** @var \OCP\IL10N $l */
+\OCP\Util::addStyle('core', 'guest');
+\OCP\Util::addStyle('core', 'publicshareauth');
+\OCP\Util::addScript('core', 'publicshareauth');
+?>
<div class="guest-box">
<!-- password prompt form. It should be hidden when we show the email prompt form -->
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '41d274cd58f168047eb6a7673a7e43fff69ac07f',
+ 'reference' => '559a758533026559cf632ed1b3d74f6b1ebfb481',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '41d274cd58f168047eb6a7673a7e43fff69ac07f',
+ 'reference' => '559a758533026559cf632ed1b3d74f6b1ebfb481',
'type' => 'library',
'install_path' => __DIR__ . '/../../../',
'aliases' => array(),
use Exception;
use InvalidArgumentException;
use OC\Profile\TProfileHelper;
-use OCP\Accounts\UserUpdatedEvent;
-use OCP\Cache\CappedMemoryCache;
use OCA\Settings\BackgroundJobs\VerifyUserData;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
use OCP\Accounts\IAccountPropertyCollection;
use OCP\Accounts\PropertyDoesNotExistException;
+use OCP\Accounts\UserUpdatedEvent;
use OCP\BackgroundJob\IJobList;
+use OCP\Cache\CappedMemoryCache;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Defaults;
use OCP\EventDispatcher\IEventDispatcher;
protected $l10n;
public function __construct(
- IRequest $request,
- IUserSession $session,
- IConfig $config,
- IValidator $validator,
- IL10N $l10n
+ IRequest $request,
+ IUserSession $session,
+ IConfig $config,
+ IValidator $validator,
+ IL10N $l10n
) {
$this->request = $request;
$this->session = $session;
use OCP\App\Events\AppEnableEvent;
use OCP\App\IAppManager;
use OCP\App\ManagerEvent;
-use OCP\EventDispatcher\IEventDispatcher;
use OCP\Collaboration\AutoComplete\IManager as IAutoCompleteManager;
use OCP\Collaboration\Collaborators\ISearch as ICollaboratorSearch;
use OCP\Diagnostics\IEventLogger;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IGroup;
private array $loadedApps = [];
public function __construct(IUserSession $userSession,
- IConfig $config,
- AppConfig $appConfig,
- IGroupManager $groupManager,
- ICacheFactory $memCacheFactory,
- IEventDispatcher $dispatcher,
- LoggerInterface $logger) {
+ IConfig $config,
+ AppConfig $appConfig,
+ IGroupManager $groupManager,
+ ICacheFactory $memCacheFactory,
+ IEventDispatcher $dispatcher,
+ LoggerInterface $logger) {
$this->userSession = $userSession;
$this->config = $config;
$this->appConfig = $appConfig;
private $ignoreMaxVersion;
public function __construct(Factory $appDataFactory,
- IClientService $clientService,
- ITimeFactory $timeFactory,
- IConfig $config,
- CompareVersion $compareVersion,
- LoggerInterface $logger,
- IRegistry $registry) {
+ IClientService $clientService,
+ ITimeFactory $timeFactory,
+ IConfig $config,
+ CompareVersion $compareVersion,
+ LoggerInterface $logger,
+ IRegistry $registry) {
parent::__construct(
$appDataFactory,
$clientService,
class CategoryFetcher extends Fetcher {
public function __construct(Factory $appDataFactory,
- IClientService $clientService,
- ITimeFactory $timeFactory,
- IConfig $config,
- LoggerInterface $logger,
- IRegistry $registry) {
+ IClientService $clientService,
+ ITimeFactory $timeFactory,
+ IConfig $config,
+ LoggerInterface $logger,
+ IRegistry $registry) {
parent::__construct(
$appDataFactory,
$clientService,
protected $channel = null;
public function __construct(Factory $appDataFactory,
- IClientService $clientService,
- ITimeFactory $timeFactory,
- IConfig $config,
- LoggerInterface $logger,
- IRegistry $registry) {
+ IClientService $clientService,
+ ITimeFactory $timeFactory,
+ IConfig $config,
+ LoggerInterface $logger,
+ IRegistry $registry) {
$this->appData = $appDataFactory->get('appstore');
$this->clientService = $clientService;
$this->timeFactory = $timeFactory;
*/
namespace OC\App;
-use OCP\IConfig;
use OCP\IBinaryFinder;
+use OCP\IConfig;
/**
* Class Platform
use OC\AppFramework\DependencyInjection\DIContainer;
use OC\AppFramework\Http\Dispatcher;
use OC\AppFramework\Http\Request;
-use OCP\App\IAppManager;
-use OCP\Profiler\IProfiler;
use OC\Profiler\RoutingDataCollector;
-use OCP\AppFramework\QueryException;
+use OCP\App\IAppManager;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\ICallbackResponse;
use OCP\AppFramework\Http\IOutput;
+use OCP\AppFramework\QueryException;
use OCP\Diagnostics\IEventLogger;
use OCP\HintException;
use OCP\IRequest;
+use OCP\Profiler\IProfiler;
/**
* Entry point for every request in your app. You can consider this as your
* @param DIContainer $container an instance of a pimple container.
*/
public static function part(string $controllerName, string $methodName, array $urlParams,
- DIContainer $container) {
+ DIContainer $container) {
$container['urlParams'] = $urlParams;
$controller = $container[$controllerName];
namespace OC\AppFramework\Bootstrap;
-use OCP\Diagnostics\IEventLogger;
-use function class_exists;
-use function class_implements;
-use function in_array;
-use OC_App;
use OC\Support\CrashReport\Registry;
+use OC_App;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\QueryException;
use OCP\Dashboard\IManager;
+use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IServerContainer;
use Psr\Log\LoggerInterface;
use Throwable;
+use function class_exists;
+use function class_implements;
+use function in_array;
class Coordinator {
/** @var IServerContainer */
private $priority;
public function __construct(string $appId,
- string $event,
- string $service,
- int $priority) {
+ string $event,
+ string $service,
+ int $priority) {
parent::__construct($appId, $service);
$this->event = $event;
$this->priority = $priority;
private $value;
public function __construct(string $appId,
- string $name,
- $value) {
+ string $name,
+ $value) {
parent::__construct($appId);
$this->name = $name;
$this->value = $value;
private $mimeTypeRegex;
public function __construct(string $appId,
- string $service,
- string $mimeTypeRegex) {
+ string $service,
+ string $mimeTypeRegex) {
parent::__construct($appId, $service);
$this->mimeTypeRegex = $mimeTypeRegex;
}
namespace OC\AppFramework\Bootstrap;
use Closure;
-use OCP\Calendar\Resource\IBackend as IResourceBackend;
-use OCP\Calendar\Room\IBackend as IRoomBackend;
-use OCP\Collaboration\Reference\IReferenceProvider;
-use OCP\TextProcessing\IProvider as ITextProcessingProvider;
-use OCP\SpeechToText\ISpeechToTextProvider;
-use OCP\Talk\ITalkBackend;
-use OCP\Translation\ITranslationProvider;
-use RuntimeException;
-use function array_shift;
use OC\Support\CrashReport\Registry;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Services\InitialStateProvider;
use OCP\Authentication\IAlternativeLogin;
use OCP\Calendar\ICalendarProvider;
+use OCP\Calendar\Resource\IBackend as IResourceBackend;
+use OCP\Calendar\Room\IBackend as IRoomBackend;
use OCP\Capabilities\ICapability;
+use OCP\Collaboration\Reference\IReferenceProvider;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IWidget;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Search\IProvider;
use OCP\SetupCheck\ISetupCheck;
use OCP\Share\IPublicShareTemplateProvider;
+use OCP\SpeechToText\ISpeechToTextProvider;
use OCP\Support\CrashReport\IReporter;
+use OCP\Talk\ITalkBackend;
+use OCP\TextProcessing\IProvider as ITextProcessingProvider;
+use OCP\Translation\ITranslationProvider;
use OCP\UserMigration\IMigrator as IUserMigrator;
use Psr\Log\LoggerInterface;
+use RuntimeException;
use Throwable;
+use function array_shift;
class RegistrationContext {
/** @var ServiceRegistration<ICapability>[] */
* @paslm-param string|class-string $target
*/
public function __construct(string $appId,
- string $alias,
- string $target) {
+ string $alias,
+ string $target) {
parent::__construct($appId);
$this->alias = $alias;
$this->target = $target;
private $shared;
public function __construct(string $appId,
- string $alias,
- callable $target,
- bool $shared) {
+ string $alias,
+ callable $target,
+ bool $shared) {
parent::__construct($appId);
$this->name = $alias;
$this->factory = $target;
* @param IEventLogger $eventLogger
*/
public function __construct(Http $protocol,
- MiddlewareDispatcher $middlewareDispatcher,
- ControllerMethodReflector $reflector,
- IRequest $request,
- IConfig $config,
- ConnectionAdapter $connection,
- LoggerInterface $logger,
- IEventLogger $eventLogger,
- ContainerInterface $appContainer) {
+ MiddlewareDispatcher $middlewareDispatcher,
+ ControllerMethodReflector $reflector,
+ IRequest $request,
+ IConfig $config,
+ ConnectionAdapter $connection,
+ LoggerInterface $logger,
+ IEventLogger $eventLogger,
+ ContainerInterface $appContainer) {
$this->protocol = $protocol;
$this->middlewareDispatcher = $middlewareDispatcher;
$this->reflector = $reflector;
* @see https://www.php.net/manual/en/reserved.variables.php
*/
public function __construct(array $vars,
- IRequestId $requestId,
- IConfig $config,
- CsrfTokenManager $csrfTokenManager = null,
- string $stream = 'php://input') {
+ IRequestId $requestId,
+ IConfig $config,
+ CsrfTokenManager $csrfTokenManager = null,
+ string $stream = 'php://input') {
$this->inputStream = $stream;
$this->items['params'] = [];
$this->requestId = $requestId;
protected string $requestId;
public function __construct(string $uniqueId,
- ISecureRandom $secureRandom) {
+ ISecureRandom $secureRandom) {
$this->requestId = $uniqueId;
$this->secureRandom = $secureRandom;
}
private $throttler;
public function __construct(IRequest $request,
- ControllerMethodReflector $reflector,
- Session $session,
- IThrottler $throttler) {
+ ControllerMethodReflector $reflector,
+ Session $session,
+ IThrottler $throttler) {
$this->request = $request;
$this->reflector = $reflector;
$this->session = $session;
private $csrfTokenManager;
public function __construct(ContentSecurityPolicyManager $policyManager,
- ContentSecurityPolicyNonceManager $cspNonceManager,
- CsrfTokenManager $csrfTokenManager) {
+ ContentSecurityPolicyNonceManager $cspNonceManager,
+ CsrfTokenManager $csrfTokenManager) {
$this->contentSecurityPolicyManager = $policyManager;
$this->cspNonceManager = $cspNonceManager;
$this->csrfTokenManager = $csrfTokenManager;
* @param ITimeFactory $timeFactory
*/
public function __construct(ControllerMethodReflector $reflector,
- ISession $session,
- IUserSession $userSession,
- ITimeFactory $timeFactory) {
+ ISession $session,
+ IUserSession $userSession,
+ ITimeFactory $timeFactory) {
$this->reflector = $reflector;
$this->session = $session;
$this->userSession = $userSession;
private $reflector;
public function __construct(Request $request,
- ControllerMethodReflector $reflector) {
+ ControllerMethodReflector $reflector) {
$this->request = $request;
$this->reflector = $reflector;
}
private $userSession;
public function __construct(IRequest $request,
- ControllerMethodReflector $reflector,
- INavigationManager $navigationManager,
- IURLGenerator $urlGenerator,
- LoggerInterface $logger,
- string $appName,
- bool $isLoggedIn,
- bool $isAdminUser,
- bool $isSubAdmin,
- IAppManager $appManager,
- IL10N $l10n,
- AuthorizedGroupMapper $mapper,
- IUserSession $userSession
+ ControllerMethodReflector $reflector,
+ INavigationManager $navigationManager,
+ IURLGenerator $urlGenerator,
+ LoggerInterface $logger,
+ string $appName,
+ bool $isLoggedIn,
+ bool $isAdminUser,
+ bool $isSubAdmin,
+ IAppManager $appManager,
+ IL10N $l10n,
+ AuthorizedGroupMapper $mapper,
+ IUserSession $userSession
) {
$this->navigationManager = $navigationManager;
$this->request = $request;
private $session;
public function __construct(ControllerMethodReflector $reflector,
- ISession $session) {
+ ISession $session) {
$this->reflector = $reflector;
$this->session = $session;
}
* @param int|null $itemsPerPage
*/
public function __construct(DataResponse $dataResponse,
- $format = 'xml',
- $statusMessage = null,
- $itemsCount = null,
- $itemsPerPage = null) {
+ $format = 'xml',
+ $statusMessage = null,
+ $itemsCount = null,
+ $itemsPerPage = null) {
parent::__construct();
$this->format = $format;
private $appId;
public function __construct(LoggerInterface $inner,
- string $appId) {
+ string $appId) {
$this->inner = $inner;
$this->appId = $appId;
}
use Psr\Container\ContainerInterface;
use ReflectionClass;
use ReflectionException;
-use ReflectionParameter;
use ReflectionNamedType;
+use ReflectionParameter;
use function class_exists;
/**
* @param array $sortedScriptDeps
*/
private function topSortVisit(
- AppScriptDependency $app,
- array &$parents,
- array &$scriptDeps,
- array &$sortedScriptDeps): void {
+ AppScriptDependency $app,
+ array &$parents,
+ array &$scriptDeps,
+ array &$sortedScriptDeps): void {
// Detect and log circular dependencies
if (isset($parents[$app->getId()])) {
$this->logger->error('Circular dependency in app scripts at app ' . $app->getId());
private $logger;
public function __construct(IActvityManager $activityManager,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->activityManager = $activityManager;
$this->logger = $logger;
}
private $logger;
public function __construct(IMailer $mailer,
- IUserManager $userManager,
- IL10nFactory $l10nFactory,
- LoggerInterface $logger) {
+ IUserManager $userManager,
+ IL10nFactory $l10nFactory,
+ LoggerInterface $logger) {
$this->mailer = $mailer;
$this->userManager = $userManager;
$this->l10n = $l10nFactory->get('core');
private $timeFactory;
public function __construct(INotificationManager $notificationManager,
- ITimeFactory $timeFactory) {
+ ITimeFactory $timeFactory) {
$this->notificationManager = $notificationManager;
$this->timeFactory = $timeFactory;
}
private $logger;
public function __construct(Manager $manager,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->manager = $manager;
$this->logger = $logger;
}
private $finishRememberedLoginCommand;
public function __construct(PreLoginHookCommand $preLoginHookCommand,
- UserDisabledCheckCommand $userDisabledCheckCommand,
- UidLoginCommand $uidLoginCommand,
- EmailLoginCommand $emailLoginCommand,
- LoggedInCheckCommand $loggedInCheckCommand,
- CompleteLoginCommand $completeLoginCommand,
- CreateSessionTokenCommand $createSessionTokenCommand,
- ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand,
- UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand,
- SetUserTimezoneCommand $setUserTimezoneCommand,
- TwoFactorCommand $twoFactorCommand,
- FinishRememberedLoginCommand $finishRememberedLoginCommand
+ UserDisabledCheckCommand $userDisabledCheckCommand,
+ UidLoginCommand $uidLoginCommand,
+ EmailLoginCommand $emailLoginCommand,
+ LoggedInCheckCommand $loggedInCheckCommand,
+ CompleteLoginCommand $completeLoginCommand,
+ CreateSessionTokenCommand $createSessionTokenCommand,
+ ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand,
+ UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand,
+ SetUserTimezoneCommand $setUserTimezoneCommand,
+ TwoFactorCommand $twoFactorCommand,
+ FinishRememberedLoginCommand $finishRememberedLoginCommand
) {
$this->preLoginHookCommand = $preLoginHookCommand;
$this->userDisabledCheckCommand = $userDisabledCheckCommand;
private $userSession;
public function __construct(IConfig $config,
- Session $userSession) {
+ Session $userSession) {
$this->config = $config;
$this->userSession = $userSession;
}
private $dispatcher;
public function __construct(LoggerInterface $logger,
- IEventDispatcher $dispatcher) {
+ IEventDispatcher $dispatcher) {
$this->logger = $logger;
$this->dispatcher = $dispatcher;
}
private $rememberLogin = true;
public function __construct(IRequest $request,
- string $username,
- ?string $password,
- string $redirectUrl = null,
- string $timeZone = '',
- string $timeZoneOffset = '') {
+ string $username,
+ ?string $password,
+ string $redirectUrl = null,
+ string $timeZone = '',
+ string $timeZoneOffset = '') {
$this->request = $request;
$this->username = $username;
$this->password = $password;
private $session;
public function __construct(IConfig $config,
- ISession $session) {
+ ISession $session) {
$this->config = $config;
$this->session = $session;
}
*/
namespace OC\Authentication\Login;
-use function array_pop;
-use function count;
use OC\Authentication\TwoFactorAuth\Manager;
use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\IURLGenerator;
+use function array_pop;
+use function count;
class TwoFactorCommand extends ALoginCommand {
/** @var Manager */
private $urlGenerator;
public function __construct(Manager $twoFactorManager,
- MandatoryTwoFactor $mandatoryTwoFactor,
- IURLGenerator $urlGenerator) {
+ MandatoryTwoFactor $mandatoryTwoFactor,
+ IURLGenerator $urlGenerator) {
$this->twoFactorManager = $twoFactorManager;
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
$this->urlGenerator = $urlGenerator;
private $logger;
public function __construct(IUserManager $userManager,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->userManager = $userManager;
$this->logger = $logger;
}
private $webAuthnLoginCommand;
public function __construct(UserDisabledCheckCommand $userDisabledCheckCommand,
- WebAuthnLoginCommand $webAuthnLoginCommand,
- LoggedInCheckCommand $loggedInCheckCommand,
- CompleteLoginCommand $completeLoginCommand,
- CreateSessionTokenCommand $createSessionTokenCommand,
- ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand,
- UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand,
- SetUserTimezoneCommand $setUserTimezoneCommand,
- TwoFactorCommand $twoFactorCommand,
- FinishRememberedLoginCommand $finishRememberedLoginCommand
+ WebAuthnLoginCommand $webAuthnLoginCommand,
+ LoggedInCheckCommand $loggedInCheckCommand,
+ CompleteLoginCommand $completeLoginCommand,
+ CreateSessionTokenCommand $createSessionTokenCommand,
+ ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand,
+ UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand,
+ SetUserTimezoneCommand $setUserTimezoneCommand,
+ TwoFactorCommand $twoFactorCommand,
+ FinishRememberedLoginCommand $finishRememberedLoginCommand
) {
$this->userDisabledCheckCommand = $userDisabledCheckCommand;
$this->webAuthnLoginCommand = $webAuthnLoginCommand;
private $tokenProvider;
public function __construct(ISession $session,
- LoggerInterface $logger,
- IProvider $tokenProvider = null) {
+ LoggerInterface $logger,
+ IProvider $tokenProvider = null) {
$this->session = $session;
$this->logger = $logger;
$this->tokenProvider = $tokenProvider;
* @throws \RuntimeException when OpenSSL reports a problem
*/
public function generateToken(string $token,
- string $uid,
- string $loginName,
- ?string $password,
- string $name,
- int $type = IToken::TEMPORARY_TOKEN,
- int $remember = IToken::DO_NOT_REMEMBER): IToken;
+ string $uid,
+ string $loginName,
+ ?string $password,
+ string $name,
+ int $type = IToken::TEMPORARY_TOKEN,
+ int $remember = IToken::DO_NOT_REMEMBER): IToken;
/**
* Get a token by token id
* @return IToken
*/
public function generateToken(string $token,
- string $uid,
- string $loginName,
- $password,
- string $name,
- int $type = IToken::TEMPORARY_TOKEN,
- int $remember = IToken::DO_NOT_REMEMBER): IToken {
+ string $uid,
+ string $loginName,
+ $password,
+ string $name,
+ int $type = IToken::TEMPORARY_TOKEN,
+ int $remember = IToken::DO_NOT_REMEMBER): IToken {
if (mb_strlen($name) > 128) {
$name = mb_substr($name, 0, 120) . '…';
}
use OC\Authentication\Exceptions\ExpiredTokenException;
use OC\Authentication\Exceptions\InvalidTokenException;
-use OC\Authentication\Exceptions\TokenPasswordExpiredException;
use OC\Authentication\Exceptions\PasswordlessTokenException;
+use OC\Authentication\Exceptions\TokenPasswordExpiredException;
use OC\Authentication\Exceptions\WipeTokenException;
-use OCP\AppFramework\Db\TTransactional;
-use OCP\Cache\CappedMemoryCache;
use OCP\AppFramework\Db\DoesNotExistException;
+use OCP\AppFramework\Db\TTransactional;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Cache\CappedMemoryCache;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IUserManager;
private IHasher $hasher;
public function __construct(PublicKeyTokenMapper $mapper,
- ICrypto $crypto,
- IConfig $config,
- IDBConnection $db,
- LoggerInterface $logger,
- ITimeFactory $time,
- IHasher $hasher) {
+ ICrypto $crypto,
+ IConfig $config,
+ IDBConnection $db,
+ LoggerInterface $logger,
+ ITimeFactory $time,
+ IHasher $hasher) {
$this->mapper = $mapper;
$this->crypto = $crypto;
$this->config = $config;
* {@inheritDoc}
*/
public function generateToken(string $token,
- string $uid,
- string $loginName,
- ?string $password,
- string $name,
- int $type = IToken::TEMPORARY_TOKEN,
- int $remember = IToken::DO_NOT_REMEMBER): IToken {
+ string $uid,
+ string $loginName,
+ ?string $password,
+ string $name,
+ int $type = IToken::TEMPORARY_TOKEN,
+ int $remember = IToken::DO_NOT_REMEMBER): IToken {
if (strlen($token) < self::TOKEN_MIN_LENGTH) {
$exception = new InvalidTokenException('Token is too short, minimum of ' . self::TOKEN_MIN_LENGTH . ' characters is required, ' . strlen($token) . ' characters given');
$this->logger->error('Invalid token provided when generating new token', ['exception' => $exception]);
* @throws \RuntimeException when OpenSSL reports a problem
*/
private function newToken(string $token,
- string $uid,
- string $loginName,
- $password,
- string $name,
- int $type,
- int $remember): PublicKeyToken {
+ string $uid,
+ string $loginName,
+ $password,
+ string $name,
+ int $type,
+ int $remember): PublicKeyToken {
$dbToken = new PublicKeyToken();
$dbToken->setUid($uid);
$dbToken->setLoginName($loginName);
*/
namespace OC\Authentication\Token;
-use Psr\Log\LoggerInterface;
-use function array_filter;
use OC\Authentication\Events\RemoteWipeFinished;
use OC\Authentication\Events\RemoteWipeStarted;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Exceptions\WipeTokenException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUser;
+use Psr\Log\LoggerInterface;
+use function array_filter;
class RemoteWipe {
/** @var IProvider */
private $logger;
public function __construct(IProvider $tokenProvider,
- IEventDispatcher $eventDispatcher,
- LoggerInterface $logger) {
+ IEventDispatcher $eventDispatcher,
+ LoggerInterface $logger) {
$this->tokenProvider = $tokenProvider;
$this->eventDispatcher = $eventDispatcher;
$this->logger = $logger;
* @param string[] $excludedGroups
*/
public function __construct(bool $enforced,
- array $enforcedGroups = [],
- array $excludedGroups = []) {
+ array $enforcedGroups = [],
+ array $excludedGroups = []) {
$this->enforced = $enforced;
$this->enforcedGroups = $enforcedGroups;
$this->excludedGroups = $excludedGroups;
private $userIsTwoFactorAuthenticated = [];
public function __construct(ProviderLoader $providerLoader,
- IRegistry $providerRegistry,
- MandatoryTwoFactor $mandatoryTwoFactor,
- ISession $session,
- IConfig $config,
- IManager $activityManager,
- LoggerInterface $logger,
- TokenProvider $tokenProvider,
- ITimeFactory $timeFactory,
- IEventDispatcher $eventDispatcher) {
+ IRegistry $providerRegistry,
+ MandatoryTwoFactor $mandatoryTwoFactor,
+ ISession $session,
+ IConfig $config,
+ IManager $activityManager,
+ LoggerInterface $logger,
+ TokenProvider $tokenProvider,
+ ITimeFactory $timeFactory,
+ IEventDispatcher $eventDispatcher) {
$this->providerLoader = $providerLoader;
$this->providerRegistry = $providerRegistry;
$this->mandatoryTwoFactor = $mandatoryTwoFactor;
*/
namespace OC\Authentication\TwoFactorAuth;
-use function array_filter;
use OCA\TwoFactorBackupCodes\Provider\BackupCodesProvider;
use OCP\Authentication\TwoFactorAuth\IProvider;
+use function array_filter;
/**
* Contains all two-factor provider information for the two-factor login challenge
private $dispatcher;
public function __construct(ProviderUserAssignmentDao $assignmentDao,
- IEventDispatcher $dispatcher) {
+ IEventDispatcher $dispatcher) {
$this->assignmentDao = $assignmentDao;
$this->dispatcher = $dispatcher;
}
$user->getUID(), //Name
$user->getUID(), //ID
$user->getDisplayName() //Display name
-// 'https://foo.example.co/avatar/123e4567-e89b-12d3-a456-426655440000' //Icon
+ // 'https://foo.example.co/avatar/123e4567-e89b-12d3-a456-426655440000' //Icon
);
$challenge = random_bytes(32);
*/
namespace OC\Avatar;
-use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\InMemoryFile;
+use OCP\Files\SimpleFS\ISimpleFile;
use Psr\Log\LoggerInterface;
/**
namespace OC;
+use OCP\IBinaryFinder;
use OCP\ICache;
use OCP\ICacheFactory;
-use OCP\IBinaryFinder;
use Symfony\Component\Process\ExecutableFinder;
/**
use OCP\AppFramework\QueryException;
use OCP\Capabilities\ICapability;
-use OCP\Capabilities\IPublicCapability;
use OCP\Capabilities\IInitialStateExcludedCapability;
+use OCP\Capabilities\IPublicCapability;
use Psr\Log\LoggerInterface;
class CapabilitiesManager {
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
-use OCP\Share\IShare;
use OCP\Mail\IMailer;
+use OCP\Share\IShare;
class MailPlugin implements ISearchPlugin {
protected bool $shareWithGroupOnly;
*/
namespace OC\Command;
-use OC\BackgroundJob\QueuedJob;
use Laravel\SerializableClosure\SerializableClosure as LaravelClosure;
+use OC\BackgroundJob\QueuedJob;
class ClosureJob extends QueuedJob {
protected function run($argument) {
*/
namespace OC\Command;
-use OCP\Command\ICommand;
use Laravel\SerializableClosure\SerializableClosure;
+use OCP\Command\ICommand;
class CronBus extends AsyncBus {
/**
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IEmojiHelper;
-use OCP\IUser;
use OCP\IInitialStateService;
+use OCP\IUser;
use OCP\PreConditionNotMetException;
use OCP\Util;
use Psr\Log\LoggerInterface;
protected array $displayNameResolvers = [];
public function __construct(IDBConnection $dbConn,
- LoggerInterface $logger,
- IConfig $config,
- ITimeFactory $timeFactory,
- IEmojiHelper $emojiHelper,
- IInitialStateService $initialStateService) {
+ LoggerInterface $logger,
+ IConfig $config,
+ ITimeFactory $timeFactory,
+ IEmojiHelper $emojiHelper,
+ IInitialStateService $initialStateService) {
$this->dbConn = $dbConn;
$this->logger = $logger;
$this->config = $config;
* @param int $id the comment to look for
*/
protected function getLastKnownComment(string $objectType,
- string $objectId,
- int $id): ?IComment {
+ string $objectId,
+ int $id): ?IComment {
$query = $this->dbConn->getQueryBuilder();
$query->select('*')
->from('comments')
private MemoryInfo $memoryInfo;
public function __construct(IConfig $config,
- IEventDispatcher $dispatcher,
- IRequest $request,
- LoggerInterface $logger,
- MemoryInfo $memoryInfo) {
+ IEventDispatcher $dispatcher,
+ IRequest $request,
+ LoggerInterface $logger,
+ MemoryInfo $memoryInfo) {
$defaults = \OC::$server->getThemingDefaults();
$this->config = $config;
$this->application = new SymfonyApplication($defaults->getName(), \OC_Util::getVersionString());
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Statement;
+use OC\DB\QueryBuilder\QueryBuilder;
+use OC\SystemConfig;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Diagnostics\IEventLogger;
use OCP\IRequestId;
use OCP\PreConditionNotMetException;
use OCP\Profiler\IProfiler;
-use OC\DB\QueryBuilder\QueryBuilder;
-use OC\SystemConfig;
use Psr\Log\LoggerInterface;
class Connection extends \Doctrine\DBAL\Connection {
use Doctrine\DBAL\Schema\SchemaDiff;
use Doctrine\DBAL\Types\StringType;
use Doctrine\DBAL\Types\Type;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use function preg_match;
-use OCP\EventDispatcher\IEventDispatcher;
class Migrator {
/** @var Connection */
private $noEmit = false;
public function __construct(Connection $connection,
- IConfig $config,
- ?IEventDispatcher $dispatcher = null) {
+ IConfig $config,
+ ?IEventDispatcher $dispatcher = null) {
$this->connection = $connection;
$this->config = $config;
$this->dispatcher = $dispatcher;
use OCP\Dashboard\IWidget;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
-use Throwable;
use Psr\Log\LoggerInterface;
+use Throwable;
class Manager implements IManager {
/** @var array */
*/
namespace OC\DirectEditing;
-use Doctrine\DBAL\FetchMode;
+use \OCP\DirectEditing\IManager;
use \OCP\Files\Folder;
+use Doctrine\DBAL\FetchMode;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DirectEditing\ACreateFromTemplate;
use OCP\DirectEditing\IEditor;
-use \OCP\DirectEditing\IManager;
use OCP\DirectEditing\IToken;
use OCP\Encryption\IManager as EncryptionManager;
use OCP\Files\File;
* EncryptionWrapper constructor.
*/
public function __construct(ArrayCache $arrayCache,
- Manager $manager,
- LoggerInterface $logger
+ Manager $manager,
+ LoggerInterface $logger
) {
$this->arrayCache = $arrayCache;
$this->manager = $manager;
*/
namespace OC\Encryption;
-use OCP\Cache\CappedMemoryCache;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\App\IAppManager;
+use OCP\Cache\CappedMemoryCache;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\Share\IManager;
private ?IAppManager $appManager = null;
public function __construct(Util $util,
- IRootFolder $rootFolder,
- IManager $shareManager) {
+ IRootFolder $rootFolder,
+ IManager $shareManager) {
$this->util = $util;
$this->cache = new CappedMemoryCache();
$this->rootFolder = $rootFolder;
namespace OC\Encryption;
use OC\Files\Filesystem;
-use OC\Files\View;
use OC\Files\SetupManager;
+use OC\Files\View;
use Psr\Log\LoggerInterface;
class HookManager {
* @param string $uid
*/
public function __construct(
- View $view,
- Util $util,
- Mount\Manager $mountManager,
- Manager $encryptionManager,
- File $file,
- LoggerInterface $logger,
- $uid
- ) {
+ View $view,
+ Util $util,
+ Mount\Manager $mountManager,
+ Manager $encryptionManager,
+ File $file,
+ LoggerInterface $logger,
+ $uid
+ ) {
$this->view = $view;
$this->util = $util;
$this->mountManager = $mountManager;
*/
namespace OC\EventDispatcher;
-use OC\Log;
-use Psr\Log\LoggerInterface;
-use function get_class;
use OC\Broadcast\Events\BroadcastEvent;
+use OC\Log;
use OCP\Broadcast\Events\IBroadcastEvent;
use OCP\EventDispatcher\ABroadcastedEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IContainer;
use OCP\IServerContainer;
+use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher;
+use function get_class;
class EventDispatcher implements IEventDispatcher {
/** @var SymfonyDispatcher */
private $logger;
public function __construct(SymfonyDispatcher $dispatcher,
- IServerContainer $container,
- LoggerInterface $logger) {
+ IServerContainer $container,
+ LoggerInterface $logger) {
$this->dispatcher = $dispatcher;
$this->container = $container;
$this->logger = $logger;
}
public function addListener(string $eventName,
- callable $listener,
- int $priority = 0): void {
+ callable $listener,
+ int $priority = 0): void {
$this->dispatcher->addListener($eventName, $listener, $priority);
}
public function removeListener(string $eventName,
- callable $listener): void {
+ callable $listener): void {
$this->dispatcher->removeListener($eventName, $listener);
}
public function addServiceListener(string $eventName,
- string $className,
- int $priority = 0): void {
+ string $className,
+ int $priority = 0): void {
$listener = new ServiceEventListener(
$this->container,
$className,
* @deprecated
*/
public function dispatch(string $eventName,
- Event $event): void {
+ Event $event): void {
$this->dispatcher->dispatch($event, $eventName);
if ($event instanceof ABroadcastedEvent && !$event->isPropagationStopped()) {
private $service;
public function __construct(IServerContainer $container,
- string $class,
- LoggerInterface $logger) {
+ string $class,
+ LoggerInterface $logger) {
$this->container = $container;
$this->class = $class;
$this->logger = $logger;
* @param string $sharedSecret
*/
public function __construct($shareWith = '',
- $name = '',
- $description = '',
- $providerId = '',
- $owner = '',
- $ownerDisplayName = '',
- $sharedBy = '',
- $sharedByDisplayName = '',
- $shareType = '',
- $resourceType = '',
- $sharedSecret = ''
+ $name = '',
+ $description = '',
+ $providerId = '',
+ $owner = '',
+ $ownerDisplayName = '',
+ $sharedBy = '',
+ $sharedByDisplayName = '',
+ $shareType = '',
+ $resourceType = '',
+ $sharedSecret = ''
) {
$this->setShareWith($shareWith);
$this->setResourceName($name);
*/
namespace OC\Files\AppData;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\SimpleFS\SimpleFolder;
use OC\SystemConfig;
+use OCP\Cache\CappedMemoryCache;
use OCP\Files\Folder;
use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
* @param string $appId
*/
public function __construct(IRootFolder $rootFolder,
- SystemConfig $systemConfig,
- string $appId) {
+ SystemConfig $systemConfig,
+ string $appId) {
$this->rootFolder = $rootFolder;
$this->config = $systemConfig;
$this->appId = $appId;
private array $folders = [];
public function __construct(IRootFolder $rootFolder,
- SystemConfig $systemConfig) {
+ SystemConfig $systemConfig) {
$this->rootFolder = $rootFolder;
$this->config = $systemConfig;
}
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Cache\CacheEntryInsertedEvent;
+use OCP\Files\Cache\CacheEntryRemovedEvent;
use OCP\Files\Cache\CacheEntryUpdatedEvent;
use OCP\Files\Cache\CacheInsertEvent;
-use OCP\Files\Cache\CacheEntryRemovedEvent;
use OCP\Files\Cache\CacheUpdateEvent;
use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
use Doctrine\DBAL\Exception;
use OC\Files\Storage\Wrapper\Encryption;
+use OC\Files\Storage\Wrapper\Jail;
+use OC\Hooks\BasicEmitter;
use OCP\Files\Cache\IScanner;
use OCP\Files\ForbiddenException;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IReliableEtagStorage;
use OCP\IDBConnection;
use OCP\Lock\ILockingProvider;
-use OC\Files\Storage\Wrapper\Jail;
-use OC\Hooks\BasicEmitter;
use Psr\Log\LoggerInterface;
/**
*/
namespace OC\Files;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\Mount\MountPoint;
use OC\User\NoUserException;
+use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\Node\FilesystemTornDownEvent;
use OCP\Files\Mount\IMountManager;
namespace OC\Files\Mount;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\Filesystem;
use OC\Files\SetupManager;
use OC\Files\SetupManagerFactory;
+use OCP\Cache\CappedMemoryCache;
use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Mount\IMountManager;
use OCP\Files\Mount\IMountPoint;
use OC\Files\Filesystem;
use OC\Files\Utils\PathHelper;
-use OCP\Files\Folder;
use OCP\Constants;
+use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotPermittedException;
namespace OC\Files\Node;
-use OCP\Files\FileInfo;
use OCP\Constants;
+use OCP\Files\File;
+use OCP\Files\FileInfo;
+use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountManager;
use OCP\Files\NotFoundException;
-use OCP\Files\Folder;
-use OCP\Files\File;
use OCP\IUser;
use Psr\Log\LoggerInterface;
namespace OC\Files\Node;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\FileInfo;
use OC\Files\Mount\Manager;
use OC\Files\Mount\MountPoint;
use OC\Files\View;
use OC\Hooks\PublicEmitter;
use OC\User\NoUserException;
+use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Folder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
-use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\Files\SimpleFS\ISimpleFile;
+use OCP\Files\SimpleFS\ISimpleFolder;
class SimpleFolder implements ISimpleFolder {
/** @var Folder */
use OCP\IConfig;
use OCP\Util;
use Psr\Http\Message\ResponseInterface;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Client;
use Sabre\DAV\Xml\Property\ResourceType;
use Sabre\HTTP\ClientException;
use Sabre\HTTP\ClientHttpException;
-use Psr\Log\LoggerInterface;
use Sabre\HTTP\RequestInterface;
/**
*/
namespace OC\Files\Storage\Wrapper;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\Filesystem;
+use OCP\Cache\CappedMemoryCache;
use OCP\Files\Storage\IStorage;
use OCP\ICache;
* @throws \BadMethodCallException
*/
public static function wrap($source, $internalPath, $fullPath, array $header,
- $uid,
- \OCP\Encryption\IEncryptionModule $encryptionModule,
- \OC\Files\Storage\Storage $storage,
- \OC\Files\Storage\Wrapper\Encryption $encStorage,
- \OC\Encryption\Util $util,
- \OC\Encryption\File $file,
- $mode,
- $size,
- $unencryptedSize,
- $headerSize,
- $signed,
- $wrapper = Encryption::class) {
+ $uid,
+ \OCP\Encryption\IEncryptionModule $encryptionModule,
+ \OC\Files\Storage\Storage $storage,
+ \OC\Files\Storage\Wrapper\Encryption $encStorage,
+ \OC\Encryption\Util $util,
+ \OC\Encryption\File $file,
+ $mode,
+ $size,
+ $unencryptedSize,
+ $headerSize,
+ $signed,
+ $wrapper = Encryption::class) {
$context = stream_context_create([
'ocencryption' => [
'source' => $source,
use OC\Files\Cache\Scanner;
use OC\Files\Filesystem;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Files\Folder;
use OCP\Files\File;
+use OCP\Files\Folder;
use OCP\Files\GenericFileException;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
private $defaultConfigDir;
public function __construct(IURLGenerator $urlGenerator,
- LoggerInterface $logger,
- string $customConfigDir,
- string $defaultConfigDir) {
+ LoggerInterface $logger,
+ string $customConfigDir,
+ string $defaultConfigDir) {
$this->urlGenerator = $urlGenerator;
$this->logger = $logger;
$this->customConfigDir = $customConfigDir;
* @param string|null $secureMimeType
*/
public function registerType(string $extension,
- string $mimetype,
- ?string $secureMimeType = null): void {
+ string $mimetype,
+ ?string $secureMimeType = null): void {
$this->mimetypes[$extension] = [$mimetype, $secureMimeType];
$this->secureMimeTypes[$mimetype] = $secureMimeType ?: $mimetype;
}
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\BeforeFileScannedEvent;
use OCP\Files\Events\BeforeFolderScannedEvent;
-use OCP\Files\Events\NodeAddedToCache;
use OCP\Files\Events\FileCacheUpdated;
-use OCP\Files\Events\NodeRemovedFromCache;
use OCP\Files\Events\FileScannedEvent;
use OCP\Files\Events\FolderScannedEvent;
+use OCP\Files\Events\NodeAddedToCache;
+use OCP\Files\Events\NodeRemovedFromCache;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use Icewind\Streams\CallbackWrapper;
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
-use OC\User\LazyUser;
use OC\Share\Share;
-use OC\User\User;
+use OC\User\LazyUser;
use OC\User\Manager as UserManager;
+use OC\User\User;
use OCA\Files_Sharing\SharedMount;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
namespace OC\Group;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
+use OC\User\LazyUser;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Group\Backend\ABackend;
use OCP\Group\Backend\IAddToGroupBackend;
use OCP\Group\Backend\IDeleteGroupBackend;
use OCP\Group\Backend\IGetDisplayNameBackend;
use OCP\Group\Backend\IGroupDetailsBackend;
+use OCP\Group\Backend\INamedBackend;
use OCP\Group\Backend\IRemoveFromGroupBackend;
use OCP\Group\Backend\ISearchableGroupBackend;
use OCP\Group\Backend\ISetDisplayNameBackend;
-use OCP\Group\Backend\INamedBackend;
use OCP\IDBConnection;
use OCP\IUserManager;
-use OC\User\LazyUser;
/**
* Class for group management in a SQL Database (e.g. MySQL, SQLite)
use OC\Hooks\PublicEmitter;
use OC\User\LazyUser;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Group\Events\BeforeGroupDeletedEvent;
-use OCP\Group\Events\BeforeUserAddedEvent;
-use OCP\Group\Events\BeforeUserRemovedEvent;
-use OCP\Group\Events\GroupDeletedEvent;
-use OCP\Group\Events\UserAddedEvent;
-use OCP\Group\Events\UserRemovedEvent;
-use OCP\GroupInterface;
use OCP\Group\Backend\ICountDisabledInGroup;
use OCP\Group\Backend\IGetDisplayNameBackend;
use OCP\Group\Backend\IHideFromCollaborationBackend;
use OCP\Group\Backend\ISearchableGroupBackend;
use OCP\Group\Backend\ISetDisplayNameBackend;
use OCP\Group\Events\BeforeGroupChangedEvent;
+use OCP\Group\Events\BeforeGroupDeletedEvent;
+use OCP\Group\Events\BeforeUserAddedEvent;
+use OCP\Group\Events\BeforeUserRemovedEvent;
use OCP\Group\Events\GroupChangedEvent;
+use OCP\Group\Events\GroupDeletedEvent;
+use OCP\Group\Events\UserAddedEvent;
+use OCP\Group\Events\UserRemovedEvent;
+use OCP\GroupInterface;
use OCP\IGroup;
use OCP\IUser;
use OCP\IUserManager;
private DisplayNameCache $displayNameCache;
public function __construct(\OC\User\Manager $userManager,
- IEventDispatcher $dispatcher,
- LoggerInterface $logger,
- ICacheFactory $cacheFactory) {
+ IEventDispatcher $dispatcher,
+ LoggerInterface $logger,
+ ICacheFactory $cacheFactory) {
$this->userManager = $userManager;
$this->dispatcher = $dispatcher;
$this->logger = $logger;
* @param bool $isAdmin whether the current users is an admin
*/
public function __construct(
- string $user,
- bool $isAdmin,
- IGroupManager $groupManager,
- IUserSession $userSession
- ) {
+ string $user,
+ bool $isAdmin,
+ IGroupManager $groupManager,
+ IUserSession $userSession
+ ) {
$this->user = $user;
$this->isAdmin = $isAdmin;
$this->groupManager = $groupManager;
public const SAMESITE_STRICT = 2;
public static function setCookie(string $name,
- string $value = '',
- int $maxAge = 0,
- string $path = '',
- string $domain = '',
- bool $secure = false,
- bool $httponly = false,
- int $samesite = self::SAMESITE_NONE) {
+ string $value = '',
+ int $maxAge = 0,
+ string $path = '',
+ string $domain = '',
+ bool $secure = false,
+ bool $httponly = false,
+ int $samesite = self::SAMESITE_NONE) {
$header = sprintf(
'Set-Cookie: %s=%s',
$name,
private $logger;
public function __construct(Coordinator $coordinator,
- IServerContainer $container,
- LoggerInterface $logger) {
+ IServerContainer $container,
+ LoggerInterface $logger) {
$this->coordinator = $coordinator;
$this->container = $container;
$this->logger = $logger;
* @param IMimeTypeDetector $mimeTypeDetector
*/
public function __construct(EnvironmentHelper $environmentHelper,
- FileAccessHelper $fileAccessHelper,
- AppLocator $appLocator,
- ?IConfig $config,
- ICacheFactory $cacheFactory,
- ?IAppManager $appManager,
- IMimeTypeDetector $mimeTypeDetector) {
+ FileAccessHelper $fileAccessHelper,
+ AppLocator $appLocator,
+ ?IConfig $config,
+ ICacheFactory $cacheFactory,
+ ?IAppManager $appManager,
+ IMimeTypeDetector $mimeTypeDetector) {
$this->environmentHelper = $environmentHelper;
$this->fileAccessHelper = $fileAccessHelper;
$this->appLocator = $appLocator;
* @return array Array of hashes.
*/
private function generateHashes(\RecursiveIteratorIterator $iterator,
- string $path): array {
+ string $path): array {
$hashes = [];
$baseDirectoryLength = \strlen($path);
* @return array
*/
private function createSignatureData(array $hashes,
- X509 $certificate,
- RSA $privateKey): array {
+ X509 $certificate,
+ RSA $privateKey): array {
ksort($hashes);
$privateKey->setSignatureMode(RSA::SIGNATURE_PSS);
* @throws \Exception
*/
public function writeAppSignature($path,
- X509 $certificate,
- RSA $privateKey) {
+ X509 $certificate,
+ RSA $privateKey) {
$appInfoDir = $path . '/appinfo';
try {
$this->fileAccessHelper->assertDirectoryExists($appInfoDir);
* @throws \Exception
*/
public function writeCoreSignature(X509 $certificate,
- RSA $rsa,
- $path) {
+ RSA $rsa,
+ $path) {
$coreDir = $path . '/core';
try {
$this->fileAccessHelper->assertDirectoryExists($coreDir);
use Exception;
use Nextcloud\LogNormalizer\Normalizer;
+use OC\AppFramework\Bootstrap\Coordinator;
+use OC\Log\ExceptionSerializer;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
use OCP\IUserSession;
use OCP\Log\IFileBased;
use OCP\Log\IWriter;
use OCP\Support\CrashReport\IRegistry;
-use OC\AppFramework\Bootstrap\Coordinator;
-use OC\Log\ExceptionSerializer;
use Throwable;
use function array_merge;
use function strtr;
namespace OC\Memcache;
use OCP\Cache\CappedMemoryCache;
-use OCP\Profiler\IProfiler;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IMemcache;
+use OCP\Profiler\IProfiler;
use Psr\Log\LoggerInterface;
class Factory implements ICacheFactory {
*/
namespace OC\Migration;
+use OC\NeedsUpdateException;
+use OC\Repair;
+use OC_App;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\TimedJob;
use OCP\EventDispatcher\IEventDispatcher;
-use OC\NeedsUpdateException;
-use OC\Repair;
-use OC_App;
use Psr\Log\LoggerInterface;
/**
private array $customAppOrder;
public function __construct(IAppManager $appManager,
- IURLGenerator $urlGenerator,
- IFactory $l10nFac,
- IUserSession $userSession,
- IGroupManager $groupManager,
- IConfig $config) {
+ IURLGenerator $urlGenerator,
+ IFactory $l10nFac,
+ IUserSession $userSession,
+ IGroupManager $groupManager,
+ IConfig $config) {
$this->appManager = $appManager;
$this->urlGenerator = $urlGenerator;
$this->l10nFac = $l10nFac;
private $parsedRegistrationContext;
public function __construct(IValidator $validator,
- IUserManager $userManager,
- ICacheFactory $cacheFactory,
- IRegistry $subscription,
- LoggerInterface $logger,
- Coordinator $coordinator) {
+ IUserManager $userManager,
+ ICacheFactory $cacheFactory,
+ IRegistry $subscription,
+ LoggerInterface $logger,
+ Coordinator $coordinator) {
$this->validator = $validator;
$this->userManager = $userManager;
$this->cache = $cacheFactory->createDistributed('notifications');
* @param IClientService $clientService
*/
public function __construct(ICacheFactory $cacheFactory,
- IClientService $clientService
+ IClientService $clientService
) {
$this->cache = $cacheFactory->createDistributed('ocs-discovery');
$this->client = $clientService->newClient();
* @param \OCP\App\IAppManager $appManager
*/
public function __construct($appName,
- \OCP\IRequest $request,
- \OCP\App\IAppManager $appManager) {
+ \OCP\IRequest $request,
+ \OCP\App\IAppManager $appManager) {
parent::__construct($appName, $request);
$this->appManager = $appManager;
}
private $mimeTypeLoader;
public function __construct(ITimeFactory $timeFactory,
- IDBConnection $connection,
- Root $previewFolder,
- IMimeTypeLoader $mimeTypeLoader,
- bool $isCLI) {
+ IDBConnection $connection,
+ Root $previewFolder,
+ IMimeTypeLoader $mimeTypeLoader,
+ bool $isCLI) {
parent::__construct($timeFactory);
// Run at most once an hour
$this->setInterval(3600);
namespace OC\Preview;
+use OC\StreamImage;
use OCP\Files\File;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IImage;
-use OCP\Image;
-use OC\StreamImage;
+use OCP\Image;
use Psr\Log\LoggerInterface;
class Imaginary extends ProviderV2 {
* @param SystemConfig $config
*/
public function __construct(IRootFolder $root,
- SystemConfig $config) {
+ SystemConfig $config) {
$this->root = $root;
$this->config = $config;
}
namespace OC\Profile\Actions;
-use function substr;
use OCP\Accounts\IAccountManager;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\L10N\IFactory;
use OCP\Profile\ILinkAction;
+use function substr;
class FediverseAction implements ILinkAction {
private string $value = '';
namespace OC\Profile\Actions;
-use function substr;
use OCP\Accounts\IAccountManager;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\L10N\IFactory;
use OCP\Profile\ILinkAction;
+use function substr;
class TwitterAction implements ILinkAction {
private string $value = '';
namespace OC\Profile;
-use OCP\Profile\IProfileManager;
-use function array_flip;
-use function usort;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\Core\Db\ProfileConfig;
use OC\Core\Db\ProfileConfigMapper;
use OC\KnownUser\KnownUserService;
use OC\Profile\Actions\EmailAction;
+use OC\Profile\Actions\FediverseAction;
use OC\Profile\Actions\PhoneAction;
use OC\Profile\Actions\TwitterAction;
-use OC\Profile\Actions\FediverseAction;
use OC\Profile\Actions\WebsiteAction;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\PropertyDoesNotExistException;
use OCP\App\IAppManager;
use OCP\AppFramework\Db\DoesNotExistException;
+use OCP\Cache\CappedMemoryCache;
use OCP\IConfig;
use OCP\IUser;
use OCP\L10N\IFactory;
use OCP\Profile\ILinkAction;
-use OCP\Cache\CappedMemoryCache;
+use OCP\Profile\IProfileManager;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
+use function array_flip;
+use function usort;
class ProfileManager implements IProfileManager {
/** @var ILinkAction[] */
namespace OC\Profiler;
use OC\AppFramework\Http\Request;
+use OC\SystemConfig;
use OCP\AppFramework\Http\Response;
use OCP\DataCollector\IDataCollector;
-use OCP\Profiler\IProfiler;
use OCP\Profiler\IProfile;
-use OC\SystemConfig;
+use OCP\Profiler\IProfiler;
class Profiler implements IProfiler {
/** @var array<string, IDataCollector> */
* @return array[]
*/
public function find(?string $url, ?int $limit, ?string $method, ?int $start, ?int $end,
- string $statusCode = null): array {
+ string $statusCode = null): array {
if ($this->storage) {
return $this->storage->find($url, $limit, $method, $start, $end, $statusCode);
} else {
*/
namespace OC;
-use OC\Repair\AddRemoveOldTasksBackgroundJob;
-use OC\Repair\CleanUpAbandonedApps;
-use OCP\AppFramework\QueryException;
-use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\Collaboration\Resources\IManager;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Migration\IOutput;
-use OCP\Migration\IRepairStep;
use OC\DB\Connection;
use OC\DB\ConnectionAdapter;
use OC\Repair\AddBruteForceCleanupJob;
use OC\Repair\AddCleanupUpdaterBackupsJob;
use OC\Repair\AddMetadataGenerationJob;
+use OC\Repair\AddRemoveOldTasksBackgroundJob;
use OC\Repair\CleanTags;
+use OC\Repair\CleanUpAbandonedApps;
use OC\Repair\ClearFrontendCaches;
use OC\Repair\ClearGeneratedAvatarCache;
use OC\Repair\Collation;
use OC\Repair\RepairInvalidShares;
use OC\Repair\RepairMimeTypes;
use OC\Template\JSCombiner;
+use OCP\AppFramework\QueryException;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\Collaboration\Resources\IManager;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
use Psr\Log\LoggerInterface;
use Throwable;
protected $jsCombiner;
public function __construct(ICacheFactory $cacheFactory,
- JSCombiner $JSCombiner) {
+ JSCombiner $JSCombiner) {
$this->cacheFactory = $cacheFactory;
$this->jsCombiner = $JSCombiner;
}
namespace OC\Repair;
use OC\Avatar\AvatarManager;
-use OCP\IConfig;
use OCP\BackgroundJob\IJobList;
+use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
*/
namespace OC\Repair;
-use OCP\BackgroundJob\QueuedJob;
-use OCP\AppFramework\Utility\ITimeFactory;
use OC\Avatar\AvatarManager;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\BackgroundJob\QueuedJob;
class ClearGeneratedAvatarCacheJob extends QueuedJob {
protected AvatarManager $avatarManager;
private $connection;
public function __construct(IConfig $config,
- IDBConnection $connection) {
+ IDBConnection $connection) {
$this->config = $config;
$this->connection = $connection;
}
private $manager;
public function __construct(IConfig $config,
- IManager $manager) {
+ IManager $manager) {
$this->config = $config;
$this->manager = $manager;
}
private $manager;
public function __construct(IConfig $config,
- IManager $manager) {
+ IManager $manager) {
$this->config = $config;
$this->manager = $manager;
}
private $accountManager;
public function __construct(IUserManager $userManager,
- IAccountManager $accountManager,
- IConfig $config) {
+ IAccountManager $accountManager,
+ IConfig $config) {
$this->config = $config;
$this->userManager = $userManager;
$this->accountManager = $accountManager;
* @param IConfig $config
*/
public function __construct(IJobList $jobList,
- IUserManager $userManager,
- IConfig $config) {
+ IUserManager $userManager,
+ IConfig $config) {
$this->jobList = $jobList;
$this->userManager = $userManager;
$this->config = $config;
* CleanPreviewsBackgroundJob constructor.
*/
public function __construct(IRootFolder $rootFolder,
- LoggerInterface $logger,
- IJobList $jobList,
- ITimeFactory $timeFactory,
- IUserManager $userManager) {
+ LoggerInterface $logger,
+ IJobList $jobList,
+ ITimeFactory $timeFactory,
+ IUserManager $userManager) {
$this->rootFolder = $rootFolder;
$this->logger = $logger;
$this->jobList = $jobList;
*/
namespace OC\Repair\Owncloud;
-use OCP\Migration\IOutput;
-use OCP\Migration\IRepairStep;
use OC\DB\Connection;
use OC\DB\SchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
class MigrateOauthTables implements IRepairStep {
/** @var Connection */
* @param IConfig $config
*/
public function __construct(IJobList $jobList,
- IConfig $config) {
+ IConfig $config) {
$this->jobList = $jobList;
$this->config = $config;
}
* @param IConfig $config
*/
public function __construct(IDBConnection $connection,
- IConfig $config) {
+ IConfig $config) {
$this->connection = $connection;
$this->config = $config;
}
private $timeFactory;
public function __construct(IDBConnection $connection,
- IConfig $config,
- IGroupManager $groupManager,
- IManager $notificationManager,
- ITimeFactory $timeFactory) {
+ IConfig $config,
+ IGroupManager $groupManager,
+ IManager $notificationManager,
+ ITimeFactory $timeFactory) {
$this->connection = $connection;
$this->config = $config;
$this->groupManager = $groupManager;
protected $folderMimeTypeId;
public function __construct(IConfig $config,
- IDBConnection $connection) {
+ IDBConnection $connection) {
$this->config = $config;
$this->connection = $connection;
}
* @return \OC\Route\Route
*/
public function create($name,
- $pattern,
- array $defaults = [],
- array $requirements = []) {
+ $pattern,
+ array $defaults = [],
+ array $requirements = []) {
$route = new Route($pattern, $defaults, $requirements);
$this->collection->add($name, $route);
return $route;
* @return string
*/
public function generate($name,
- $parameters = [],
- $absolute = false) {
+ $parameters = [],
+ $absolute = false) {
$referenceType = UrlGenerator::ABSOLUTE_URL;
if ($absolute === false) {
$referenceType = UrlGenerator::ABSOLUTE_PATH;
namespace OC\Search;
use Generator;
-use OCP\Search\IFilterCollection;
use OCP\Search\IFilter;
+use OCP\Search\IFilterCollection;
/**
* Interface for search filters
*/
namespace OC\Search;
-use OCP\Search\FilterDefinition;
-use OCP\Search\IFilter;
use OCP\IGroupManager;
use OCP\IUserManager;
+use OCP\Search\FilterDefinition;
+use OCP\Search\IFilter;
use RuntimeException;
final class FilterFactory {
namespace OC\Search;
use InvalidArgumentException;
+use OC\AppFramework\Bootstrap\Coordinator;
use OCP\IURLGenerator;
+use OCP\IUser;
use OCP\Search\FilterDefinition;
+use OCP\Search\IFilter;
use OCP\Search\IFilteringProvider;
use OCP\Search\IInAppSearch;
-use OC\AppFramework\Bootstrap\Coordinator;
-use OCP\IUser;
-use OCP\Search\IFilter;
use OCP\Search\IProvider;
use OCP\Search\ISearchQuery;
use OCP\Search\SearchResult;
*/
namespace OC\Search;
-use OCP\Search\IFilterCollection;
use OCP\Search\IFilter;
+use OCP\Search\IFilterCollection;
use OCP\Search\ISearchQuery;
class SearchQuery implements ISearchQuery {
*/
namespace OC\Security\Bruteforce;
-use OCP\Capabilities\IPublicCapability;
use OCP\Capabilities\IInitialStateExcludedCapability;
+use OCP\Capabilities\IPublicCapability;
use OCP\IRequest;
use OCP\Security\Bruteforce\IThrottler;
* {@inheritDoc}
*/
public function registerAttempt(string $action,
- string $ip,
- array $metadata = []): void {
+ string $ip,
+ array $metadata = []): void {
// No need to log if the bruteforce protection is disabled
if (!$this->config->getSystemValueBool('auth.bruteforce.protection.enabled', true)) {
return;
namespace OC\Security\VerificationToken;
use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\IConfig;
-use OCP\IUserManager;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\Job;
+use OCP\IConfig;
+use OCP\IUserManager;
use OCP\Security\VerificationToken\InvalidTokenException;
use OCP\Security\VerificationToken\IVerificationToken;
use OC\IntegrityCheck\Helpers\AppLocator;
use OC\IntegrityCheck\Helpers\EnvironmentHelper;
use OC\IntegrityCheck\Helpers\FileAccessHelper;
-use OC\LDAP\NullLDAPProviderFactory;
use OC\KnownUser\KnownUserService;
+use OC\LDAP\NullLDAPProviderFactory;
use OC\Lock\DBLockingProvider;
use OC\Lock\MemcacheLockingProvider;
use OC\Lock\NoopLockingProvider;
use OC\Preview\IMagickSupport;
use OC\Preview\MimeIconProvider;
use OC\Profile\ProfileManager;
+use OC\Profiler\Profiler;
use OC\Remote\Api\ApiFactory;
use OC\Remote\InstanceFactory;
use OC\RichObjectStrings\Validator;
use OC\User\Listeners\BeforeUserDeletedListener;
use OC\User\Listeners\UserChangedListener;
use OC\User\Session;
+use OCA\Files_External\Service\BackendService;
+use OCA\Files_External\Service\GlobalStoragesService;
+use OCA\Files_External\Service\UserGlobalStoragesService;
+use OCA\Files_External\Service\UserStoragesService;
use OCA\Theming\ImageManager;
use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
use OCP\Http\Client\IClientService;
use OCP\IAppConfig;
use OCP\IAvatarManager;
+use OCP\IBinaryFinder;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\ICertificateManager;
-use OCP\IBinaryFinder;
use OCP\IDateTimeFormatter;
use OCP\IDateTimeZone;
use OCP\IDBConnection;
use OCP\Mail\IMailer;
use OCP\OCM\IOCMDiscoveryService;
use OCP\OCM\IOCMProvider;
+use OCP\Preview\IMimeIconProvider;
use OCP\Profile\IProfileManager;
+use OCP\Profiler\IProfiler;
use OCP\Remote\Api\IApiFactory;
use OCP\Remote\IInstanceFactory;
use OCP\RichObjectStrings\IValidator;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
-use OCA\Files_External\Service\UserStoragesService;
-use OCA\Files_External\Service\UserGlobalStoragesService;
-use OCA\Files_External\Service\GlobalStoragesService;
-use OCA\Files_External\Service\BackendService;
-use OCP\Profiler\IProfiler;
-use OC\Profiler\Profiler;
-use OCP\Preview\IMimeIconProvider;
/**
* Class Server
* @param string $passphrase
*/
public function __construct(ISession $session,
- ICrypto $crypto,
- string $passphrase) {
+ ICrypto $crypto,
+ string $passphrase) {
$this->crypto = $crypto;
$this->session = $session;
$this->passphrase = $passphrase;
* @param IRequest $request
*/
public function __construct(IConfig $config,
- ICrypto $crypto,
- ISecureRandom $random,
- IRequest $request) {
+ ICrypto $crypto,
+ ISecureRandom $random,
+ IRequest $request) {
$this->crypto = $crypto;
$this->config = $config;
$this->random = $random;
use InvalidArgumentException;
use OC\Authentication\Token\PublicKeyTokenProvider;
use OC\Authentication\Token\TokenCleanupJob;
-use OC\TextProcessing\RemoveOldTasksBackgroundJob;
use OC\Log\Rotate;
use OC\Preview\BackgroundCleanupJob;
+use OC\TextProcessing\RemoveOldTasksBackgroundJob;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Defaults;
use OCP\IGroup;
*/
namespace OC\Setup;
+use Doctrine\DBAL\Platforms\MySQL80Platform;
use OC\DB\ConnectionAdapter;
use OC\DB\MySqlTools;
use OCP\IDBConnection;
-use Doctrine\DBAL\Platforms\MySQL80Platform;
use OCP\Security\ISecureRandom;
class MySQL extends AbstractDatabase {
* * defacto $parameters and $format is always the default and therefore is removed in the subsequent call
*/
public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
- $parameters = null, $includeCollections = false) {
+ $parameters = null, $includeCollections = false) {
return self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE,
null, -1, $includeCollections);
}
* * defacto $limit, $itemsShareWithBySource, $checkExpireDate, $parameters and $format is always the default and therefore is removed in the subsequent call
*/
public static function getItems($itemType, ?string $item = null, ?int $shareType = null, $shareWith = null,
- $uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1,
- $includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) {
+ $uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1,
+ $includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) {
if (\OC::$server->getConfig()->getAppValue('core', 'shareapi_enabled', 'yes') != 'yes') {
return [];
}
* @param \DateTime|null $expiration
*/
protected function sendMailNotification(IL10N $l,
- $filename,
- $link,
- $initiator,
- $shareWith,
- \DateTime $expiration = null,
- $note = '') {
+ $filename,
+ $link,
+ $initiator,
+ $shareWith,
+ \DateTime $expiration = null,
+ $note = '') {
$initiatorUser = $this->userManager->get($initiator);
$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
use OC\AppFramework\Bootstrap\Coordinator;
use OCA\Files_Sharing\DefaultPublicShareTemplateProvider;
use OCP\Server;
-use OCP\Share\IShare;
use OCP\Share\IPublicShareTemplateFactory;
use OCP\Share\IPublicShareTemplateProvider;
+use OCP\Share\IShare;
class PublicShareTemplateFactory implements IPublicShareTemplateFactory {
public function __construct(
*/
namespace OC\Share20;
-use OCP\Files\File;
use OCP\Files\Cache\ICacheEntry;
+use OCP\Files\File;
use OCP\Files\FileInfo;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
namespace OC;
-use OCP\IStreamImage;
use OCP\IImage;
+use OCP\IStreamImage;
/**
* Only useful when dealing with transferring streamed previews from an external
* @param IDBConnection $dbConn
*/
public function __construct(IUserManager $userManager,
- IGroupManager $groupManager,
- IDBConnection $dbConn,
- IEventDispatcher $eventDispatcher) {
+ IGroupManager $groupManager,
+ IDBConnection $dbConn,
+ IEventDispatcher $eventDispatcher) {
$this->userManager = $userManager;
$this->groupManager = $groupManager;
$this->dbConn = $dbConn;
private $logger;
public function __construct(IConfig $config,
- IServerContainer $container,
- IUserManager $userManager,
- IGroupManager $groupManager,
- LoggerInterface $logger) {
+ IServerContainer $container,
+ IUserManager $userManager,
+ IGroupManager $groupManager,
+ LoggerInterface $logger) {
$this->config = $config;
$this->container = $container;
$this->userManager = $userManager;
namespace OC;
use OC\Tagging\TagMapper;
+use OCP\Db\Exception as DBException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\ITags;
use OCP\IUserSession;
use OCP\User\Events\UserDeletedEvent;
-use OCP\Db\Exception as DBException;
use Psr\Log\LoggerInterface;
/**
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\QBMapper;
-use OCP\IDBConnection;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IDBConnection;
/**
* Mapper for Tag entity
private ?ITalkBackend $backend = null;
public function __construct(Coordinator $coordinator,
- IServerContainer $container,
- LoggerInterface $logger) {
+ IServerContainer $container,
+ LoggerInterface $logger) {
$this->coordinator = $coordinator;
$this->container = $container;
$this->logger = $logger;
}
public function createConversation(string $name,
- array $moderators,
- IConversationOptions $options = null): IConversation {
+ array $moderators,
+ IConversationOptions $options = null): IConversation {
if (!$this->hasBackend()) {
throw new NoBackendException("The Talk broker has no registered backend");
}
private $cacheFactory;
public function __construct(IAppData $appData,
- IURLGenerator $urlGenerator,
- ICacheFactory $cacheFactory,
- SystemConfig $config,
- LoggerInterface $logger) {
+ IURLGenerator $urlGenerator,
+ ICacheFactory $cacheFactory,
+ SystemConfig $config,
+ LoggerInterface $logger) {
$this->appData = $appData;
$this->urlGenerator = $urlGenerator;
$this->cacheFactory = $cacheFactory;
use OCP\IGroupManager;
use OCP\IInitialStateService;
use OCP\IL10N;
+use OCP\ILogger;
use OCP\ISession;
use OCP\IURLGenerator;
-use OCP\ILogger;
use OCP\IUser;
use OCP\User\Backend\IPasswordConfirmationBackend;
use OCP\Util;
private $excludedUserBackEnds = ['user_saml' => true, 'user_globalsiteselector' => true];
public function __construct(IL10N $l,
- Defaults $defaults,
- IAppManager $appManager,
- ISession $session,
- ?IUser $currentUser,
- IConfig $config,
- IGroupManager $groupManager,
- IniGetWrapper $iniWrapper,
- IURLGenerator $urlGenerator,
- CapabilitiesManager $capabilitiesManager,
- IInitialStateService $initialStateService) {
+ Defaults $defaults,
+ IAppManager $appManager,
+ ISession $session,
+ ?IUser $currentUser,
+ IConfig $config,
+ IGroupManager $groupManager,
+ IniGetWrapper $iniWrapper,
+ IURLGenerator $urlGenerator,
+ CapabilitiesManager $capabilitiesManager,
+ IInitialStateService $initialStateService) {
$this->l = $l;
$this->defaults = $defaults;
$this->appManager = $appManager;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\TextProcessing\Db\Task as DbTask;
-use OCP\IConfig;
-use OCP\TextProcessing\Exception\TaskFailureException;
-use OCP\TextProcessing\IProviderWithExpectedRuntime;
-use OCP\TextProcessing\Task;
-use OCP\TextProcessing\Task as OCPTask;
use OC\TextProcessing\Db\TaskMapper;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\BackgroundJob\IJobList;
use OCP\Common\Exception\NotFoundException;
use OCP\DB\Exception;
+use OCP\IConfig;
use OCP\IServerContainer;
+use OCP\PreConditionNotMetException;
+use OCP\TextProcessing\Exception\TaskFailureException;
use OCP\TextProcessing\IManager;
use OCP\TextProcessing\IProvider;
-use OCP\PreConditionNotMetException;
+use OCP\TextProcessing\IProviderWithExpectedRuntime;
+use OCP\TextProcessing\Task;
+use OCP\TextProcessing\Task as OCPTask;
use Psr\Log\LoggerInterface;
use RuntimeException;
use Throwable;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\TextToImage\Db\Task as DbTask;
+use OC\TextToImage\Db\TaskMapper;
+use OCP\AppFramework\Db\DoesNotExistException;
+use OCP\AppFramework\Db\MultipleObjectsReturnedException;
+use OCP\BackgroundJob\IJobList;
+use OCP\DB\Exception;
use OCP\Files\AppData\IAppDataFactory;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\IConfig;
+use OCP\IServerContainer;
+use OCP\PreConditionNotMetException;
use OCP\TextToImage\Exception\TaskFailureException;
use OCP\TextToImage\Exception\TaskNotFoundException;
use OCP\TextToImage\IManager;
-use OCP\TextToImage\Task;
-use OC\TextToImage\Db\TaskMapper;
-use OCP\AppFramework\Db\DoesNotExistException;
-use OCP\AppFramework\Db\MultipleObjectsReturnedException;
-use OCP\BackgroundJob\IJobList;
-use OCP\DB\Exception;
-use OCP\IServerContainer;
use OCP\TextToImage\IProvider;
-use OCP\PreConditionNotMetException;
+use OCP\TextToImage\Task;
use Psr\Log\LoggerInterface;
use RuntimeException;
use Throwable;
private ?IAppManager $appManager = null;
public function __construct(IConfig $config,
- IUserSession $userSession,
- ICacheFactory $cacheFactory,
- IRequest $request,
- Router $router
+ IUserSession $userSession,
+ ICacheFactory $cacheFactory,
+ IRequest $request,
+ Router $router
) {
$this->config = $config;
$this->userSession = $userSession;
*/
namespace OC;
-use OCP\App\IAppManager;
-use OCP\EventDispatcher\Event;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\HintException;
-use OCP\IConfig;
-use OCP\ILogger;
-use OCP\Util;
use OC\App\AppManager;
use OC\DB\Connection;
use OC\DB\MigrationService;
use OC\Repair\Events\RepairStepEvent;
use OC\Repair\Events\RepairWarningEvent;
use OC_App;
+use OCP\App\IAppManager;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\HintException;
+use OCP\IConfig;
+use OCP\ILogger;
+use OCP\Util;
use Psr\Log\LoggerInterface;
/**
];
public function __construct(IConfig $config,
- Checker $checker,
- ?LoggerInterface $log,
- Installer $installer) {
+ Checker $checker,
+ ?LoggerInterface $log,
+ Installer $installer) {
$this->log = $log;
$this->config = $config;
$this->checker = $checker;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
-use OCP\User\Events\BeforeUserDeletedEvent;
use OCP\Files\NotFoundException;
use OCP\IAvatarManager;
+use OCP\User\Events\BeforeUserDeletedEvent;
use Psr\Log\LoggerInterface;
/**
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
-use OCP\User\Events\UserChangedEvent;
use OCP\Files\NotFoundException;
use OCP\IAvatarManager;
+use OCP\User\Events\UserChangedEvent;
/**
* @template-implements IEventListener<UserChangedEvent>
use OCP\L10N\IFactory;
use OCP\Server;
use OCP\Support\Subscription\IAssertion;
-use OCP\User\Backend\IGetRealUIDBackend;
-use OCP\User\Backend\ISearchKnownUsersBackend;
use OCP\User\Backend\ICheckPasswordBackend;
use OCP\User\Backend\ICountUsersBackend;
+use OCP\User\Backend\IGetRealUIDBackend;
use OCP\User\Backend\IProvideEnabledStateBackend;
+use OCP\User\Backend\ISearchKnownUsersBackend;
use OCP\User\Events\BeforeUserCreatedEvent;
use OCP\User\Events\UserCreatedEvent;
use OCP\UserInterface;
private DisplayNameCache $displayNameCache;
public function __construct(IConfig $config,
- ICacheFactory $cacheFactory,
- IEventDispatcher $eventDispatcher) {
+ ICacheFactory $cacheFactory,
+ IEventDispatcher $eventDispatcher) {
$this->config = $config;
$this->cache = new WithLocalCache($cacheFactory->createDistributed('user_backend_map'));
$cachedUsers = &$this->cachedUsers;
private $dispatcher;
public function __construct(Manager $manager,
- ISession $session,
- ITimeFactory $timeFactory,
- ?IProvider $tokenProvider,
- IConfig $config,
- ISecureRandom $random,
- ILockdownManager $lockdownManager,
- LoggerInterface $logger,
- IEventDispatcher $dispatcher
+ ISession $session,
+ ITimeFactory $timeFactory,
+ ?IProvider $tokenProvider,
+ IConfig $config,
+ ISecureRandom $random,
+ ILockdownManager $lockdownManager,
+ LoggerInterface $logger,
+ IEventDispatcher $dispatcher
) {
$this->manager = $manager;
$this->session = $session;
* @return boolean
*/
public function logClientIn($user,
- $password,
- IRequest $request,
- IThrottler $throttler) {
+ $password,
+ IRequest $request,
+ IThrottler $throttler) {
$remoteAddress = $request->getRemoteAddress();
$currentDelay = $throttler->sleepDelayOrThrowOnMax($remoteAddress, 'login');
* @return boolean if the login was successful
*/
public function tryBasicAuthLogin(IRequest $request,
- IThrottler $throttler) {
+ IThrottler $throttler) {
if (!empty($request->server['PHP_AUTH_USER']) && !empty($request->server['PHP_AUTH_PW'])) {
try {
if ($this->logClientIn($request->server['PHP_AUTH_USER'], $request->server['PHP_AUTH_PW'], $request, $throttler)) {
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserBackend;
+use OCP\User\Backend\IGetHomeBackend;
+use OCP\User\Backend\IProvideAvatarBackend;
+use OCP\User\Backend\IProvideEnabledStateBackend;
+use OCP\User\Backend\ISetDisplayNameBackend;
+use OCP\User\Backend\ISetPasswordBackend;
use OCP\User\Events\BeforePasswordUpdatedEvent;
use OCP\User\Events\BeforeUserDeletedEvent;
use OCP\User\Events\PasswordUpdatedEvent;
use OCP\User\Events\UserChangedEvent;
use OCP\User\Events\UserDeletedEvent;
use OCP\User\GetQuotaEvent;
-use OCP\User\Backend\ISetDisplayNameBackend;
-use OCP\User\Backend\ISetPasswordBackend;
-use OCP\User\Backend\IProvideAvatarBackend;
-use OCP\User\Backend\IProvideEnabledStateBackend;
-use OCP\User\Backend\IGetHomeBackend;
use OCP\UserInterface;
use function json_decode;
use function json_encode;
* @param LoggerInterface $logger
*/
public function __construct(IServerContainer $container,
- LoggerInterface $logger) {
+ LoggerInterface $logger) {
$this->container = $container;
$this->logger = $logger;
}
*
*/
-use OCP\App\Events\AppUpdateEvent;
-use OCP\App\IAppManager;
-use OCP\App\ManagerEvent;
-use OCP\Authentication\IAlternativeLogin;
-use OCP\EventDispatcher\IEventDispatcher;
-use OC\AppFramework\Bootstrap\Coordinator;
use OC\App\DependencyAnalyzer;
use OC\App\Platform;
+use OC\AppFramework\Bootstrap\Coordinator;
use OC\DB\MigrationService;
use OC\Installer;
use OC\Repair;
use OC\Repair\Events\RepairErrorEvent;
+use OCP\App\Events\AppUpdateEvent;
+use OCP\App\IAppManager;
+use OCP\App\ManagerEvent;
+use OCP\Authentication\IAlternativeLogin;
+use OCP\EventDispatcher\IEventDispatcher;
use Psr\Container\ContainerExceptionInterface;
use Psr\Log\LoggerInterface;
* This function set an app as enabled in appconfig.
*/
public function enable(string $appId,
- array $groups = []) {
+ array $groups = []) {
// Check if app is already downloaded
/** @var Installer $installer */
$installer = \OCP\Server::get(Installer::class);
use bantu\IniGetWrapper\IniGetWrapper;
use OC\Files\View;
use OC\Streamer;
-use OCP\Lock\ILockingProvider;
-use OCP\Files\Events\BeforeZipCreatedEvent;
-use OCP\Files\Events\BeforeDirectFileDownloadEvent;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Events\BeforeDirectFileDownloadEvent;
+use OCP\Files\Events\BeforeZipCreatedEvent;
+use OCP\Lock\ILockingProvider;
/**
* Class for file server access
use bantu\IniGetWrapper\IniGetWrapper;
use OC\Files\Filesystem;
use OCP\Files\Mount\IMountPoint;
-use OCP\ICacheFactory;
use OCP\IBinaryFinder;
+use OCP\ICacheFactory;
use OCP\IUser;
use OCP\Util;
use Psr\Log\LoggerInterface;
* @since 7.0.0
*/
public function __construct($appName,
- IRequest $request,
- $corsMethods = 'PUT, POST, GET, DELETE, PATCH',
- $corsAllowedHeaders = 'Authorization, Content-Type, Accept',
- $corsMaxAge = 1728000) {
+ IRequest $request,
+ $corsMethods = 'PUT, POST, GET, DELETE, PATCH',
+ $corsAllowedHeaders = 'Authorization, Content-Type, Accept',
+ $corsMaxAge = 1728000) {
parent::__construct($appName, $request);
$this->corsMethods = $corsMethods;
$this->corsAllowedHeaders = $corsAllowedHeaders;
* @since 14.0.0
*/
public function __construct(string $appName,
- IRequest $request,
- ISession $session,
- IURLGenerator $urlGenerator) {
+ IRequest $request,
+ ISession $session,
+ IURLGenerator $urlGenerator) {
parent::__construct($appName, $request, $session);
$this->urlGenerator = $urlGenerator;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Template\ICustomTemplateProvider;
use OCP\IContainer;
-use OCP\TextProcessing\IProvider as ITextProcessingProvider;
-use OCP\TextToImage\IProvider as ITextToImageProvider;
use OCP\Notification\INotifier;
use OCP\Preview\IProviderV2;
use OCP\SpeechToText\ISpeechToTextProvider;
+use OCP\TextProcessing\IProvider as ITextProcessingProvider;
+use OCP\TextToImage\IProvider as ITextToImageProvider;
use OCP\Translation\ITranslationProvider;
/**
* @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0
*/
public function __construct($appName,
- IRequest $request) {
+ IRequest $request) {
$this->appName = $appName;
$this->request = $request;
*/
namespace OCP\AppFramework\Http;
-use OCP\Template;
use OCP\AppFramework\Http;
+use OCP\Template;
/**
* A generic 429 response showing an 404 error page as well to the end-user
* @since 8.1.0
*/
public function __construct($appName,
- IRequest $request,
- $corsMethods = 'PUT, POST, GET, DELETE, PATCH',
- $corsAllowedHeaders = 'Authorization, Content-Type, Accept, OCS-APIRequest',
- $corsMaxAge = 1728000) {
+ IRequest $request,
+ $corsMethods = 'PUT, POST, GET, DELETE, PATCH',
+ $corsAllowedHeaders = 'Authorization, Content-Type, Accept, OCS-APIRequest',
+ $corsMaxAge = 1728000) {
parent::__construct($appName, $request, $corsMethods,
$corsAllowedHeaders, $corsMaxAge);
$this->registerResponder('json', function ($data) {
* @since 14.0.0
*/
public function __construct(string $appName,
- IRequest $request,
- ISession $session) {
+ IRequest $request,
+ ISession $session) {
parent::__construct($appName, $request);
$this->session = $session;
* @since 9.0.0
*/
public function getForObject(
- $objectType,
- $objectId,
- $limit = 0,
- $offset = 0,
- \DateTime $notOlderThan = null
+ $objectType,
+ $objectId,
+ $limit = 0,
+ $offset = 0,
+ \DateTime $notOlderThan = null
);
/**
* @since 22.0.0
*/
public function __construct(string $title = '',
- string $subtitle = '',
- string $link = '',
- string $iconUrl = '',
- string $sinceId = '',
- string $overlayIconUrl = '') {
+ string $subtitle = '',
+ string $link = '',
+ string $iconUrl = '',
+ string $sinceId = '',
+ string $overlayIconUrl = '') {
$this->title = $title;
$this->subtitle = $subtitle;
$this->iconUrl = $iconUrl;
* @since 18.0.0
*/
public function __construct(IStorage $storage,
- string $path) {
+ string $path) {
parent::__construct();
$this->storage = $storage;
$this->path = $path;
* @since 18.0.0
*/
public function __construct(IStorage $storage,
- string $path) {
+ string $path) {
parent::__construct();
$this->storage = $storage;
$this->path = $path;
* @since 18.0.0
*/
public function __construct(IStorage $storage,
- string $path) {
+ string $path) {
parent::__construct();
$this->storage = $storage;
$this->path = $path;
namespace OCP\Files;
-use OCP\Lock\LockedException;
use OCP\Files\Storage\IStorage;
+use OCP\Lock\LockedException;
/**
* Interface Node
* @since 21.0.0
*/
public function addLink(string $rel,
- ?string $type,
- ?string $href,
- ?array $titles = [],
- ?array $properties = []): self {
+ ?string $type,
+ ?string $href,
+ ?array $titles = [],
+ ?array $properties = []): self {
$this->links[] = array_filter([
'rel' => $rel,
'type' => $type,
* @since 22.0.0
*/
public function __construct(string $logMessage,
- array $parameters = [],
- bool $obfuscateParameters = false) {
+ array $parameters = [],
+ bool $obfuscateParameters = false) {
parent::__construct();
$this->logMessage = $logMessage;
$this->parameters = $parameters;
* @since 20.0.0
*/
private function __construct(string $name,
- bool $isPaginated,
- array $entries,
- $cursor = null) {
+ bool $isPaginated,
+ array $entries,
+ $cursor = null) {
$this->name = $name;
$this->isPaginated = $isPaginated;
$this->entries = $entries;
* @since 20.0.0
*/
public static function paginated(string $name,
- array $entries,
- $cursor): self {
+ array $entries,
+ $cursor): self {
return new self(
$name,
true,
* @since 20.0.0
*/
public function __construct(string $thumbnailUrl,
- string $title,
- string $subline,
- string $resourceUrl,
- string $icon = '',
- bool $rounded = false) {
+ string $title,
+ string $subline,
+ string $resourceUrl,
+ string $icon = '',
+ bool $rounded = false) {
$this->thumbnailUrl = $thumbnailUrl;
$this->title = $title;
$this->subline = $subline;
* @since 8.0.0
*/
public function generate(int $length,
- string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string;
+ string $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'): string;
}
*
*/
public function registerAnonRequest(string $identifier,
- int $anonLimit,
- int $anonPeriod,
- string $ip): void;
+ int $anonLimit,
+ int $anonPeriod,
+ string $ip): void;
/**
* Registers attempt for an authenticated request
*
*/
public function registerUserRequest(string $identifier,
- int $userLimit,
- int $userPeriod,
- IUser $user): void;
+ int $userLimit,
+ int $userPeriod,
+ IUser $user): void;
}
* * defacto $parameters and $format is always the default and therefore is removed in the subsequent call
*/
public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
- $parameters = null, $includeCollections = false) {
+ $parameters = null, $includeCollections = false) {
return \OC\Share\Share::getItemShared($itemType, $itemSource, self::FORMAT_NONE, null, $includeCollections);
}
* @since 19.0.0
*/
public function __construct(IShare $share,
- View $view,
- string $parent) {
+ View $view,
+ string $parent) {
parent::__construct();
$this->share = $share;
* @return IShare The share object
* @since 17.0.0
*/
-// public function acceptShare(IShare $share, string $recipient): IShare;
+ // public function acceptShare(IShare $share, string $recipient): IShare;
/**
* Delete a share
* @since 24.0.0
*/
public function createConversation(string $name,
- array $moderators,
- IConversationOptions $options = null): IConversation;
+ array $moderators,
+ IConversationOptions $options = null): IConversation;
/**
* Delete a conversation by id
* @since 24.0.0
*/
public function createConversation(string $name,
- array $moderators,
- IConversationOptions $options): IConversation;
+ array $moderators,
+ IConversationOptions $options): IConversation;
/**
* Delete a conversation by id
* @since 18.0.0
*/
public function __construct(IUser $user,
- string $password,
- string $recoveryPassword = null) {
+ string $password,
+ string $recoveryPassword = null) {
parent::__construct();
$this->user = $user;
$this->password = $password;
* @since 18.0.0
*/
public function __construct(string $uid,
- string $password) {
+ string $password) {
parent::__construct();
$this->uid = $uid;
$this->password = $password;
* @since 18.0.0
*/
public function __construct(IUser $user,
- string $password,
- string $recoveryPassword = null) {
+ string $password,
+ string $recoveryPassword = null) {
parent::__construct();
$this->user = $user;
$this->password = $password;
* @since 18.0.0
*/
public function __construct(IUser $user,
- string $feature,
- $value,
- $oldValue = null) {
+ string $feature,
+ $value,
+ $oldValue = null) {
parent::__construct();
$this->user = $user;
$this->feature = $feature;
* @since 18.0.0
*/
public function __construct(IUser $user,
- string $password) {
+ string $password) {
parent::__construct();
$this->user = $user;
$this->password = $password;
* @since 20.0.0
*/
public function __construct(IUser $user,
- string $status,
- int $timestamp) {
+ string $status,
+ int $timestamp) {
parent::__construct();
$this->user = $user;
$this->status = $status;
namespace OCP;
+use bantu\IniGetWrapper\IniGetWrapper;
use OC\AppScriptDependency;
use OC\AppScriptSort;
-use bantu\IniGetWrapper\IniGetWrapper;
use OCP\Share\IManager;
use Psr\Container\ContainerExceptionInterface;
exit;
}
-use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
/*
* Try the appframework routes
require_once __DIR__ . '/lib/versioncheck.php';
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
+use Psr\Log\LoggerInterface;
use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\Server;
-use Psr\Log\LoggerInterface;
/**
* Class RemoteException
use OCP\IConfig;
use OCP\Lock\ILockingProvider;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
-use Psr\Log\LoggerInterface;
class RepairTest extends TestCase {
/** @var IConfig|MockObject */
*/
namespace Tests\Core\Command\User\AuthTokens;
-use OC\Core\Command\User\AuthTokens\Delete;
use OC\Authentication\Token\IProvider;
+use OC\Core\Command\User\AuthTokens\Delete;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
* @dataProvider passwordResetDataProvider
*/
public function testShowLoginFormWithPasswordResetOption($canChangePassword,
- $expectedResult) {
+ $expectedResult) {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
use OC\Authentication\Token\IToken;
use OC\Core\Data\LoginFlowV2Credentials;
use OC\Core\Data\LoginFlowV2Tokens;
-use OC\Core\Db\LoginFlowV2Mapper;
use OC\Core\Db\LoginFlowV2;
+use OC\Core\Db\LoginFlowV2Mapper;
use OC\Core\Exception\LoginFlowV2NotFoundException;
use OC\Core\Service\LoginFlowV2Service;
use OCP\AppFramework\Db\DoesNotExistException;
* @param Version $expected
*/
public function testGetVersion($input,
- Version $expected) {
+ Version $expected) {
$this->assertEquals($expected, $this->versionParser->getVersion($input));
}
use OC;
use OC\App\InfoParser;
-use Test\TestCase;
use OCP\Cache\CappedMemoryCache;
+use Test\TestCase;
class InfoParserTest extends TestCase {
/** @var OCP\Cache\CappedMemoryCache */
namespace Test\AppFramework\Controller;
+use OC\AppFramework\DependencyInjection\DIContainer;
use OC\AppFramework\Http\Request;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\IConfig;
use OCP\IRequest;
use OCP\IRequestId;
-use OC\AppFramework\DependencyInjection\DIContainer;
class ChildController extends Controller {
public function __construct($appName, $request) {
use OCP\Diagnostics\IEventLogger;
use OCP\IConfig;
use OCP\IRequest;
+use OCP\IRequestId;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
-use OCP\IRequestId;
class TestController extends Controller {
/**
namespace Test\AppFramework\Middleware;
+use OC\AppFramework\DependencyInjection\DIContainer;
use OC\AppFramework\Http\Request;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Middleware;
use OCP\IConfig;
use OCP\IRequestId;
-use OC\AppFramework\DependencyInjection\DIContainer;
class ChildMiddleware extends Middleware {
};
* @param string $postfix
*/
private function assertSimpleOCSRoute($routes,
- $name,
- $verb,
- $url,
- $controllerName,
- $actionName,
- array $requirements = [],
- array $defaults = [],
- $postfix = '') {
+ $name,
+ $verb,
+ $url,
+ $controllerName,
+ $actionName,
+ array $requirements = [],
+ array $defaults = [],
+ $postfix = '') {
if ($postfix) {
$name .= $postfix;
}
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
-use function reset;
use Test\TestCase;
+use function reset;
class ManagerTest extends TestCase {
/** @var IUser|MockObject */
use OC\Avatar\UserAvatar;
use OC\KnownUser\KnownUserService;
use OC\User\Manager;
+use OC\User\User;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\Accounts\IAccountProperty;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IUser;
-use OC\User\User;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
-use OCP\Share\IShare;
use OCP\Mail\IMailer;
+use OCP\Share\IShare;
use Test\TestCase;
class MailPluginTest extends TestCase {
namespace Test\Collaboration\Collaborators;
+use OC\Collaboration\Collaborators\SearchResult;
+use OC\Collaboration\Collaborators\UserPlugin;
+use OC\KnownUser\KnownUserService;
use OCP\Collaboration\Collaborators\ISearchResult;
use OCP\IConfig;
use OCP\IGroup;
use OCP\IUserSession;
use OCP\Share\IShare;
use OCP\UserStatus\IManager as IUserStatusManager;
-use OC\Collaboration\Collaborators\SearchResult;
-use OC\Collaboration\Collaborators\UserPlugin;
-use OC\KnownUser\KnownUserService;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
namespace Test\Diagnostics;
-use Psr\Log\LoggerInterface;
use OC\Diagnostics\EventLogger;
use OC\Log;
use OC\SystemConfig;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
class EventLoggerTest extends TestCase {
$this->assertEquals('ID1', $this->manager->getDefaultEncryptionModuleId());
}
-// /**
-// * @expectedException \OC\Encryption\Exceptions\ModuleAlreadyExistsException
-// * @expectedExceptionMessage Id "0" already used by encryption module "TestDummyModule0"
-// */
-// public function testModuleRegistration() {
-// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
-// $em = $this->createMock(IEncryptionModule::class);
-// $em->expects($this->any())->method('getId')->willReturn(0);
-// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
-// $m = new Manager($config);
-// $m->registerEncryptionModule($em);
-// $this->assertTrue($m->isEnabled());
-// $m->registerEncryptionModule($em);
-// }
-//
-// public function testModuleUnRegistration() {
-// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
-// $em = $this->createMock(IEncryptionModule::class);
-// $em->expects($this->any())->method('getId')->willReturn(0);
-// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
-// $m = new Manager($config);
-// $m->registerEncryptionModule($em);
-// $this->assertTrue($m->isEnabled());
-// $m->unregisterEncryptionModule($em);
-// $this->assertFalse($m->isEnabled());
-// }
-//
-// /**
-// * @expectedException \OC\Encryption\Exceptions\ModuleDoesNotExistsException
-// * @expectedExceptionMessage Module with ID: unknown does not exist.
-// */
-// public function testGetEncryptionModuleUnknown() {
-// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
-// $em = $this->createMock(IEncryptionModule::class);
-// $em->expects($this->any())->method('getId')->willReturn(0);
-// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
-// $m = new Manager($config);
-// $m->registerEncryptionModule($em);
-// $this->assertTrue($m->isEnabled());
-// $m->getEncryptionModule('unknown');
-// }
-//
-// public function testGetEncryptionModule() {
-// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
-// $em = $this->createMock(IEncryptionModule::class);
-// $em->expects($this->any())->method('getId')->willReturn(0);
-// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
-// $m = new Manager($config);
-// $m->registerEncryptionModule($em);
-// $this->assertTrue($m->isEnabled());
-// $en0 = $m->getEncryptionModule(0);
-// $this->assertEquals(0, $en0->getId());
-// }
+ // /**
+ // * @expectedException \OC\Encryption\Exceptions\ModuleAlreadyExistsException
+ // * @expectedExceptionMessage Id "0" already used by encryption module "TestDummyModule0"
+ // */
+ // public function testModuleRegistration() {
+ // $config = $this->createMock(IConfig::class);
+ // $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
+ // $em = $this->createMock(IEncryptionModule::class);
+ // $em->expects($this->any())->method('getId')->willReturn(0);
+ // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
+ // $m = new Manager($config);
+ // $m->registerEncryptionModule($em);
+ // $this->assertTrue($m->isEnabled());
+ // $m->registerEncryptionModule($em);
+ // }
+ //
+ // public function testModuleUnRegistration() {
+ // $config = $this->createMock(IConfig::class);
+ // $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
+ // $em = $this->createMock(IEncryptionModule::class);
+ // $em->expects($this->any())->method('getId')->willReturn(0);
+ // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
+ // $m = new Manager($config);
+ // $m->registerEncryptionModule($em);
+ // $this->assertTrue($m->isEnabled());
+ // $m->unregisterEncryptionModule($em);
+ // $this->assertFalse($m->isEnabled());
+ // }
+ //
+ // /**
+ // * @expectedException \OC\Encryption\Exceptions\ModuleDoesNotExistsException
+ // * @expectedExceptionMessage Module with ID: unknown does not exist.
+ // */
+ // public function testGetEncryptionModuleUnknown() {
+ // $config = $this->createMock(IConfig::class);
+ // $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
+ // $em = $this->createMock(IEncryptionModule::class);
+ // $em->expects($this->any())->method('getId')->willReturn(0);
+ // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
+ // $m = new Manager($config);
+ // $m->registerEncryptionModule($em);
+ // $this->assertTrue($m->isEnabled());
+ // $m->getEncryptionModule('unknown');
+ // }
+ //
+ // public function testGetEncryptionModule() {
+ // $config = $this->createMock(IConfig::class);
+ // $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
+ // $em = $this->createMock(IEncryptionModule::class);
+ // $em->expects($this->any())->method('getId')->willReturn(0);
+ // $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
+ // $m = new Manager($config);
+ // $m->registerEncryptionModule($em);
+ // $this->assertTrue($m->isEnabled());
+ // $en0 = $m->getEncryptionModule(0);
+ // $this->assertEquals(0, $en0->getId());
+ // }
protected function addNewEncryptionModule(Manager $manager, $id) {
$encryptionModule = $this->createMock(IEncryptionModule::class);
namespace Test\Encryption;
+use OC\Encryption\File;
use OC\Encryption\Update;
use OC\Encryption\Util;
use OC\Files\Mount\Manager;
use OC\Files\View;
+use OCP\Encryption\IEncryptionModule;
use Psr\Log\LoggerInterface;
use Test\TestCase;
-use OC\Encryption\File;
-use OCP\Encryption\IEncryptionModule;
class UpdateTest extends TestCase {
/** @var \OC\Encryption\Update */
$this->assertIsString($cachedData['etag']);
$this->assertNotSame($oldEtag, $cachedData['etag']);
// rename can cause mtime change - invalid assert
-// $this->assertEquals($mtime, $cachedData['mtime']);
+ // $this->assertEquals($mtime, $cachedData['mtime']);
$cachedData = $view->getFileInfo('folder');
$this->assertIsString($folderCachedData['etag']);
$this->assertIsString($cachedData['etag']);
$this->assertNotSame($oldEtag, $cachedData['etag']);
// rename can cause mtime change - invalid assert
-// $this->assertEquals($mtime, $cachedData['mtime']);
+ // $this->assertEquals($mtime, $cachedData['mtime']);
}
public function testTouch() {
use OC\DB\QueryBuilder\Literal;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Storage;
-use OCP\Cache\CappedMemoryCache;
use OC\User\Manager;
+use OCP\Cache\CappedMemoryCache;
use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\ICachedMountInfo;
namespace Test\Files;
use OC\Files\Filesystem;
-use OCP\EventDispatcher\IEventDispatcher;
use OCA\Files_Sharing\AppInfo\Application;
+use OCP\EventDispatcher\IEventDispatcher;
use Psr\Log\LoggerInterface;
/**
$rootView->mkdir('/' . $user);
$rootView->mkdir('/' . $user . '/files');
-// \OC\Files\Filesystem::file_put_contents('/foo', 'foo');
+ // \OC\Files\Filesystem::file_put_contents('/foo', 'foo');
\OC\Files\Filesystem::mkdir('/bar');
-// \OC\Files\Filesystem::file_put_contents('/bar//foo', 'foo');
+ // \OC\Files\Filesystem::file_put_contents('/bar//foo', 'foo');
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
file_put_contents($tmpFile, 'foo');
$fh = fopen($tmpFile, 'r');
-// \OC\Files\Filesystem::file_put_contents('/bar//foo', $fh);
+ // \OC\Files\Filesystem::file_put_contents('/bar//foo', $fh);
}
/**
namespace Test\Files\Node;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\FileInfo;
use OC\Files\Mount\Manager;
use OC\Files\Node\Folder;
use OC\Files\View;
+use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUser;
use OCP\IUserManager;
* @param boolean $renameKeysReturn
*/
public function testRename($source,
- $target,
- $encryptionEnabled,
- $renameKeysReturn) {
+ $target,
+ $encryptionEnabled,
+ $renameKeysReturn) {
if ($encryptionEnabled) {
$this->keyStore
->expects($this->once())
->method('isEnabled')
->willReturn($encryptionEnabled);
// FIXME can not overwrite the return after definition
-// $this->mount->expects($this->at(0))
-// ->method('getOption')
-// ->with('encrypt', true)
-// ->willReturn($mountPointEncryptionEnabled);
+ // $this->mount->expects($this->at(0))
+ // ->method('getOption')
+ // ->with('encrypt', true)
+ // ->willReturn($mountPointEncryptionEnabled);
global $mockedMountPointEncryptionEnabled;
$mockedMountPointEncryptionEnabled = $mountPointEncryptionEnabled;
* @dataProvider dataProviderStreamOpen()
*/
public function testStreamOpen($isMasterKeyUsed,
- $mode,
- $fullPath,
- $fileExists,
- $expectedSharePath,
- $expectedSize,
- $expectedUnencryptedSize,
- $expectedReadOnly) {
+ $mode,
+ $fullPath,
+ $fileExists,
+ $expectedSharePath,
+ $expectedSize,
+ $expectedUnencryptedSize,
+ $expectedReadOnly) {
// build mocks
$encryptionModuleMock = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule')
->disableOriginalConstructor()->getMock();
namespace Test\Files;
-use OC\Share20\ShareDisableChecker;
-use OCP\Cache\CappedMemoryCache;
use OC\Files\Cache\Watcher;
use OC\Files\Filesystem;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Storage;
use OC\Files\Storage\Temporary;
use OC\Files\View;
+use OC\Share20\ShareDisableChecker;
+use OCP\Cache\CappedMemoryCache;
use OCP\Constants;
use OCP\Files\Config\IMountProvider;
use OCP\Files\FileInfo;
namespace Test\Group;
use OC\Group\Database;
-use OC\User\User;
use OC\User\Manager;
+use OC\User\User;
use OCP\EventDispatcher\IEventDispatcher;
-use OCP\GroupInterface;
use OCP\Group\Backend\ISearchableGroupBackend;
+use OCP\GroupInterface;
use OCP\ICacheFactory;
use OCP\IUser;
use PHPUnit\Framework\MockObject\MockObject;
namespace Test;
+use JsonSerializable;
use OC\AppFramework\Bootstrap\Coordinator;
+use OC\InitialStateService;
use OCP\IServerContainer;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
-use function json_encode;
-use JsonSerializable;
-use OC\InitialStateService;
use stdClass;
+use function json_encode;
class InitialStateServiceTest extends TestCase {
/** @var InitialStateService */
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
use OCP\Mail\Events\BeforeMessageSent;
-use Psr\Log\LoggerInterface;
-use Test\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Mailer as SymfonyMailer;
-use Symfony\Component\Mime\Email;
-use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
use Symfony\Component\Mailer\Transport\SendmailTransport;
+use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
+use Symfony\Component\Mime\Email;
+use Test\TestCase;
class MailerTest extends TestCase {
/** @var IConfig|MockObject */
use OC\Mail\Message;
use OCP\Mail\Headers\AutoSubmitted;
use OCP\Mail\IEMailTemplate;
+use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\Exception\RfcComplianceException;
use Symfony\Component\Mime\Header\HeaderInterface;
use Symfony\Component\Mime\Header\Headers;
use Test\TestCase;
-use PHPUnit\Framework\MockObject\MockObject;
class MessageTest extends TestCase {
/** @var Email */
namespace Test\Memcache;
use OC\Memcache\NullCache;
-use Psr\Log\LoggerInterface;
use OCP\Profiler\IProfiler;
+use Psr\Log\LoggerInterface;
class Test_Factory_Available_Cache1 extends NullCache {
public function __construct($prefix = '') {
namespace Test\Migration;
-use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Migration\IOutput;
-use OCP\Migration\IRepairStep;
use OC\BackgroundJob\JobList;
use OC\Migration\BackgroundRepair;
use OC\NeedsUpdateException;
use OC\Repair\Events\RepairStepEvent;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Migration\IOutput;
+use OCP\Migration\IRepairStep;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
+use OCP\Migration\IOutput;
use Psr\Log\LoggerInterface;
use Test\TestCase;
-use OCP\Migration\IOutput;
use function in_array;
class RepairDavSharesTest extends TestCase {
namespace Test;
-use OCP\EventDispatcher\IEventDispatcher;
-use OCP\Migration\IRepairStep;
use OC\Repair;
+use OC\Repair\Events\RepairErrorEvent;
use OC\Repair\Events\RepairInfoEvent;
use OC\Repair\Events\RepairStepEvent;
use OC\Repair\Events\RepairWarningEvent;
-use OC\Repair\Events\RepairErrorEvent;
+use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Migration\IRepairStep;
use Psr\Log\LoggerInterface;
class TestRepairStep implements IRepairStep {
* @param bool $enabled
*/
private function isIpWhiteListedHelper($ip,
- $whitelists,
- $isWhiteListed,
- $enabled) {
+ $whitelists,
+ $isWhiteListed,
+ $enabled) {
$this->config->method('getAppKeys')
->with($this->equalTo('bruteForce'))
->willReturn(array_keys($whitelists));
* @param bool $isWhiteListed
*/
public function testIsIpWhiteListedWithEnabledProtection($ip,
- $whitelists,
- $isWhiteListed) {
+ $whitelists,
+ $isWhiteListed) {
$this->isIpWhiteListedHelper(
$ip,
$whitelists,
* @param bool $isWhiteListed
*/
public function testIsIpWhiteListedWithDisabledProtection($ip,
- $whitelists,
- $isWhiteListed) {
+ $whitelists,
+ $isWhiteListed) {
$this->isIpWhiteListedHelper(
$ip,
$whitelists,
* @param bool $expected
*/
public function testNeedRebundling($CaBundleMtime,
- $targetBundleMtime,
- $targetBundleExists,
- $expected
+ $targetBundleMtime,
+ $targetBundleExists,
+ $expected
) {
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
use OCP\Security\VerificationToken\InvalidTokenException;
-use Test\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
+use Test\TestCase;
class VerificationTokenTest extends TestCase {
/** @var VerificationToken */
use OCP\L10N\IFactory;
use OCP\Settings\ISettings;
use OCP\Settings\ISubAdminSettings;
+use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
-use PHPUnit\Framework\MockObject\MockObject;
class ManagerTest extends TestCase {
/** @var Manager|MockObject */
* @return int
*/
private function addShareToDB($shareType, $sharedWith, $sharedBy, $shareOwner,
- $itemType, $fileSource, $fileTarget, $permissions, $token, $expiration,
- $parent = null) {
+ $itemType, $fileSource, $fileTarget, $permissions, $token, $expiration,
+ $parent = null) {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share');
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
use OCP\IServerContainer;
+use OCP\PreConditionNotMetException;
use OCP\TextProcessing\Events\TaskFailedEvent;
use OCP\TextProcessing\Events\TaskSuccessfulEvent;
use OCP\TextProcessing\FreePromptTaskType;
use OCP\TextProcessing\IManager;
use OCP\TextProcessing\IProvider;
use OCP\TextProcessing\SummaryTaskType;
-use OCP\PreConditionNotMetException;
use OCP\TextProcessing\Task;
use OCP\TextProcessing\TopicsTaskType;
use PHPUnit\Framework\Constraint\IsInstanceOf;
namespace Test\Updater;
+use OC\Updater\Changes;
use OC\Updater\ChangesCheck;
use OC\Updater\ChangesMapper;
-use OC\Updater\Changes;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
-use Test\TestCase;
use Psr\Log\LoggerInterface;
+use Test\TestCase;
class ChangesCheckTest extends TestCase {
/** @var IClientService|\PHPUnit\Framework\MockObject\MockObject */
namespace Test;
-use PHPUnit\Framework\MockObject\MockObject;
-use Psr\Log\LoggerInterface;
use OC\Installer;
use OC\IntegrityCheck\Checker;
use OC\Updater;
use OCP\IConfig;
+use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
class UpdaterTest extends TestCase {
/** @var IConfig|MockObject */
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
+use OC\Security\CSRF\CsrfTokenManager;
use OC\Session\Memory;
use OC\User\LoginException;
use OC\User\Manager;
use OCP\User\Events\PostLoginEvent;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
-use OC\Security\CSRF\CsrfTokenManager;
/**
* @group DB
namespace Test\Util\Group;
-use Test\Util\User\Dummy as DummyUser;
use OCP\Group\Backend\ABackend;
-use OCP\Group\Backend\IDeleteGroupBackend;
use OCP\Group\Backend\IAddToGroupBackend;
-use OCP\Group\Backend\IRemoveFromGroupBackend;
-use OCP\Group\Backend\ICreateGroupBackend;
use OCP\Group\Backend\ICountUsersBackend;
+use OCP\Group\Backend\ICreateGroupBackend;
+use OCP\Group\Backend\IDeleteGroupBackend;
+use OCP\Group\Backend\IRemoveFromGroupBackend;
+use Test\Util\User\Dummy as DummyUser;
/**
* Dummy group backend, does not keep state, only for testing use