Merge pull request #20375 from nextcloud/techdebt/fix-array-indent-style
Fix (array) indent style to always use one tab
This commit is contained in:
commit
813bdc1ce8
|
@ -27,13 +27,13 @@ return [
|
|||
'routes' => [
|
||||
['name' => 'accessibility#getCss', 'url' => '/css/user-{md5}', 'verb' => 'GET'],
|
||||
['name' => 'accessibility#getJavascript', 'url' => '/js/accessibility', 'verb' => 'GET'],
|
||||
],
|
||||
'ocs' => [
|
||||
],
|
||||
'ocs' => [
|
||||
[
|
||||
'name' => 'Config#getConfig',
|
||||
'url' => '/api/v1/config',
|
||||
'verb' => 'GET',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Config#setConfig',
|
||||
'url' => '/api/v1/config/{key}',
|
||||
|
@ -44,5 +44,5 @@ return [
|
|||
'url' => '/api/v1/config/{key}',
|
||||
'verb' => 'DELETE',
|
||||
],
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
@ -72,12 +72,12 @@ class AccessibilityProvider {
|
|||
|
||||
public function getHighContrast() {
|
||||
return [
|
||||
'id' => 'highcontrast',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'mode-highcontrast.jpg'),
|
||||
'title' => $this->l->t('High contrast mode'),
|
||||
'enableLabel' => $this->l->t('Enable high contrast mode'),
|
||||
'text' => $this->l->t('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.')
|
||||
];
|
||||
'id' => 'highcontrast',
|
||||
'img' => $this->urlGenerator->imagePath($this->appName, 'mode-highcontrast.jpg'),
|
||||
'title' => $this->l->t('High contrast mode'),
|
||||
'enableLabel' => $this->l->t('Enable high contrast mode'),
|
||||
'text' => $this->l->t('A high contrast mode to ease your navigation. Visual quality will be reduced but clarity will be increased.')
|
||||
];
|
||||
}
|
||||
|
||||
public function getFonts() {
|
||||
|
|
|
@ -146,17 +146,17 @@ class Provider implements IProvider {
|
|||
if ($event->getSubject() === 'add_comment_subject') {
|
||||
if ($subjectParameters['actor'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('You commented on %1$s', [
|
||||
$subjectParameters['filePath'],
|
||||
]))
|
||||
$subjectParameters['filePath'],
|
||||
]))
|
||||
->setRichSubject($this->l->t('You commented on {file}'), [
|
||||
'file' => $this->generateFileParameter($subjectParameters['fileId'], $subjectParameters['filePath']),
|
||||
]);
|
||||
} else {
|
||||
$author = $this->generateUserParameter($subjectParameters['actor']);
|
||||
$event->setParsedSubject($this->l->t('%1$s commented on %2$s', [
|
||||
$author['name'],
|
||||
$subjectParameters['filePath'],
|
||||
]))
|
||||
$author['name'],
|
||||
$subjectParameters['filePath'],
|
||||
]))
|
||||
->setRichSubject($this->l->t('{author} commented on {file}'), [
|
||||
'author' => $author,
|
||||
'file' => $this->generateFileParameter($subjectParameters['fileId'], $subjectParameters['filePath']),
|
||||
|
|
|
@ -772,7 +772,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
[
|
||||
'calendarId' => $calendarId,
|
||||
'calendarData' => $this->getCalendarById($calendarId),
|
||||
]));
|
||||
]));
|
||||
|
||||
return $calendarId;
|
||||
}
|
||||
|
@ -833,7 +833,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'calendarData' => $this->getCalendarById($calendarId),
|
||||
'shares' => $this->getShares($calendarId),
|
||||
'propertyMutations' => $mutations,
|
||||
]));
|
||||
]));
|
||||
|
||||
return true;
|
||||
});
|
||||
|
@ -852,7 +852,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
'calendarId' => $calendarId,
|
||||
'calendarData' => $this->getCalendarById($calendarId),
|
||||
'shares' => $this->getShares($calendarId),
|
||||
]));
|
||||
]));
|
||||
|
||||
$stmt = $this->db->prepare('DELETE FROM `*PREFIX*calendarobjects` WHERE `calendarid` = ? AND `calendartype` = ?');
|
||||
$stmt->execute([$calendarId, self::CALENDAR_TYPE_CALENDAR]);
|
||||
|
@ -2095,11 +2095,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
}
|
||||
|
||||
return [
|
||||
'uri' => $row['uri'],
|
||||
'calendardata' => $row['calendardata'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
'uri' => $row['uri'],
|
||||
'calendardata' => $row['calendardata'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2124,11 +2124,11 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
|||
$result = [];
|
||||
foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
|
||||
$result[] = [
|
||||
'calendardata' => $row['calendardata'],
|
||||
'uri' => $row['uri'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
'calendardata' => $row['calendardata'],
|
||||
'uri' => $row['uri'],
|
||||
'lastmodified' => $row['lastmodified'],
|
||||
'etag' => '"' . $row['etag'] . '"',
|
||||
'size' => (int)$row['size'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -191,10 +191,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
|
|||
|
||||
if ($this->getOwner() !== parent::getOwner()) {
|
||||
$acl[] = [
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => parent::getOwner(),
|
||||
'protected' => true,
|
||||
];
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => parent::getOwner(),
|
||||
'protected' => true,
|
||||
];
|
||||
if ($this->canWrite()) {
|
||||
$acl[] = [
|
||||
'privilege' => '{DAV:}write',
|
||||
|
|
|
@ -130,10 +130,10 @@ class AddressBook extends \Sabre\CardDAV\AddressBook implements IShareable {
|
|||
|
||||
if ($this->getOwner() !== parent::getOwner()) {
|
||||
$acl[] = [
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => parent::getOwner(),
|
||||
'protected' => true,
|
||||
];
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => parent::getOwner(),
|
||||
'protected' => true,
|
||||
];
|
||||
if ($this->canWrite()) {
|
||||
$acl[] = [
|
||||
'privilege' => '{DAV:}write',
|
||||
|
|
|
@ -284,7 +284,7 @@ class AddressBookImpl implements IAddressBook {
|
|||
$result[$property->name][] = [
|
||||
'type' => $type,
|
||||
'value' => $property->getValue()
|
||||
];
|
||||
];
|
||||
} else {
|
||||
$result[$property->name][] = $property->getValue();
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
|||
|
||||
/** @var array properties to index */
|
||||
public static $indexProperties = [
|
||||
'BDAY', 'UID', 'N', 'FN', 'TITLE', 'ROLE', 'NOTE', 'NICKNAME',
|
||||
'ORG', 'CATEGORIES', 'EMAIL', 'TEL', 'IMPP', 'ADR', 'URL', 'GEO', 'CLOUD'];
|
||||
'BDAY', 'UID', 'N', 'FN', 'TITLE', 'ROLE', 'NOTE', 'NICKNAME',
|
||||
'ORG', 'CATEGORIES', 'EMAIL', 'TEL', 'IMPP', 'ADR', 'URL', 'GEO', 'CLOUD'];
|
||||
|
||||
/**
|
||||
* @var string[] Map of uid => display name
|
||||
|
|
|
@ -202,7 +202,7 @@ class SyncService {
|
|||
$body = $this->buildSyncCollectionRequestBody($syncToken);
|
||||
|
||||
$response = $client->request('REPORT', $addressBookUrl, $body, [
|
||||
'Content-Type' => 'application/xml'
|
||||
'Content-Type' => 'application/xml'
|
||||
]);
|
||||
|
||||
return $this->parseMultiStatus($response['body']);
|
||||
|
|
|
@ -134,8 +134,8 @@ class FakeLockerPlugin extends ServerPlugin {
|
|||
$lockInfo->timeout = 1800;
|
||||
|
||||
$body = $this->server->xml->write('{DAV:}prop', [
|
||||
'{DAV:}lockdiscovery' =>
|
||||
new LockDiscovery([$lockInfo])
|
||||
'{DAV:}lockdiscovery' =>
|
||||
new LockDiscovery([$lockInfo])
|
||||
]);
|
||||
|
||||
$response->setStatus(200);
|
||||
|
|
|
@ -209,7 +209,7 @@ class FilesPlugin extends ServerPlugin {
|
|||
$sourceNodeFileInfo = $sourceNode->getFileInfo();
|
||||
if ($sourceNodeFileInfo === null) {
|
||||
throw new NotFound($source . ' does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$sourceNodeFileInfo->isDeletable()) {
|
||||
throw new Forbidden($source . " cannot be deleted");
|
||||
|
|
|
@ -446,9 +446,9 @@ class Principal implements BackendInterface {
|
|||
$userId = $user->getUID();
|
||||
$displayName = $user->getDisplayName();
|
||||
$principal = [
|
||||
'uri' => $this->principalPrefix . '/' . $userId,
|
||||
'{DAV:}displayname' => is_null($displayName) ? $userId : $displayName,
|
||||
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
|
||||
'uri' => $this->principalPrefix . '/' . $userId,
|
||||
'{DAV:}displayname' => is_null($displayName) ? $userId : $displayName,
|
||||
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
|
||||
];
|
||||
|
||||
$email = $user->getEMailAddress();
|
||||
|
|
|
@ -129,9 +129,9 @@ class ServerFactory {
|
|||
// Some WebDAV clients do require Class 2 WebDAV support (locking), since
|
||||
// we do not provide locking we emulate it using a fake locking plugin.
|
||||
if($this->request->isUserAgent([
|
||||
'/WebDAVFS/',
|
||||
'/OneNote/',
|
||||
'/Microsoft-WebDAV-MiniRedir/',
|
||||
'/WebDAVFS/',
|
||||
'/OneNote/',
|
||||
'/Microsoft-WebDAV-MiniRedir/',
|
||||
])) {
|
||||
$server->addPlugin(new \OCA\DAV\Connector\Sabre\FakeLockerPlugin());
|
||||
}
|
||||
|
|
|
@ -29,59 +29,59 @@ use Sabre\Xml\XmlDeserializable;
|
|||
|
||||
class ShareRequest implements XmlDeserializable {
|
||||
|
||||
public $set = [];
|
||||
public $set = [];
|
||||
|
||||
public $remove = [];
|
||||
public $remove = [];
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $set
|
||||
* @param array $remove
|
||||
*/
|
||||
function __construct(array $set, array $remove) {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $set
|
||||
* @param array $remove
|
||||
*/
|
||||
function __construct(array $set, array $remove) {
|
||||
|
||||
$this->set = $set;
|
||||
$this->remove = $remove;
|
||||
$this->set = $set;
|
||||
$this->remove = $remove;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
|
||||
$elements = $reader->parseInnerTree([
|
||||
'{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
'{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
]);
|
||||
$elements = $reader->parseInnerTree([
|
||||
'{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
'{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||
]);
|
||||
|
||||
$set = [];
|
||||
$remove = [];
|
||||
$set = [];
|
||||
$remove = [];
|
||||
|
||||
foreach ($elements as $elem) {
|
||||
switch ($elem['name']) {
|
||||
foreach ($elements as $elem) {
|
||||
switch ($elem['name']) {
|
||||
|
||||
case '{' . Plugin::NS_OWNCLOUD . '}set' :
|
||||
$sharee = $elem['value'];
|
||||
case '{' . Plugin::NS_OWNCLOUD . '}set' :
|
||||
$sharee = $elem['value'];
|
||||
|
||||
$sumElem = '{' . Plugin::NS_OWNCLOUD . '}summary';
|
||||
$commonName = '{' . Plugin::NS_OWNCLOUD . '}common-name';
|
||||
$sumElem = '{' . Plugin::NS_OWNCLOUD . '}summary';
|
||||
$commonName = '{' . Plugin::NS_OWNCLOUD . '}common-name';
|
||||
|
||||
$set[] = [
|
||||
'href' => $sharee['{DAV:}href'],
|
||||
'commonName' => isset($sharee[$commonName]) ? $sharee[$commonName] : null,
|
||||
'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null,
|
||||
'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee),
|
||||
];
|
||||
break;
|
||||
$set[] = [
|
||||
'href' => $sharee['{DAV:}href'],
|
||||
'commonName' => isset($sharee[$commonName]) ? $sharee[$commonName] : null,
|
||||
'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null,
|
||||
'readOnly' => !array_key_exists('{' . Plugin::NS_OWNCLOUD . '}read-write', $sharee),
|
||||
];
|
||||
break;
|
||||
|
||||
case '{' . Plugin::NS_OWNCLOUD . '}remove' :
|
||||
$remove[] = $elem['value']['{DAV:}href'];
|
||||
break;
|
||||
case '{' . Plugin::NS_OWNCLOUD . '}remove' :
|
||||
$remove[] = $elem['value']['{DAV:}href'];
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new self($set, $remove);
|
||||
return new self($set, $remove);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -148,30 +148,30 @@ class RootCollection extends SimpleCollection {
|
|||
\OC::$server->query(ITimeFactory::class));
|
||||
|
||||
$children = [
|
||||
new SimpleCollection('principals', [
|
||||
$userPrincipals,
|
||||
$groupPrincipals,
|
||||
$systemPrincipals,
|
||||
$calendarResourcePrincipals,
|
||||
$calendarRoomPrincipals]),
|
||||
$filesCollection,
|
||||
$userCalendarRoot,
|
||||
new SimpleCollection('system-calendars', [
|
||||
$resourceCalendarRoot,
|
||||
$roomCalendarRoot,
|
||||
]),
|
||||
$publicCalendarRoot,
|
||||
new SimpleCollection('addressbooks', [
|
||||
$usersAddressBookRoot,
|
||||
$systemAddressBookRoot]),
|
||||
$systemTagCollection,
|
||||
$systemTagRelationsCollection,
|
||||
$commentsCollection,
|
||||
$uploadCollection,
|
||||
$avatarCollection,
|
||||
new SimpleCollection('provisioning', [
|
||||
$appleProvisioning
|
||||
])
|
||||
new SimpleCollection('principals', [
|
||||
$userPrincipals,
|
||||
$groupPrincipals,
|
||||
$systemPrincipals,
|
||||
$calendarResourcePrincipals,
|
||||
$calendarRoomPrincipals]),
|
||||
$filesCollection,
|
||||
$userCalendarRoot,
|
||||
new SimpleCollection('system-calendars', [
|
||||
$resourceCalendarRoot,
|
||||
$roomCalendarRoot,
|
||||
]),
|
||||
$publicCalendarRoot,
|
||||
new SimpleCollection('addressbooks', [
|
||||
$usersAddressBookRoot,
|
||||
$systemAddressBookRoot]),
|
||||
$systemTagCollection,
|
||||
$systemTagRelationsCollection,
|
||||
$commentsCollection,
|
||||
$uploadCollection,
|
||||
$avatarCollection,
|
||||
new SimpleCollection('provisioning', [
|
||||
$appleProvisioning
|
||||
])
|
||||
];
|
||||
|
||||
parent::__construct('root', $children);
|
||||
|
|
|
@ -548,8 +548,8 @@ EOD;
|
|||
$this->assertEquals($id, $subscriptions[0]['id']);
|
||||
|
||||
$patch = new PropPatch([
|
||||
'{DAV:}displayname' => 'Unit test',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => '#ac0606',
|
||||
'{DAV:}displayname' => 'Unit test',
|
||||
'{http://apple.com/ns/ical/}calendar-color' => '#ac0606',
|
||||
]);
|
||||
$this->backend->updateSubscription($id, $patch);
|
||||
$patch->commit();
|
||||
|
|
|
@ -42,46 +42,46 @@ use OCP\Notification\INotification;
|
|||
|
||||
class PushProviderTest extends AbstractNotificationProviderTest {
|
||||
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $logger;
|
||||
/** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $logger;
|
||||
|
||||
/** @var L10NFactory|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $l10nFactory;
|
||||
/** @var L10NFactory|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $l10nFactory;
|
||||
|
||||
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $l10n;
|
||||
/** @var IL10N|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $l10n;
|
||||
|
||||
/** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $urlGenerator;
|
||||
/** @var IURLGenerator|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $urlGenerator;
|
||||
|
||||
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $config;
|
||||
/** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
|
||||
protected $config;
|
||||
|
||||
/** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $manager;
|
||||
/** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $manager;
|
||||
|
||||
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $timeFactory;
|
||||
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $timeFactory;
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->manager = $this->createMock(IManager::class);
|
||||
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
||||
$this->config = $this->createMock(IConfig::class);
|
||||
$this->manager = $this->createMock(IManager::class);
|
||||
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
||||
|
||||
$this->provider = new PushProvider(
|
||||
$this->config,
|
||||
$this->manager,
|
||||
$this->logger,
|
||||
$this->l10nFactory,
|
||||
$this->urlGenerator,
|
||||
$this->timeFactory
|
||||
);
|
||||
}
|
||||
$this->provider = new PushProvider(
|
||||
$this->config,
|
||||
$this->manager,
|
||||
$this->logger,
|
||||
$this->l10nFactory,
|
||||
$this->urlGenerator,
|
||||
$this->timeFactory
|
||||
);
|
||||
}
|
||||
|
||||
public function testNotificationType():void {
|
||||
$this->assertEquals(PushProvider::NOTIFICATION_TYPE, 'DISPLAY');
|
||||
public function testNotificationType():void {
|
||||
$this->assertEquals(PushProvider::NOTIFICATION_TYPE, 'DISPLAY');
|
||||
}
|
||||
|
||||
public function testNotSend(): void {
|
||||
|
@ -110,19 +110,19 @@ class PushProviderTest extends AbstractNotificationProviderTest {
|
|||
$this->provider->send($this->vcalendar->VEVENT, $this->calendarDisplayName, $users);
|
||||
}
|
||||
|
||||
public function testSend(): void {
|
||||
$this->config->expects($this->once())
|
||||
public function testSend(): void {
|
||||
$this->config->expects($this->once())
|
||||
->method('getAppValue')
|
||||
->with('dav', 'sendEventRemindersPush', 'no')
|
||||
->willReturn('yes');
|
||||
|
||||
$user1 = $this->createMock(IUser::class);
|
||||
$user1->method('getUID')
|
||||
$user1 = $this->createMock(IUser::class);
|
||||
$user1->method('getUID')
|
||||
->willReturn('uid1');
|
||||
$user2 = $this->createMock(IUser::class);
|
||||
$user2 = $this->createMock(IUser::class);
|
||||
$user2->method('getUID')
|
||||
->willReturn('uid2');
|
||||
$user3 = $this->createMock(IUser::class);
|
||||
$user3 = $this->createMock(IUser::class);
|
||||
$user3->method('getUID')
|
||||
->willReturn('uid3');
|
||||
|
||||
|
@ -161,13 +161,13 @@ class PushProviderTest extends AbstractNotificationProviderTest {
|
|||
->with($notification3);
|
||||
|
||||
$this->provider->send($this->vcalendar->VEVENT, $this->calendarDisplayName, $users);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $uid
|
||||
* @param \DateTime $dt
|
||||
*/
|
||||
private function createNotificationMock(string $uid, \DateTime $dt):INotification {
|
||||
private function createNotificationMock(string $uid, \DateTime $dt):INotification {
|
||||
$notification = $this->createMock(INotification::class);
|
||||
$notification
|
||||
->expects($this->once())
|
||||
|
|
|
@ -42,11 +42,11 @@ use Test\TestCase;
|
|||
|
||||
class ReminderServiceTest extends TestCase {
|
||||
|
||||
/** @var Backend|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $backend;
|
||||
/** @var Backend|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $backend;
|
||||
|
||||
/** @var NotificationProviderManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $notificationProviderManager;
|
||||
/** @var NotificationProviderManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $notificationProviderManager;
|
||||
|
||||
/** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
|
||||
private $userManager;
|
||||
|
@ -185,12 +185,12 @@ END:VEVENT
|
|||
END:VCALENDAR
|
||||
EOD;
|
||||
|
||||
protected function setUp(): void {
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
|
||||
$this->backend = $this->createMock(Backend::class);
|
||||
$this->notificationProviderManager = $this->createMock(NotificationProviderManager::class);
|
||||
$this->userManager = $this->createMock(IUserManager::class);
|
||||
$this->backend = $this->createMock(Backend::class);
|
||||
$this->notificationProviderManager = $this->createMock(NotificationProviderManager::class);
|
||||
$this->userManager = $this->createMock(IUserManager::class);
|
||||
$this->groupManager = $this->createMock(IGroupManager::class);
|
||||
$this->caldavBackend = $this->createMock(CalDavBackend::class);
|
||||
$this->timeFactory = $this->createMock(ITimeFactory::class);
|
||||
|
@ -203,14 +203,14 @@ EOD;
|
|||
$this->groupManager,
|
||||
$this->caldavBackend,
|
||||
$this->timeFactory);
|
||||
}
|
||||
}
|
||||
|
||||
public function testOnCalendarObjectDelete():void {
|
||||
$this->backend->expects($this->once())
|
||||
$this->backend->expects($this->once())
|
||||
->method('cleanRemindersForEvent')
|
||||
->with(44);
|
||||
|
||||
$action = '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject';
|
||||
$action = '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject';
|
||||
$objectData = [
|
||||
'id' => '44',
|
||||
'component' => 'vevent',
|
||||
|
@ -221,14 +221,14 @@ EOD;
|
|||
|
||||
public function testOnCalendarObjectCreateSingleEntry():void {
|
||||
$action = '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject';
|
||||
$objectData = [
|
||||
'calendardata' => self::CALENDAR_DATA,
|
||||
$objectData = [
|
||||
'calendardata' => self::CALENDAR_DATA,
|
||||
'id' => '42',
|
||||
'calendarid' => '1337',
|
||||
'component' => 'vevent',
|
||||
];
|
||||
|
||||
$this->backend->expects($this->exactly(2))
|
||||
$this->backend->expects($this->exactly(2))
|
||||
->method('insertReminder')
|
||||
->withConsecutive(
|
||||
[1337, 42, 'wej2z68l9h', false, 1465430400, false, '5c70531aab15c92b52518ae10a2f78a4', 'de919af7429d3b5c11e8b9d289b411a6', 'EMAIL', true, 1465429500, false],
|
||||
|
@ -236,12 +236,12 @@ EOD;
|
|||
)
|
||||
->willReturn(1);
|
||||
|
||||
$this->timeFactory->expects($this->once())
|
||||
$this->timeFactory->expects($this->once())
|
||||
->method('getDateTime')
|
||||
->with()
|
||||
->willReturn(\DateTime::createFromFormat(\DateTime::ATOM, '2016-06-08T00:00:00+00:00'));
|
||||
|
||||
$this->reminderService->onTouchCalendarObject($action, $objectData);
|
||||
$this->reminderService->onTouchCalendarObject($action, $objectData);
|
||||
}
|
||||
|
||||
public function testOnCalendarObjectCreateSingleEntryWithRepeat(): void {
|
||||
|
|
|
@ -157,14 +157,14 @@ class BirthdayServiceTest extends TestCase {
|
|||
$this->cardDav->expects($this->once())->method('getAddressBookById')
|
||||
->with(666)
|
||||
->willReturn([
|
||||
'principaluri' => 'principals/users/user01',
|
||||
'uri' => 'default'
|
||||
]);
|
||||
'principaluri' => 'principals/users/user01',
|
||||
'uri' => 'default'
|
||||
]);
|
||||
$this->calDav->expects($this->once())->method('getCalendarByUri')
|
||||
->with('principals/users/user01', 'contact_birthdays')
|
||||
->willReturn([
|
||||
'id' => 1234
|
||||
]);
|
||||
'id' => 1234
|
||||
]);
|
||||
$this->calDav->expects($this->at(1))->method('deleteCalendarObject')->with(1234, 'default-gump.vcf.ics');
|
||||
$this->calDav->expects($this->at(2))->method('deleteCalendarObject')->with(1234, 'default-gump.vcf-death.ics');
|
||||
$this->calDav->expects($this->at(3))->method('deleteCalendarObject')->with(1234, 'default-gump.vcf-anniversary.ics');
|
||||
|
|
|
@ -135,7 +135,7 @@ class CardDavBackendTest extends TestCase {
|
|||
$this->createMock(IAppManager::class),
|
||||
$this->createMock(ProxyMapper::class),
|
||||
$this->createMock(IConfig::class),
|
||||
])
|
||||
])
|
||||
->setMethods(['getPrincipalByPath', 'getGroupMembership'])
|
||||
->getMock();
|
||||
$this->principal->method('getPrincipalByPath')
|
||||
|
@ -668,12 +668,12 @@ class CardDavBackendTest extends TestCase {
|
|||
$query->insert($this->dbCardsTable)
|
||||
->values(
|
||||
[
|
||||
'addressbookid' => $query->createNamedParameter(0),
|
||||
'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB),
|
||||
'uri' => $query->createNamedParameter('uri' . $i),
|
||||
'lastmodified' => $query->createNamedParameter(time()),
|
||||
'etag' => $query->createNamedParameter('etag' . $i),
|
||||
'size' => $query->createNamedParameter(120),
|
||||
'addressbookid' => $query->createNamedParameter(0),
|
||||
'carddata' => $query->createNamedParameter($vCards[$i]->serialize(), IQueryBuilder::PARAM_LOB),
|
||||
'uri' => $query->createNamedParameter('uri' . $i),
|
||||
'lastmodified' => $query->createNamedParameter(time()),
|
||||
'etag' => $query->createNamedParameter('etag' . $i),
|
||||
'size' => $query->createNamedParameter(120),
|
||||
]
|
||||
);
|
||||
$query->execute();
|
||||
|
@ -694,11 +694,11 @@ class CardDavBackendTest extends TestCase {
|
|||
$query->insert($this->dbCardsPropertiesTable)
|
||||
->values(
|
||||
[
|
||||
'addressbookid' => $query->createNamedParameter(0),
|
||||
'cardid' => $query->createNamedParameter($vCardIds[0]),
|
||||
'name' => $query->createNamedParameter('CLOUD'),
|
||||
'value' => $query->createNamedParameter('John@nextcloud.com'),
|
||||
'preferred' => $query->createNamedParameter(0)
|
||||
'addressbookid' => $query->createNamedParameter(0),
|
||||
'cardid' => $query->createNamedParameter($vCardIds[0]),
|
||||
'name' => $query->createNamedParameter('CLOUD'),
|
||||
'value' => $query->createNamedParameter('John@nextcloud.com'),
|
||||
'preferred' => $query->createNamedParameter(0)
|
||||
]
|
||||
);
|
||||
$query->execute();
|
||||
|
@ -755,13 +755,13 @@ class CardDavBackendTest extends TestCase {
|
|||
|
||||
public function dataTestSearch() {
|
||||
return [
|
||||
['John', ['FN'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
['M. Doe', ['FN'], [], [['uri1', 'John M. Doe']]],
|
||||
['Do', ['FN'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
'check if duplicates are handled correctly' => ['John', ['FN', 'CLOUD'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
'case insensitive' => ['john', ['FN'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
'find "_" escaped' => ['_', ['CLOUD'], [], [['uri2', 'find without options']]],
|
||||
'find not empty ClOUD' => ['%_%', ['CLOUD'], ['escape_like_param'=>false], [['uri0', 'John Doe'], ['uri2', 'find without options']]],
|
||||
['John', ['FN'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
['M. Doe', ['FN'], [], [['uri1', 'John M. Doe']]],
|
||||
['Do', ['FN'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
'check if duplicates are handled correctly' => ['John', ['FN', 'CLOUD'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
'case insensitive' => ['john', ['FN'], [], [['uri0', 'John Doe'], ['uri1', 'John M. Doe']]],
|
||||
'find "_" escaped' => ['_', ['CLOUD'], [], [['uri2', 'find without options']]],
|
||||
'find not empty ClOUD' => ['%_%', ['CLOUD'], ['escape_like_param'=>false], [['uri0', 'John Doe'], ['uri2', 'find without options']]],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -770,12 +770,12 @@ class CardDavBackendTest extends TestCase {
|
|||
$query->insert($this->dbCardsTable)
|
||||
->values(
|
||||
[
|
||||
'addressbookid' => $query->createNamedParameter(1),
|
||||
'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB),
|
||||
'uri' => $query->createNamedParameter('uri'),
|
||||
'lastmodified' => $query->createNamedParameter(5489543),
|
||||
'etag' => $query->createNamedParameter('etag'),
|
||||
'size' => $query->createNamedParameter(120),
|
||||
'addressbookid' => $query->createNamedParameter(1),
|
||||
'carddata' => $query->createNamedParameter('carddata', IQueryBuilder::PARAM_LOB),
|
||||
'uri' => $query->createNamedParameter('uri'),
|
||||
'lastmodified' => $query->createNamedParameter(5489543),
|
||||
'etag' => $query->createNamedParameter('etag'),
|
||||
'size' => $query->createNamedParameter(120),
|
||||
]
|
||||
);
|
||||
$query->execute();
|
||||
|
@ -798,12 +798,12 @@ class CardDavBackendTest extends TestCase {
|
|||
$query->insert($this->dbCardsTable)
|
||||
->values(
|
||||
[
|
||||
'addressbookid' => $query->createNamedParameter($i),
|
||||
'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB),
|
||||
'uri' => $query->createNamedParameter('uri' . $i),
|
||||
'lastmodified' => $query->createNamedParameter(5489543),
|
||||
'etag' => $query->createNamedParameter('etag' . $i),
|
||||
'size' => $query->createNamedParameter(120),
|
||||
'addressbookid' => $query->createNamedParameter($i),
|
||||
'carddata' => $query->createNamedParameter('carddata' . $i, IQueryBuilder::PARAM_LOB),
|
||||
'uri' => $query->createNamedParameter('uri' . $i),
|
||||
'lastmodified' => $query->createNamedParameter(5489543),
|
||||
'etag' => $query->createNamedParameter('etag' . $i),
|
||||
'size' => $query->createNamedParameter(120),
|
||||
]
|
||||
);
|
||||
$query->execute();
|
||||
|
|
|
@ -41,8 +41,8 @@ class ContactsManagerTest extends TestCase {
|
|||
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject $backEnd */
|
||||
$backEnd = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
|
||||
$backEnd->method('getAddressBooksForUser')->willReturn([
|
||||
['{DAV:}displayname' => 'Test address book', 'uri' => 'default'],
|
||||
]);
|
||||
['{DAV:}displayname' => 'Test address book', 'uri' => 'default'],
|
||||
]);
|
||||
|
||||
$l = $this->createMock(IL10N::class);
|
||||
$app = new ContactsManager($backEnd, $l);
|
||||
|
|
|
@ -192,9 +192,9 @@ class ConverterTest extends TestCase {
|
|||
|
||||
public function providesNames() {
|
||||
return [
|
||||
['Sauron;;;;', 'Sauron'],
|
||||
['Baggins;Bilbo;;;', 'Bilbo Baggins'],
|
||||
['Tolkien;John;Ronald Reuel;;', 'John Ronald Reuel Tolkien'],
|
||||
['Sauron;;;;', 'Sauron'],
|
||||
['Baggins;Bilbo;;;', 'Bilbo Baggins'],
|
||||
['Tolkien;John;Ronald Reuel;;', 'John Ronald Reuel Tolkien'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -69,10 +69,10 @@ class PluginTest extends TestCase {
|
|||
public function testSharing() {
|
||||
|
||||
$this->book->expects($this->once())->method('updateShares')->with([[
|
||||
'href' => 'principal:principals/admin',
|
||||
'commonName' => null,
|
||||
'summary' => null,
|
||||
'readOnly' => false
|
||||
'href' => 'principal:principals/admin',
|
||||
'commonName' => null,
|
||||
'summary' => null,
|
||||
'readOnly' => false
|
||||
]], ['mailto:wilfredo@example.com']);
|
||||
|
||||
// setup request
|
||||
|
|
|
@ -131,41 +131,41 @@ class SyncServiceTest extends TestCase {
|
|||
$accountManager = $this->getMockBuilder(AccountManager::class)->disableOriginalConstructor()->getMock();
|
||||
$accountManager->expects($this->any())->method('getUser')
|
||||
->willReturn([
|
||||
AccountManager::PROPERTY_DISPLAYNAME =>
|
||||
[
|
||||
'value' => $user->getDisplayName(),
|
||||
'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY,
|
||||
],
|
||||
AccountManager::PROPERTY_ADDRESS =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
AccountManager::PROPERTY_WEBSITE =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
AccountManager::PROPERTY_EMAIL =>
|
||||
[
|
||||
'value' => $user->getEMailAddress(),
|
||||
'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY,
|
||||
],
|
||||
AccountManager::PROPERTY_AVATAR =>
|
||||
[
|
||||
'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY
|
||||
],
|
||||
AccountManager::PROPERTY_PHONE =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
AccountManager::PROPERTY_TWITTER =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
]
|
||||
AccountManager::PROPERTY_DISPLAYNAME =>
|
||||
[
|
||||
'value' => $user->getDisplayName(),
|
||||
'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY,
|
||||
],
|
||||
AccountManager::PROPERTY_ADDRESS =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
AccountManager::PROPERTY_WEBSITE =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
AccountManager::PROPERTY_EMAIL =>
|
||||
[
|
||||
'value' => $user->getEMailAddress(),
|
||||
'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY,
|
||||
],
|
||||
AccountManager::PROPERTY_AVATAR =>
|
||||
[
|
||||
'scope' => AccountManager::VISIBILITY_CONTACTS_ONLY
|
||||
],
|
||||
AccountManager::PROPERTY_PHONE =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
AccountManager::PROPERTY_TWITTER =>
|
||||
[
|
||||
'value' => '',
|
||||
'scope' => AccountManager::VISIBILITY_PRIVATE,
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$ss = new SyncService($backend, $userManager, $logger, $accountManager);
|
||||
|
|
|
@ -262,7 +262,7 @@ class MoveCalendarTest extends TestCase {
|
|||
->with(1234)
|
||||
->willReturn([
|
||||
['href' => 'principal:principals/groups/nextclouders']
|
||||
]);
|
||||
]);
|
||||
if ($shareWithGroupMembersOnly === true) {
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage("User <user2> is not part of the group <nextclouders> with whom the calendar <personal> was shared. You may use -f to move the calendar while deleting this share.");
|
||||
|
@ -412,7 +412,7 @@ class MoveCalendarTest extends TestCase {
|
|||
'href' => 'principal:principals/users/user2',
|
||||
'{DAV:}displayname' => 'Personal'
|
||||
]
|
||||
]);
|
||||
]);
|
||||
|
||||
if ($force === false) {
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
|
|
@ -182,11 +182,11 @@ class CommentsPluginTest extends \Test\TestCase {
|
|||
];
|
||||
|
||||
$comment = new Comment([
|
||||
'objectType' => 'files',
|
||||
'objectId' => '666',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice'
|
||||
] + $commentData);
|
||||
'objectType' => 'files',
|
||||
'objectId' => '666',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice'
|
||||
] + $commentData);
|
||||
$comment->setId('23');
|
||||
|
||||
$path = 'comments/files/666';
|
||||
|
@ -264,11 +264,11 @@ class CommentsPluginTest extends \Test\TestCase {
|
|||
];
|
||||
|
||||
$comment = new Comment([
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice'
|
||||
] + $commentData);
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice'
|
||||
] + $commentData);
|
||||
$comment->setId('23');
|
||||
|
||||
$path = 'comments/files/42';
|
||||
|
@ -352,11 +352,11 @@ class CommentsPluginTest extends \Test\TestCase {
|
|||
];
|
||||
|
||||
$comment = new Comment([
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice'
|
||||
] + $commentData);
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice'
|
||||
] + $commentData);
|
||||
$comment->setId('23');
|
||||
|
||||
$path = 'comments/files/42';
|
||||
|
@ -440,13 +440,13 @@ class CommentsPluginTest extends \Test\TestCase {
|
|||
];
|
||||
|
||||
$comment = new Comment([
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice',
|
||||
'message' => 'dummy',
|
||||
'verb' => 'dummy'
|
||||
]);
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice',
|
||||
'message' => 'dummy',
|
||||
'verb' => 'dummy'
|
||||
]);
|
||||
$comment->setId('23');
|
||||
|
||||
$path = 'comments/files/42';
|
||||
|
@ -535,12 +535,12 @@ class CommentsPluginTest extends \Test\TestCase {
|
|||
];
|
||||
|
||||
$comment = new Comment([
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice',
|
||||
'verb' => 'comment',
|
||||
]);
|
||||
'objectType' => 'files',
|
||||
'objectId' => '42',
|
||||
'actorType' => 'users',
|
||||
'actorId' => 'alice',
|
||||
'verb' => 'comment',
|
||||
]);
|
||||
$comment->setId('23');
|
||||
|
||||
$path = 'comments/files/42';
|
||||
|
|
|
@ -350,52 +350,52 @@ class FileTest extends TestCase {
|
|||
public function legalMtimeProvider() {
|
||||
return [
|
||||
"string" => [
|
||||
'HTTP_X_OC_MTIME' => "string",
|
||||
'expected result' => null
|
||||
'HTTP_X_OC_MTIME' => "string",
|
||||
'expected result' => null
|
||||
],
|
||||
"castable string (int)" => [
|
||||
'HTTP_X_OC_MTIME' => "34",
|
||||
'expected result' => 34
|
||||
'HTTP_X_OC_MTIME' => "34",
|
||||
'expected result' => 34
|
||||
],
|
||||
"castable string (float)" => [
|
||||
'HTTP_X_OC_MTIME' => "34.56",
|
||||
'expected result' => 34
|
||||
'HTTP_X_OC_MTIME' => "34.56",
|
||||
'expected result' => 34
|
||||
],
|
||||
"float" => [
|
||||
'HTTP_X_OC_MTIME' => 34.56,
|
||||
'expected result' => 34
|
||||
'HTTP_X_OC_MTIME' => 34.56,
|
||||
'expected result' => 34
|
||||
],
|
||||
"zero" => [
|
||||
'HTTP_X_OC_MTIME' => 0,
|
||||
'expected result' => 0
|
||||
'HTTP_X_OC_MTIME' => 0,
|
||||
'expected result' => 0
|
||||
],
|
||||
"zero string" => [
|
||||
'HTTP_X_OC_MTIME' => "0",
|
||||
'expected result' => 0
|
||||
'HTTP_X_OC_MTIME' => "0",
|
||||
'expected result' => 0
|
||||
],
|
||||
"negative zero string" => [
|
||||
'HTTP_X_OC_MTIME' => "-0",
|
||||
'expected result' => 0
|
||||
'HTTP_X_OC_MTIME' => "-0",
|
||||
'expected result' => 0
|
||||
],
|
||||
"string starting with number following by char" => [
|
||||
'HTTP_X_OC_MTIME' => "2345asdf",
|
||||
'expected result' => null
|
||||
'HTTP_X_OC_MTIME' => "2345asdf",
|
||||
'expected result' => null
|
||||
],
|
||||
"string castable hex int" => [
|
||||
'HTTP_X_OC_MTIME' => "0x45adf",
|
||||
'expected result' => null
|
||||
'HTTP_X_OC_MTIME' => "0x45adf",
|
||||
'expected result' => null
|
||||
],
|
||||
"string that looks like invalid hex int" => [
|
||||
'HTTP_X_OC_MTIME' => "0x123g",
|
||||
'expected result' => null
|
||||
'HTTP_X_OC_MTIME' => "0x123g",
|
||||
'expected result' => null
|
||||
],
|
||||
"negative int" => [
|
||||
'HTTP_X_OC_MTIME' => -34,
|
||||
'expected result' => -34
|
||||
'HTTP_X_OC_MTIME' => -34,
|
||||
'expected result' => -34
|
||||
],
|
||||
"negative float" => [
|
||||
'HTTP_X_OC_MTIME' => -34.43,
|
||||
'expected result' => -34
|
||||
'HTTP_X_OC_MTIME' => -34.43,
|
||||
'expected result' => -34
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -406,9 +406,9 @@ class FileTest extends TestCase {
|
|||
*/
|
||||
public function testPutSingleFileLegalMtime($requestMtime, $resultMtime) {
|
||||
$request = new \OC\AppFramework\Http\Request([
|
||||
'server' => [
|
||||
'HTTP_X_OC_MTIME' => $requestMtime,
|
||||
]
|
||||
'server' => [
|
||||
'HTTP_X_OC_MTIME' => $requestMtime,
|
||||
]
|
||||
], null, $this->config, null);
|
||||
$file = 'foo.txt';
|
||||
|
||||
|
@ -430,9 +430,9 @@ class FileTest extends TestCase {
|
|||
*/
|
||||
public function testChunkedPutLegalMtime($requestMtime, $resultMtime) {
|
||||
$request = new \OC\AppFramework\Http\Request([
|
||||
'server' => [
|
||||
'HTTP_X_OC_MTIME' => $requestMtime,
|
||||
]
|
||||
'server' => [
|
||||
'HTTP_X_OC_MTIME' => $requestMtime,
|
||||
]
|
||||
], null, $this->config, null);
|
||||
|
||||
$_SERVER['HTTP_OC_CHUNKED'] = true;
|
||||
|
@ -1105,10 +1105,10 @@ class FileTest extends TestCase {
|
|||
$userView = Filesystem::getView();
|
||||
}
|
||||
return [
|
||||
"filesize" => $userView->filesize($path),
|
||||
"mtime" => $userView->filemtime($path),
|
||||
"filetype" => $userView->filetype($path),
|
||||
"mimetype" => $userView->getMimeType($path)
|
||||
"filesize" => $userView->filesize($path),
|
||||
"mtime" => $userView->filemtime($path),
|
||||
"filetype" => $userView->filetype($path),
|
||||
"mimetype" => $userView->getMimeType($path)
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ class PrincipalTest extends TestCase {
|
|||
'principals/groups/group1',
|
||||
'principals/groups/foo%2Fbar',
|
||||
'proxyId1/calendar-proxy-read',
|
||||
'proxyId2/calendar-proxy-write',
|
||||
'proxyId2/calendar-proxy-write',
|
||||
];
|
||||
$response = $this->connector->getGroupMembership('principals/users/foo');
|
||||
$this->assertSame($expectedResponse, $response);
|
||||
|
@ -545,9 +545,9 @@ class PrincipalTest extends TestCase {
|
|||
->willReturn([$user2, $user3]);
|
||||
|
||||
$this->assertEquals([
|
||||
'principals/users/user2',
|
||||
'principals/users/user3',
|
||||
], $this->connector->searchPrincipals('principals/users',
|
||||
'principals/users/user2',
|
||||
'principals/users/user3',
|
||||
], $this->connector->searchPrincipals('principals/users',
|
||||
['{urn:ietf:params:xml:ns:caldav}calendar-user-address-set' => 'user@example.com']));
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,10 @@ class PluginTest extends TestCase {
|
|||
public function testSharing() {
|
||||
|
||||
$this->book->expects($this->once())->method('updateShares')->with([[
|
||||
'href' => 'principal:principals/admin',
|
||||
'commonName' => null,
|
||||
'summary' => null,
|
||||
'readOnly' => false
|
||||
'href' => 'principal:principals/admin',
|
||||
'commonName' => null,
|
||||
'summary' => null,
|
||||
'readOnly' => false
|
||||
]], ['mailto:wilfredo@example.com']);
|
||||
|
||||
// setup request
|
||||
|
|
|
@ -48,10 +48,10 @@ class SystemPrincipalBackendTest extends TestCase {
|
|||
'uri' => 'principals/system/system',
|
||||
'{DAV:}displayname' => 'system',
|
||||
],
|
||||
[
|
||||
'uri' => 'principals/system/public',
|
||||
'{DAV:}displayname' => 'public',
|
||||
]
|
||||
[
|
||||
'uri' => 'principals/system/public',
|
||||
'{DAV:}displayname' => 'public',
|
||||
]
|
||||
], 'principals/system'],
|
||||
];
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class SystemPrincipalBackendTest extends TestCase {
|
|||
|
||||
public function providesPrincipalForGetGroupMembership() {
|
||||
return [
|
||||
['principals/system/a'],
|
||||
['principals/system/a'],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -87,41 +87,41 @@ class AssemblyStreamTest extends \Test\TestCase {
|
|||
return[
|
||||
'one node zero bytes' => [
|
||||
'', [
|
||||
$this->buildNode('0', '')
|
||||
]],
|
||||
$this->buildNode('0', '')
|
||||
]],
|
||||
'one node only' => [
|
||||
'1234567890', [
|
||||
$this->buildNode('0', '1234567890')
|
||||
]],
|
||||
$this->buildNode('0', '1234567890')
|
||||
]],
|
||||
'one node buffer boundary' => [
|
||||
$data8k, [
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
'two nodes' => [
|
||||
'1234567890', [
|
||||
$this->buildNode('1', '67890'),
|
||||
$this->buildNode('0', '12345')
|
||||
]],
|
||||
$this->buildNode('1', '67890'),
|
||||
$this->buildNode('0', '12345')
|
||||
]],
|
||||
'two nodes end on buffer boundary' => [
|
||||
$data8k . $data8k, [
|
||||
$this->buildNode('1', $data8k),
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
$this->buildNode('1', $data8k),
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
'two nodes with one on buffer boundary' => [
|
||||
$data8k . $dataLess8k, [
|
||||
$this->buildNode('1', $dataLess8k),
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
$this->buildNode('1', $dataLess8k),
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
'two nodes on buffer boundary plus one byte' => [
|
||||
$data8k . 'X' . $data8k, [
|
||||
$this->buildNode('1', $data8k),
|
||||
$this->buildNode('0', $data8k . 'X')
|
||||
]],
|
||||
$this->buildNode('1', $data8k),
|
||||
$this->buildNode('0', $data8k . 'X')
|
||||
]],
|
||||
'two nodes on buffer boundary plus one byte at the end' => [
|
||||
$data8k . $data8k . 'X', [
|
||||
$this->buildNode('1', $data8k . 'X'),
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
$this->buildNode('1', $data8k . 'X'),
|
||||
$this->buildNode('0', $data8k)
|
||||
]],
|
||||
'a ton of nodes' => [
|
||||
$tonofdata, $tonofnodes
|
||||
]
|
||||
|
|
|
@ -64,7 +64,7 @@ class Setup {
|
|||
$this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
|
||||
$this->crypt = $crypt;
|
||||
$this->keyManager = $keyManager;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $uid user id
|
||||
|
|
|
@ -110,8 +110,8 @@ class RecoveryTest extends TestCase {
|
|||
$this->cryptMock->expects($this->once())
|
||||
->method('createKeyPair')
|
||||
->willReturn([
|
||||
'publicKey' => 'privateKey',
|
||||
'privateKey' => 'publicKey',
|
||||
'publicKey' => 'privateKey',
|
||||
'privateKey' => 'publicKey',
|
||||
]);
|
||||
|
||||
$this->keyManagerMock->expects($this->once())
|
||||
|
|
|
@ -255,7 +255,7 @@ class Notifications {
|
|||
$fields = [
|
||||
'token' => $token,
|
||||
'remoteId' => $remoteId
|
||||
];
|
||||
];
|
||||
foreach ($data as $key => $value) {
|
||||
$fields[$key] = $value;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class SyncFederationAddressBooks {
|
|||
$targetBookId = $trustedServer['url_hash'];
|
||||
$targetPrincipal = "principals/system/system";
|
||||
$targetBookProperties = [
|
||||
'{DAV:}displayname' => $url
|
||||
'{DAV:}displayname' => $url
|
||||
];
|
||||
try {
|
||||
$newToken = $this->syncService->syncRemoteAddressBook($url, $cardDavUser, $addressBookUrl, $sharedSecret, $syncToken, $targetBookId, $targetPrincipal, $targetBookProperties);
|
||||
|
|
|
@ -92,9 +92,9 @@ class DbHandlerTest extends TestCase {
|
|||
|
||||
public function dataTestAddServer() {
|
||||
return [
|
||||
['http://owncloud.org', 'http://owncloud.org', sha1('owncloud.org')],
|
||||
['https://owncloud.org', 'https://owncloud.org', sha1('owncloud.org')],
|
||||
['http://owncloud.org/', 'http://owncloud.org', sha1('owncloud.org')],
|
||||
['http://owncloud.org', 'http://owncloud.org', sha1('owncloud.org')],
|
||||
['https://owncloud.org', 'https://owncloud.org', sha1('owncloud.org')],
|
||||
['http://owncloud.org/', 'http://owncloud.org', sha1('owncloud.org')],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,13 @@ class SyncFederationAddressbooksTest extends \Test\TestCase {
|
|||
getMock();
|
||||
$dbHandler->method('getAllServer')->
|
||||
willReturn([
|
||||
[
|
||||
'url' => 'https://cloud.drop.box',
|
||||
'url_hash' => 'sha1',
|
||||
'shared_secret' => 'iloveowncloud',
|
||||
'sync_token' => '0'
|
||||
]
|
||||
]);
|
||||
[
|
||||
'url' => 'https://cloud.drop.box',
|
||||
'url_hash' => 'sha1',
|
||||
'shared_secret' => 'iloveowncloud',
|
||||
'sync_token' => '0'
|
||||
]
|
||||
]);
|
||||
$dbHandler->expects($this->once())->method('setServerStatus')->
|
||||
with('https://cloud.drop.box', 1, '1');
|
||||
$syncService = $this->getMockBuilder('OCA\DAV\CardDAV\SyncService')
|
||||
|
|
|
@ -52,8 +52,8 @@ class ScanFilesTest extends TestCase {
|
|||
|
||||
$this->scanFiles = $this->getMockBuilder('\OCA\Files\BackgroundJob\ScanFiles')
|
||||
->setConstructorArgs([
|
||||
$this->config,
|
||||
$this->userManager,
|
||||
$this->config,
|
||||
$this->userManager,
|
||||
])
|
||||
->setMethods(['runScanner'])
|
||||
->getMock();
|
||||
|
@ -105,7 +105,7 @@ class ScanFilesTest extends TestCase {
|
|||
->method('search')
|
||||
->with('', 500, 50)
|
||||
->willReturn([
|
||||
$fakeUser
|
||||
$fakeUser
|
||||
]);
|
||||
$this->config
|
||||
->expects($this->at(2))
|
||||
|
|
|
@ -99,17 +99,17 @@ class ViewControllerTest extends TestCase {
|
|||
$this->activityHelper = $this->createMock(Helper::class);
|
||||
$this->viewController = $this->getMockBuilder('\OCA\Files\Controller\ViewController')
|
||||
->setConstructorArgs([
|
||||
'files',
|
||||
$this->request,
|
||||
$this->urlGenerator,
|
||||
$this->l10n,
|
||||
$this->config,
|
||||
$this->eventDispatcher,
|
||||
$this->userSession,
|
||||
$this->appManager,
|
||||
$this->rootFolder,
|
||||
$this->activityHelper,
|
||||
])
|
||||
'files',
|
||||
$this->request,
|
||||
$this->urlGenerator,
|
||||
$this->l10n,
|
||||
$this->config,
|
||||
$this->eventDispatcher,
|
||||
$this->userSession,
|
||||
$this->appManager,
|
||||
$this->rootFolder,
|
||||
$this->activityHelper,
|
||||
])
|
||||
->setMethods([
|
||||
'getStorageInfo',
|
||||
'renderScript'
|
||||
|
@ -262,14 +262,14 @@ class ViewControllerTest extends TestCase {
|
|||
'classes' => 'collapsible',
|
||||
'sublist' => [
|
||||
[
|
||||
'id' => 'sharingout',
|
||||
'id' => 'sharingout',
|
||||
'appname' => 'files_sharing',
|
||||
'script' => 'list.php',
|
||||
'order' => 16,
|
||||
'name' => \OC::$server->getL10N('files_sharing')->t('Shared with others'),
|
||||
],
|
||||
[
|
||||
'id' => 'sharingin',
|
||||
'id' => 'sharingin',
|
||||
'appname' => 'files_sharing',
|
||||
'script' => 'list.php',
|
||||
'order' => 15,
|
||||
|
|
|
@ -93,8 +93,8 @@ class Config extends Base {
|
|||
$value = $mount->getBackendOption($key);
|
||||
}
|
||||
if (!is_string($value) && json_decode(json_encode($value)) === $value) { // show bools and objects correctly
|
||||
$value = json_encode($value);
|
||||
}
|
||||
$value = json_encode($value);
|
||||
}
|
||||
$output->writeln($value);
|
||||
}
|
||||
|
||||
|
@ -106,9 +106,9 @@ class Config extends Base {
|
|||
*/
|
||||
protected function setOption(StorageConfig $mount, $key, $value, OutputInterface $output) {
|
||||
$decoded = json_decode($value, true);
|
||||
if (!is_null($decoded) && json_encode($decoded) === $value) {
|
||||
$value = $decoded;
|
||||
}
|
||||
if (!is_null($decoded) && json_encode($decoded) === $value) {
|
||||
$value = $decoded;
|
||||
}
|
||||
if ($key === 'mountpoint' || $key === 'mount_point') {
|
||||
$mount->setMountPoint($value);
|
||||
} else {
|
||||
|
|
|
@ -93,8 +93,8 @@ class AjaxController extends Controller {
|
|||
'private_key' => $key['privatekey'],
|
||||
'public_key' => $key['publickey']
|
||||
],
|
||||
'status' => 'success'
|
||||
]);
|
||||
'status' => 'success'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -227,7 +227,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
|
|||
public function testDeleteUnexistingStorage() {
|
||||
$this->expectException(\DomainException::class);
|
||||
|
||||
$this->actualDeletedUnexistingStorageTest();
|
||||
$this->actualDeletedUnexistingStorageTest();
|
||||
}
|
||||
|
||||
public function getUniqueStoragesProvider() {
|
||||
|
|
|
@ -65,10 +65,10 @@ class FtpTest extends \Test\Files\Storage\Storage {
|
|||
|
||||
public function testConstructUrl(){
|
||||
$config = [ 'host' => 'localhost',
|
||||
'user' => 'ftp',
|
||||
'password' => 'ftp',
|
||||
'root' => '/',
|
||||
'secure' => false ];
|
||||
'user' => 'ftp',
|
||||
'password' => 'ftp',
|
||||
'root' => '/',
|
||||
'secure' => false ];
|
||||
$instance = new FTP($config);
|
||||
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
|
|
|
@ -100,11 +100,11 @@ return [
|
|||
'root'=>'/test'
|
||||
],
|
||||
'sftp_key' => [
|
||||
'run'=>false,
|
||||
'host'=>'localhost',
|
||||
'user'=>'test',
|
||||
'public_key'=>'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJPTvz3OLonF2KSGEKP/nd4CPmRYvemG2T4rIiNYjDj0U5y+2sKEWbjiUlQl2bsqYuVoJ+/UNJlGQbbZ08kQirFeo1GoWBzqioaTjUJfbLN6TzVVKXxR9YIVmH7Ajg2iEeGCndGgbmnPfj+kF9TR9IH8vMVvtubQwf7uEwB0ALhw== phpseclib-generated-key',
|
||||
'run'=>false,
|
||||
'host'=>'localhost',
|
||||
'user'=>'test',
|
||||
'public_key'=>'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDJPTvz3OLonF2KSGEKP/nd4CPmRYvemG2T4rIiNYjDj0U5y+2sKEWbjiUlQl2bsqYuVoJ+/UNJlGQbbZ08kQirFeo1GoWBzqioaTjUJfbLN6TzVVKXxR9YIVmH7Ajg2iEeGCndGgbmnPfj+kF9TR9IH8vMVvtubQwf7uEwB0ALhw== phpseclib-generated-key',
|
||||
'private_key'=>'test',
|
||||
'root'=>'/test'
|
||||
],
|
||||
'root'=>'/test'
|
||||
],
|
||||
];
|
||||
|
|
|
@ -136,7 +136,7 @@ class SharingCheckMiddleware extends Middleware {
|
|||
}
|
||||
|
||||
if (!$this->reflector->hasAnnotation('NoOutgoingFederatedSharingRequired') &&
|
||||
$this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') !== 'yes') {
|
||||
$this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') !== 'yes') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
|||
<div>
|
||||
<?php
|
||||
echo $l->t('By uploading files, you agree to the %1$sterms of service%2$s.', [
|
||||
'<span id="show-terms-dialog">', '</span>'
|
||||
'<span id="show-terms-dialog">', '</span>'
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -227,19 +227,19 @@ class CacheTest extends TestCase {
|
|||
function testSearchByMime() {
|
||||
$results = $this->sharedStorage->getCache()->searchByMime('text');
|
||||
$check = [
|
||||
[
|
||||
'name' => 'bar.txt',
|
||||
'path' => 'bar.txt'
|
||||
],
|
||||
[
|
||||
'name' => 'another too.txt',
|
||||
'path' => 'subdir/another too.txt'
|
||||
],
|
||||
[
|
||||
'name' => 'another.txt',
|
||||
'path' => 'subdir/another.txt'
|
||||
],
|
||||
];
|
||||
[
|
||||
'name' => 'bar.txt',
|
||||
'path' => 'bar.txt'
|
||||
],
|
||||
[
|
||||
'name' => 'another too.txt',
|
||||
'path' => 'subdir/another too.txt'
|
||||
],
|
||||
[
|
||||
'name' => 'another.txt',
|
||||
'path' => 'subdir/another.txt'
|
||||
],
|
||||
];
|
||||
$this->verifyFiles($check, $results);
|
||||
}
|
||||
|
||||
|
|
|
@ -4085,7 +4085,7 @@ class ShareAPIControllerTest extends TestCase {
|
|||
$recipientGroup = $this->createMock('\OCP\IGroup');
|
||||
$recipientGroup->method('getDisplayName')->willReturn('recipientGroupDisplayName');
|
||||
$this->groupManager->method('get')->willReturnMap([
|
||||
['recipientGroup', $recipientGroup],
|
||||
['recipientGroup', $recipientGroup],
|
||||
]);
|
||||
|
||||
$this->urlGenerator->method('linkToRouteAbsolute')
|
||||
|
|
|
@ -155,7 +155,7 @@ abstract class AUserData extends OCSController {
|
|||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the groups a user is a subadmin of
|
||||
|
|
|
@ -105,7 +105,7 @@ class UsersController extends AUserData {
|
|||
NewUserMailHelper $newUserMailHelper,
|
||||
FederatedFileSharingFactory $federatedFileSharingFactory,
|
||||
ISecureRandom $secureRandom,
|
||||
RemoteWipe $remoteWipe) {
|
||||
RemoteWipe $remoteWipe) {
|
||||
parent::__construct($appName,
|
||||
$request,
|
||||
$userManager,
|
||||
|
|
|
@ -258,7 +258,7 @@ class GroupsControllerTest extends \Test\TestCase {
|
|||
'canAdd' => true,
|
||||
'canRemove' => true
|
||||
|
||||
]
|
||||
]
|
||||
]], $result->getData());
|
||||
|
||||
}
|
||||
|
|
|
@ -157,10 +157,10 @@ class UsersControllerTest extends TestCase {
|
|||
->willReturn(['Admin' => [], 'Foo' => [], 'Bar' => []]);
|
||||
|
||||
$expected = ['users' => [
|
||||
'Admin',
|
||||
'Foo',
|
||||
'Bar',
|
||||
],
|
||||
'Admin',
|
||||
'Foo',
|
||||
'Bar',
|
||||
],
|
||||
];
|
||||
$this->assertEquals($expected, $this->api->getUsers('MyCustomSearch')->getData());
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ class SecurityProvider implements IProvider {
|
|||
case 'twofactor_success':
|
||||
$params = $event->getSubjectParameters();
|
||||
$event->setParsedSubject($l->t('You successfully logged in using two-factor authentication (%1$s)', [
|
||||
$params['provider'],
|
||||
]));
|
||||
$params['provider'],
|
||||
]));
|
||||
if ($this->activityManager->getRequirePNG()) {
|
||||
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
|
||||
} else {
|
||||
|
@ -74,8 +74,8 @@ class SecurityProvider implements IProvider {
|
|||
case 'twofactor_failed':
|
||||
$params = $event->getSubjectParameters();
|
||||
$event->setParsedSubject($l->t('A login attempt using two-factor authentication failed (%1$s)', [
|
||||
$params['provider'],
|
||||
]));
|
||||
$params['provider'],
|
||||
]));
|
||||
if ($this->activityManager->getRequirePNG()) {
|
||||
$event->setIcon($this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core', 'actions/password.png')));
|
||||
} else {
|
||||
|
|
|
@ -148,7 +148,7 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->dateTimeFormatter,
|
||||
$this->memoryInfo,
|
||||
$this->secureRandom,
|
||||
])
|
||||
])
|
||||
->setMethods([
|
||||
'isReadOnlyConfig',
|
||||
'hasValidTransactionIsolationLevel',
|
||||
|
@ -203,7 +203,7 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->config->expects($this->at(0))
|
||||
->method('getSystemValue')
|
||||
->with('has_internet_connection', true)
|
||||
->willReturn(true);
|
||||
->willReturn(true);
|
||||
|
||||
$this->config->expects($this->at(1))
|
||||
->method('getSystemValue')
|
||||
|
@ -232,7 +232,7 @@ class CheckSetupControllerTest extends TestCase {
|
|||
$this->config->expects($this->at(0))
|
||||
->method('getSystemValue')
|
||||
->with('has_internet_connection', true)
|
||||
->willReturn(true);
|
||||
->willReturn(true);
|
||||
|
||||
$this->config->expects($this->at(1))
|
||||
->method('getSystemValue')
|
||||
|
@ -956,7 +956,7 @@ class CheckSetupControllerTest extends TestCase {
|
|||
'No errors have been found.',
|
||||
Http::STATUS_OK,
|
||||
[
|
||||
'Content-Type' => 'text/plain',
|
||||
'Content-Type' => 'text/plain',
|
||||
]
|
||||
);
|
||||
$this->assertEquals($expected, $this->checkSetupController->getFailedIntegrityCheckFiles());
|
||||
|
@ -1367,7 +1367,7 @@ Array
|
|||
',
|
||||
Http::STATUS_OK,
|
||||
[
|
||||
'Content-Type' => 'text/plain',
|
||||
'Content-Type' => 'text/plain',
|
||||
]
|
||||
);
|
||||
$this->assertEquals($expected, $this->checkSetupController->getFailedIntegrityCheckFiles());
|
||||
|
|
|
@ -119,8 +119,8 @@ class Activity implements IProvider {
|
|||
|
||||
if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_SELF) {
|
||||
$event->setParsedSubject($this->l->t('Shared with %1$s', [
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
->setRichSubject($this->l->t('Shared with {email}'), [
|
||||
'email' => $parsedParameters['email'],
|
||||
]);
|
||||
|
@ -145,8 +145,8 @@ class Activity implements IProvider {
|
|||
}
|
||||
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) {
|
||||
$event->setParsedSubject($this->l->t('Unshared from %1$s', [
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
->setRichSubject($this->l->t('Unshared from {email}'), [
|
||||
'email' => $parsedParameters['email'],
|
||||
]);
|
||||
|
@ -207,9 +207,9 @@ class Activity implements IProvider {
|
|||
|
||||
if ($event->getSubject() === self::SUBJECT_SHARED_EMAIL_SELF) {
|
||||
$event->setParsedSubject($this->l->t('You shared %1$s with %2$s by mail', [
|
||||
$parsedParameters['file']['path'],
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
$parsedParameters['file']['path'],
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
->setRichSubject($this->l->t('You shared {file} with {email} by mail'), $parsedParameters);
|
||||
if ($this->activityManager->getRequirePNG()) {
|
||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||
|
@ -230,9 +230,9 @@ class Activity implements IProvider {
|
|||
}
|
||||
} else if ($event->getSubject() === self::SUBJECT_UNSHARED_EMAIL_SELF) {
|
||||
$event->setParsedSubject($this->l->t('You unshared %1$s from %2$s by mail', [
|
||||
$parsedParameters['file']['path'],
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
$parsedParameters['file']['path'],
|
||||
$parsedParameters['email']['name'],
|
||||
]))
|
||||
->setRichSubject($this->l->t('You unshared {file} from {email} by mail'), $parsedParameters);
|
||||
if ($this->activityManager->getRequirePNG()) {
|
||||
$event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/share.png')));
|
||||
|
|
|
@ -56,13 +56,13 @@ class SettingsTest extends TestCase {
|
|||
];
|
||||
|
||||
$after = [
|
||||
'oc_appconfig' =>
|
||||
json_encode([
|
||||
'key1' => 'value1',
|
||||
'key2' => 'value2',
|
||||
'shareByMailEnabled' => true
|
||||
]),
|
||||
'oc_foo' => 'oc_bar'
|
||||
'oc_appconfig' =>
|
||||
json_encode([
|
||||
'key1' => 'value1',
|
||||
'key2' => 'value2',
|
||||
'shareByMailEnabled' => true
|
||||
]),
|
||||
'oc_foo' => 'oc_bar'
|
||||
];
|
||||
|
||||
$this->instance->announceShareProvider(['array' => &$before]);
|
||||
|
|
|
@ -116,23 +116,23 @@ class Provider implements IProvider {
|
|||
if ($event->getSubject() === self::ASSIGN_TAG) {
|
||||
if ($parsedParameters['actor']['id'] === '') {
|
||||
$event->setParsedSubject($this->l->t('System tag %1$s added by the system', [
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('Added system tag {systemtag}'), [
|
||||
'systemtag' => $parsedParameters['systemtag'],
|
||||
]);
|
||||
} else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('Added system tag %1$s', [
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('Added system tag {systemtag}'), [
|
||||
'systemtag' => $parsedParameters['systemtag'],
|
||||
]);
|
||||
} else {
|
||||
$event->setParsedSubject($this->l->t('%1$s added system tag %2$s', [
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('{actor} added system tag {systemtag}'), [
|
||||
'actor' => $parsedParameters['actor'],
|
||||
'systemtag' => $parsedParameters['systemtag'],
|
||||
|
@ -141,23 +141,23 @@ class Provider implements IProvider {
|
|||
} else if ($event->getSubject() === self::UNASSIGN_TAG) {
|
||||
if ($parsedParameters['actor']['id'] === '') {
|
||||
$event->setParsedSubject($this->l->t('System tag %1$s removed by the system', [
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('Removed system tag {systemtag}'), [
|
||||
'systemtag' => $parsedParameters['systemtag'],
|
||||
]);
|
||||
} else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('Removed system tag %1$s', [
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('Removed system tag {systemtag}'), [
|
||||
'systemtag' => $parsedParameters['systemtag'],
|
||||
]);
|
||||
} else {
|
||||
$event->setParsedSubject($this->l->t('%1$s removed system tag %2$s', [
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('{actor} removed system tag {systemtag}'), [
|
||||
'actor' => $parsedParameters['actor'],
|
||||
'systemtag' => $parsedParameters['systemtag'],
|
||||
|
@ -188,86 +188,86 @@ class Provider implements IProvider {
|
|||
if ($event->getSubject() === self::CREATE_TAG) {
|
||||
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('You created system tag %1$s', [
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('You created system tag {systemtag}'), $parsedParameters);
|
||||
} else {
|
||||
$event->setParsedSubject($this->l->t('%1$s created system tag %2$s', [
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('{actor} created system tag {systemtag}'), $parsedParameters);
|
||||
}
|
||||
} else if ($event->getSubject() === self::DELETE_TAG) {
|
||||
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('You deleted system tag %1$s', [
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('You deleted system tag {systemtag}'), $parsedParameters);
|
||||
} else {
|
||||
$event->setParsedSubject($this->l->t('%1$s deleted system tag %2$s', [
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('{actor} deleted system tag {systemtag}'), $parsedParameters);
|
||||
}
|
||||
} else if ($event->getSubject() === self::UPDATE_TAG) {
|
||||
if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('You updated system tag %2$s to %1$s', [
|
||||
$this->generatePlainSystemTag($parsedParameters['newsystemtag']),
|
||||
$this->generatePlainSystemTag($parsedParameters['oldsystemtag']),
|
||||
]))
|
||||
$this->generatePlainSystemTag($parsedParameters['newsystemtag']),
|
||||
$this->generatePlainSystemTag($parsedParameters['oldsystemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('You updated system tag {oldsystemtag} to {newsystemtag}'), $parsedParameters);
|
||||
} else {
|
||||
$event->setParsedSubject($this->l->t('%1$s updated system tag %3$s to %2$s', [
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['newsystemtag']),
|
||||
$this->generatePlainSystemTag($parsedParameters['oldsystemtag']),
|
||||
]))
|
||||
$parsedParameters['actor']['name'],
|
||||
$this->generatePlainSystemTag($parsedParameters['newsystemtag']),
|
||||
$this->generatePlainSystemTag($parsedParameters['oldsystemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('{actor} updated system tag {oldsystemtag} to {newsystemtag}'), $parsedParameters);
|
||||
}
|
||||
} else if ($event->getSubject() === self::ASSIGN_TAG) {
|
||||
if ($parsedParameters['actor']['id'] === '') {
|
||||
unset($parsedParameters['actor']);
|
||||
$event->setParsedSubject($this->l->t('System tag %2$s was added to %1$s by the system', [
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('System tag {systemtag} was added to {file} by the system'), $parsedParameters);
|
||||
} else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('You added system tag %2$s to %1$s', [
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('You added system tag {systemtag} to {file}'), $parsedParameters);
|
||||
} else {
|
||||
$event->setParsedSubject($this->l->t('%1$s added system tag %3$s to %2$s', [
|
||||
$parsedParameters['actor']['name'],
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['actor']['name'],
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('{actor} added system tag {systemtag} to {file}'), $parsedParameters);
|
||||
}
|
||||
} else if ($event->getSubject() === self::UNASSIGN_TAG) {
|
||||
if ($parsedParameters['actor']['id'] === '') {
|
||||
unset($parsedParameters['actor']);
|
||||
$event->setParsedSubject($this->l->t('System tag %2$s was removed from %1$s by the system', [
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('System tag {systemtag} was removed from {file} by the system'), $parsedParameters);
|
||||
} else if ($parsedParameters['actor']['id'] === $this->activityManager->getCurrentUserId()) {
|
||||
$event->setParsedSubject($this->l->t('You removed system tag %2$s from %1$s', [
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('You removed system tag {systemtag} from {file}'), $parsedParameters);
|
||||
} else {
|
||||
$event->setParsedSubject($this->l->t('%1$s removed system tag %3$s from %2$s', [
|
||||
$parsedParameters['actor']['name'],
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
$parsedParameters['actor']['name'],
|
||||
$parsedParameters['file']['path'],
|
||||
$this->generatePlainSystemTag($parsedParameters['systemtag']),
|
||||
]))
|
||||
->setRichSubject($this->l->t('{actor} removed system tag {systemtag} from {file}'), $parsedParameters);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -61,17 +61,17 @@ class SettingTest extends TestCase {
|
|||
|
||||
public function testCanChangeStream() {
|
||||
$this->assertSame(true, $this->setting->canChangeStream());
|
||||
}
|
||||
|
||||
public function testIsDefaultEnabledStream() {
|
||||
}
|
||||
|
||||
public function testIsDefaultEnabledStream() {
|
||||
$this->assertSame(true, $this->setting->isDefaultEnabledStream());
|
||||
}
|
||||
|
||||
public function testCanChangeMail() {
|
||||
}
|
||||
|
||||
public function testCanChangeMail() {
|
||||
$this->assertSame(true, $this->setting->canChangeMail());
|
||||
}
|
||||
|
||||
public function testIsDefaultEnabledMail() {
|
||||
}
|
||||
|
||||
public function testIsDefaultEnabledMail() {
|
||||
$this->assertSame(false, $this->setting->isDefaultEnabledMail());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,7 +304,7 @@ class ImageManagerTest extends TestCase {
|
|||
$this->createMock(ISimpleFolder::class),
|
||||
$this->createMock(ISimpleFolder::class),
|
||||
$this->createMock(ISimpleFolder::class)
|
||||
];
|
||||
];
|
||||
foreach ($folders as $index=>$folder) {
|
||||
$folder->expects($this->any())
|
||||
->method('getName')
|
||||
|
|
|
@ -125,13 +125,13 @@ class BackupCodesProviderTest extends TestCase {
|
|||
->willReturn([
|
||||
'twofactor_backupcodes',
|
||||
'mail',
|
||||
]);
|
||||
]);
|
||||
$this->appManager->expects($this->once())
|
||||
->method('getAppInfo')
|
||||
->with('mail')
|
||||
->willReturn([
|
||||
'two-factor-providers' => [],
|
||||
]);
|
||||
]);
|
||||
|
||||
$this->assertFalse($this->provider->isActive($user));
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class BackupCodesProviderTest extends TestCase {
|
|||
->willReturn([
|
||||
'twofactor_backupcodes',
|
||||
'twofactor_u2f',
|
||||
]);
|
||||
]);
|
||||
$this->appManager->expects($this->once())
|
||||
->method('getAppInfo')
|
||||
->with('twofactor_u2f')
|
||||
|
@ -153,7 +153,7 @@ class BackupCodesProviderTest extends TestCase {
|
|||
'two-factor-providers' => [
|
||||
'OCA\TwoFactorU2F\Provider\U2FProvider',
|
||||
],
|
||||
]);
|
||||
]);
|
||||
|
||||
$this->assertTrue($this->provider->isActive($user));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ $prefix = (string)$_POST['ldap_serverconfig_chooser'];
|
|||
// only legacy checkboxes (Advanced and Expert tab) need to be handled here,
|
||||
// the Wizard-like tabs handle it on their own
|
||||
$chkboxes = ['ldap_configuration_active', 'ldap_override_main_server',
|
||||
'ldap_turn_off_cert_check'];
|
||||
'ldap_turn_off_cert_check'];
|
||||
foreach($chkboxes as $boxid) {
|
||||
if(!isset($_POST[$boxid])) {
|
||||
$_POST[$boxid] = 0;
|
||||
|
|
|
@ -70,13 +70,13 @@ class CheckUser extends Command {
|
|||
'ocName',
|
||||
InputArgument::REQUIRED,
|
||||
'the user name as used in Nextcloud'
|
||||
)
|
||||
)
|
||||
->addOption(
|
||||
'force',
|
||||
null,
|
||||
InputOption::VALUE_NONE,
|
||||
'ignores disabled LDAP configuration'
|
||||
)
|
||||
)
|
||||
->addOption(
|
||||
'update',
|
||||
null,
|
||||
|
|
|
@ -52,7 +52,7 @@ class DeleteConfig extends Command {
|
|||
'configID',
|
||||
InputArgument::REQUIRED,
|
||||
'the configuration ID'
|
||||
)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,27 +59,27 @@ class Search extends Command {
|
|||
'search',
|
||||
InputArgument::REQUIRED,
|
||||
'the search string (can be empty)'
|
||||
)
|
||||
)
|
||||
->addOption(
|
||||
'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
|
||||
)
|
||||
)
|
||||
->addOption(
|
||||
'limit',
|
||||
null,
|
||||
InputOption::VALUE_REQUIRED,
|
||||
'limit the results. 0 means no limit, defaults to 15',
|
||||
15
|
||||
)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,17 +45,17 @@ class SetConfig extends Command {
|
|||
'configID',
|
||||
InputArgument::REQUIRED,
|
||||
'the configuration ID'
|
||||
)
|
||||
)
|
||||
->addArgument(
|
||||
'configKey',
|
||||
InputArgument::REQUIRED,
|
||||
'the configuration key'
|
||||
)
|
||||
)
|
||||
->addArgument(
|
||||
'configValue',
|
||||
InputArgument::REQUIRED,
|
||||
'the new configuration value'
|
||||
)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,13 +56,13 @@ class ShowConfig extends Command {
|
|||
'configID',
|
||||
InputArgument::OPTIONAL,
|
||||
'will show the configuration of the specified id'
|
||||
)
|
||||
)
|
||||
->addOption(
|
||||
'show-password',
|
||||
null,
|
||||
InputOption::VALUE_NONE,
|
||||
'show ldap bind password'
|
||||
)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class TestConfig extends Command {
|
|||
'configID',
|
||||
InputArgument::REQUIRED,
|
||||
'the configuration ID'
|
||||
)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ class Connection extends LDAPUtility {
|
|||
}
|
||||
|
||||
foreach(['ldapExpertUUIDUserAttr' => 'ldapUuidUserAttribute',
|
||||
'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute']
|
||||
'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute']
|
||||
as $expertSetting => $effectiveSetting) {
|
||||
$uuidOverride = $this->configuration->$expertSetting;
|
||||
if(!empty($uuidOverride)) {
|
||||
|
@ -394,7 +394,7 @@ class Connection extends LDAPUtility {
|
|||
|
||||
//make sure empty search attributes are saved as simple, empty array
|
||||
$saKeys = ['ldapAttributesForUserSearch',
|
||||
'ldapAttributesForGroupSearch'];
|
||||
'ldapAttributesForGroupSearch'];
|
||||
foreach($saKeys as $key) {
|
||||
$val = $this->configuration->$key;
|
||||
if(is_array($val) && count($val) === 1 && empty($val[0])) {
|
||||
|
@ -423,7 +423,7 @@ class Connection extends LDAPUtility {
|
|||
|
||||
//options that shall not be empty
|
||||
$options = ['ldapHost', 'ldapPort', 'ldapUserDisplayName',
|
||||
'ldapGroupDisplayName', 'ldapLoginFilter'];
|
||||
'ldapGroupDisplayName', 'ldapLoginFilter'];
|
||||
foreach($options as $key) {
|
||||
$val = $this->configuration->$key;
|
||||
if(empty($val)) {
|
||||
|
|
|
@ -707,8 +707,8 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
|||
// memberof doesn't support memberuid, so skip it here.
|
||||
if((int)$this->access->connection->hasMemberOfFilterSupport === 1
|
||||
&& (int)$this->access->connection->useMemberOfToDetectMembership === 1
|
||||
&& strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid'
|
||||
) {
|
||||
&& strtolower($this->access->connection->ldapGroupMemberAssocAttr) !== 'memberuid'
|
||||
) {
|
||||
$groupDNs = $this->_getGroupDNsFromMemberOf($userDN);
|
||||
if (is_array($groupDNs)) {
|
||||
foreach ($groupDNs as $dn) {
|
||||
|
|
|
@ -65,7 +65,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
|
|||
$userBackendFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($serverContainer->getGroupManager()->getBackends() as $backend){
|
||||
$this->logger->debug('instance '.get_class($backend).' group backend.', ['app' => 'user_ldap']);
|
||||
if ($backend instanceof IGroupLDAP) {
|
||||
|
@ -75,7 +75,7 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
|
|||
}
|
||||
}
|
||||
|
||||
if (!$userBackendFound or !$groupBackendFound) {
|
||||
if (!$userBackendFound or !$groupBackendFound) {
|
||||
throw new \Exception('To use the LDAPProvider, user_ldap app must be enabled');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,7 +329,7 @@ class User {
|
|||
//check for / at the beginning or pattern c:\ resp. c:/
|
||||
if( '/' !== $path[0]
|
||||
&& !(3 < strlen($path) && ctype_alpha($path[0])
|
||||
&& $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2]))
|
||||
&& $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2]))
|
||||
) {
|
||||
$path = $this->config->getSystemValue('datadirectory',
|
||||
\OC::$SERVERROOT.'/data' ) . '/' . $path;
|
||||
|
|
|
@ -201,10 +201,10 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function countUsersWithAttribute($attr, $existsCheck = false) {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -226,10 +226,10 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function detectUserDisplayNameAttribute() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -268,10 +268,10 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function detectEmailAttribute() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -315,10 +315,10 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function determineAttributes() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -344,10 +344,10 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
private function getUserAttributes() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
$cr = $this->getConnection();
|
||||
|
@ -400,9 +400,9 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
private function determineGroups($dbKey, $confKey, $testMemberOf = true) {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
$cr = $this->getConnection();
|
||||
|
@ -480,9 +480,9 @@ class Wizard extends LDAPUtility {
|
|||
|
||||
public function determineGroupMemberAssoc() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapGroupFilter',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapGroupFilter',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
$attribute = $this->detectGroupMemberAssoc();
|
||||
|
@ -502,9 +502,9 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function determineGroupObjectClasses() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
$cr = $this->getConnection();
|
||||
|
@ -529,9 +529,9 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function determineUserObjectClasses() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
$cr = $this->getConnection();
|
||||
|
@ -540,7 +540,7 @@ class Wizard extends LDAPUtility {
|
|||
}
|
||||
|
||||
$obclasses = ['inetOrgPerson', 'person', 'organizationalPerson',
|
||||
'user', 'posixAccount', '*'];
|
||||
'user', 'posixAccount', '*'];
|
||||
$filter = $this->configuration->ldapUserFilter;
|
||||
//if filter is empty, it is probably the first time the wizard is called
|
||||
//then, apply suggestions.
|
||||
|
@ -559,9 +559,9 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function getGroupFilter() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
//make sure the use display name is set
|
||||
|
@ -583,9 +583,9 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function getUserListFilter() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
//make sure the use display name is set
|
||||
|
@ -609,10 +609,10 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function getUserLoginFilter() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
'ldapPort',
|
||||
'ldapBase',
|
||||
'ldapUserFilter',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function guessPortAndTLS() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
])) {
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
$this->checkHost();
|
||||
|
@ -719,8 +719,8 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
public function guessBaseDN() {
|
||||
if(!$this->checkRequirements(['ldapHost',
|
||||
'ldapPort',
|
||||
])) {
|
||||
'ldapPort',
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1318,13 +1318,13 @@ class Wizard extends LDAPUtility {
|
|||
*/
|
||||
private function getDefaultLdapPortSettings() {
|
||||
static $settings = [
|
||||
['port' => 7636, 'tls' => false],
|
||||
['port' => 636, 'tls' => false],
|
||||
['port' => 7389, 'tls' => true],
|
||||
['port' => 389, 'tls' => true],
|
||||
['port' => 7389, 'tls' => false],
|
||||
['port' => 389, 'tls' => false],
|
||||
];
|
||||
['port' => 7636, 'tls' => false],
|
||||
['port' => 636, 'tls' => false],
|
||||
['port' => 7389, 'tls' => true],
|
||||
['port' => 389, 'tls' => true],
|
||||
['port' => 7389, 'tls' => false],
|
||||
['port' => 389, 'tls' => false],
|
||||
];
|
||||
return $settings;
|
||||
}
|
||||
|
||||
|
@ -1352,7 +1352,7 @@ class Wizard extends LDAPUtility {
|
|||
|
||||
//default ports
|
||||
$portSettings = array_merge($portSettings,
|
||||
$this->getDefaultLdapPortSettings());
|
||||
$this->getDefaultLdapPortSettings());
|
||||
|
||||
return $portSettings;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class ConfigurationTest extends \Test\TestCase {
|
|||
' ',
|
||||
'',
|
||||
' whats my name',
|
||||
' '
|
||||
' '
|
||||
];
|
||||
$expectedNames = ['uid', 'cn', 'whats my name'];
|
||||
|
||||
|
|
|
@ -175,8 +175,8 @@ class ExceptionOnLostConnection {
|
|||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($postData)]
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($postData)]
|
||||
);
|
||||
$recvd = curl_exec($ch);
|
||||
$this->checkCurlResult($ch, $recvd);
|
||||
|
|
|
@ -58,8 +58,8 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->setConstructorArgs(['', new \OC\Config(\OC::$configDir)])
|
||||
->getMock();
|
||||
$server->expects($this->at(1))
|
||||
->method('getBackends')
|
||||
->willReturn([$userBackend]);
|
||||
->method('getBackends')
|
||||
->willReturn([$userBackend]);
|
||||
$server->expects($this->any())
|
||||
->method('getUserManager')
|
||||
->willReturn($this->getUserManagerMock($userBackend));
|
||||
|
@ -67,8 +67,8 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->method('getGroupManager')
|
||||
->willReturn($this->getGroupManagerMock($groupBackend));
|
||||
$server->expects($this->any())
|
||||
->method($this->anything())
|
||||
->willReturnSelf();
|
||||
->method($this->anything())
|
||||
->willReturnSelf();
|
||||
|
||||
return $server;
|
||||
}
|
||||
|
@ -135,14 +135,14 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userBackend->expects($this->at(0))
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
$userBackend->expects($this->at(2))
|
||||
->method('username2dn')
|
||||
->willReturn('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org');
|
||||
->method('username2dn')
|
||||
->willReturn('cn=existing_user,ou=Are Sufficient To,ou=Test,dc=example,dc=org');
|
||||
$userBackend->expects($this->any())
|
||||
->method($this->anything())
|
||||
->willReturnSelf();
|
||||
->method($this->anything())
|
||||
->willReturnSelf();
|
||||
|
||||
$server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock());
|
||||
|
||||
|
@ -207,8 +207,8 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userBackend->expects($this->any())
|
||||
->method('dn2UserName')
|
||||
->willReturn('existing_user');
|
||||
->method('dn2UserName')
|
||||
->willReturn('existing_user');
|
||||
|
||||
$server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock());
|
||||
|
||||
|
@ -272,11 +272,11 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userBackend->expects($this->any())
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
$userBackend->expects($this->any())
|
||||
->method('getNewLDAPConnection')
|
||||
->willReturn(true);
|
||||
->method('getNewLDAPConnection')
|
||||
->willReturn(true);
|
||||
|
||||
$server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock());
|
||||
|
||||
|
@ -381,8 +381,8 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userBackend->expects($this->atLeastOnce())
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
$userBackend->expects($this->any())
|
||||
->method('getLDAPAccess')
|
||||
->willReturn($access);
|
||||
|
@ -437,8 +437,8 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userBackend->expects($this->any())
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
$userBackend->expects($this->any())
|
||||
->method('getLDAPAccess')
|
||||
->willReturn($access);
|
||||
|
@ -472,14 +472,14 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userBackend->expects($this->at(0))
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
->method('userExists')
|
||||
->willReturn(true);
|
||||
$userBackend->expects($this->at(3))
|
||||
->method('clearCache')
|
||||
->willReturn(true);
|
||||
->method('clearCache')
|
||||
->willReturn(true);
|
||||
$userBackend->expects($this->any())
|
||||
->method($this->anything())
|
||||
->willReturnSelf();
|
||||
->method($this->anything())
|
||||
->willReturnSelf();
|
||||
|
||||
$server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock());
|
||||
|
||||
|
@ -539,8 +539,8 @@ class LDAPProviderTest extends \Test\TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userBackend->expects($this->any())
|
||||
->method('dn2UserName')
|
||||
->willReturn('existing_user');
|
||||
->method('dn2UserName')
|
||||
->willReturn('existing_user');
|
||||
|
||||
$server = $this->getServerMock($userBackend, $this->getDefaultGroupBackendMock());
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class WizardTest extends TestCase {
|
|||
//we need to make sure the consts are defined, otherwise tests will fail
|
||||
//on systems without php5_ldap
|
||||
$ldapConsts = ['LDAP_OPT_PROTOCOL_VERSION',
|
||||
'LDAP_OPT_REFERRALS', 'LDAP_OPT_NETWORK_TIMEOUT'];
|
||||
'LDAP_OPT_REFERRALS', 'LDAP_OPT_NETWORK_TIMEOUT'];
|
||||
foreach($ldapConsts as $const) {
|
||||
if(!defined($const)) {
|
||||
define($const, 42);
|
||||
|
|
|
@ -19,6 +19,6 @@
|
|||
"scripts": {
|
||||
"cs:fix": "php-cs-fixer fix",
|
||||
"cs:check": "php-cs-fixer fix --dry-run",
|
||||
"lint": "find . -name \\*.php -not -path './lib/composer/*' -exec php -l \"{}\" \\;"
|
||||
"lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/.phan/*' -exec php -l \"{}\" \\;"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,8 +282,8 @@ class AvatarController extends Controller {
|
|||
$tmpAvatar = $this->cache->get('tmpAvatar');
|
||||
if (is_null($tmpAvatar)) {
|
||||
return new JSONResponse(['data' => [
|
||||
'message' => $this->l->t("No temporary profile picture available, try again")
|
||||
]],
|
||||
'message' => $this->l->t("No temporary profile picture available, try again")
|
||||
]],
|
||||
Http::STATUS_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
@ -320,8 +320,8 @@ class AvatarController extends Controller {
|
|||
$tmpAvatar = $this->cache->get('tmpAvatar');
|
||||
if (is_null($tmpAvatar)) {
|
||||
return new JSONResponse(['data' => [
|
||||
'message' => $this->l->t("No temporary profile picture available, try again")
|
||||
]],
|
||||
'message' => $this->l->t("No temporary profile picture available, try again")
|
||||
]],
|
||||
Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,8 +159,8 @@ class LostController extends Controller {
|
|||
public function resetform($token, $userId) {
|
||||
if ($this->config->getSystemValue('lost_password_link', '') !== '') {
|
||||
return new TemplateResponse('core', 'error', [
|
||||
'errors' => [['error' => $this->l10n->t('Password reset is disabled')]]
|
||||
],
|
||||
'errors' => [['error' => $this->l10n->t('Password reset is disabled')]]
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ $urlGenerator = $_['urlGenerator'];
|
|||
<h2><?php p($l->t('Connect to your account')) ?></h2>
|
||||
<p class="info">
|
||||
<?php print_unescaped($l->t('Please log in before granting %1$s access to your %2$s account.', [
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
|
|
@ -31,9 +31,9 @@ $urlGenerator = $_['urlGenerator'];
|
|||
<h2><?php p($l->t('Account access')) ?></h2>
|
||||
<p class="info">
|
||||
<?php print_unescaped($l->t('You are about to grant %1$s access to your %2$s account.', [
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
|
|
@ -30,9 +30,9 @@ $urlGenerator = $_['urlGenerator'];
|
|||
<h2><?php p($l->t('Connect to your account')) ?></h2>
|
||||
<p class="info">
|
||||
<?php print_unescaped($l->t('Please log in before granting %1$s access to your %2$s account.', [
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
|
|
@ -31,9 +31,9 @@ $urlGenerator = $_['urlGenerator'];
|
|||
<h2><?php p($l->t('Account access')) ?></h2>
|
||||
<p class="info">
|
||||
<?php print_unescaped($l->t('You are about to grant %1$s access to your %2$s account.', [
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
'<strong>' . \OCP\Util::sanitizeHTML($_['client']) . '</strong>',
|
||||
\OCP\Util::sanitizeHTML($_['instanceName'])
|
||||
])) ?>
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
|
|
@ -118,7 +118,7 @@ class Http extends BaseHttp {
|
|||
* @return string
|
||||
*/
|
||||
public function getStatusHeader($status, \DateTime $lastModified=null,
|
||||
$ETag=null) {
|
||||
$ETag=null) {
|
||||
|
||||
if(!is_null($lastModified)) {
|
||||
$lastModified = $lastModified->format(\DateTime::RFC2822);
|
||||
|
|
|
@ -101,7 +101,7 @@ class OCSMiddleware extends Middleware {
|
|||
*/
|
||||
if ($controller instanceof OCSController && !($response instanceof BaseResponse)) {
|
||||
if ($response->getStatus() === Http::STATUS_UNAUTHORIZED ||
|
||||
$response->getStatus() === Http::STATUS_FORBIDDEN) {
|
||||
$response->getStatus() === Http::STATUS_FORBIDDEN) {
|
||||
|
||||
$message = '';
|
||||
if ($response instanceof JSONResponse) {
|
||||
|
|
|
@ -212,7 +212,7 @@ class SecurityMiddleware extends Middleware {
|
|||
if($exception instanceof SecurityException) {
|
||||
if($exception instanceof StrictCookieMissingException) {
|
||||
return new RedirectResponse(\OC::$WEBROOT);
|
||||
}
|
||||
}
|
||||
if (stripos($this->request->getHeader('Accept'),'html') === false) {
|
||||
$response = new JSONResponse(
|
||||
['message' => $exception->getMessage()],
|
||||
|
|
|
@ -198,8 +198,8 @@ class Manager {
|
|||
$missing[] = $providerId;
|
||||
$this->logger->alert("two-factor auth provider '$providerId' failed to load",
|
||||
[
|
||||
'app' => 'core',
|
||||
]);
|
||||
'app' => 'core',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -300,8 +300,8 @@ class Comment implements IComment {
|
|||
*/
|
||||
public function setActor($actorType, $actorId) {
|
||||
if(
|
||||
!is_string($actorType) || !trim($actorType)
|
||||
|| !is_string($actorId) || $actorId === ''
|
||||
!is_string($actorType) || !trim($actorType)
|
||||
|| !is_string($actorId) || $actorId === ''
|
||||
) {
|
||||
throw new \InvalidArgumentException('String expected.');
|
||||
}
|
||||
|
@ -386,8 +386,8 @@ class Comment implements IComment {
|
|||
*/
|
||||
public function setObject($objectType, $objectId) {
|
||||
if(
|
||||
!is_string($objectType) || !trim($objectType)
|
||||
|| !is_string($objectId) || trim($objectId) === ''
|
||||
!is_string($objectType) || !trim($objectType)
|
||||
|| !is_string($objectId) || trim($objectId) === ''
|
||||
) {
|
||||
throw new \InvalidArgumentException('String expected.');
|
||||
}
|
||||
|
|
|
@ -53,25 +53,25 @@ class MySQLMigrator extends Migrator {
|
|||
return $schemaDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Speed up migration test by disabling autocommit and unique indexes check
|
||||
*
|
||||
* @param \Doctrine\DBAL\Schema\Table $table
|
||||
* @throws \OC\DB\MigrationException
|
||||
*/
|
||||
protected function checkTableMigrate(Table $table) {
|
||||
$this->connection->exec('SET autocommit=0');
|
||||
$this->connection->exec('SET unique_checks=0');
|
||||
/**
|
||||
* Speed up migration test by disabling autocommit and unique indexes check
|
||||
*
|
||||
* @param \Doctrine\DBAL\Schema\Table $table
|
||||
* @throws \OC\DB\MigrationException
|
||||
*/
|
||||
protected function checkTableMigrate(Table $table) {
|
||||
$this->connection->exec('SET autocommit=0');
|
||||
$this->connection->exec('SET unique_checks=0');
|
||||
|
||||
try {
|
||||
parent::checkTableMigrate($table);
|
||||
} catch (\Exception $e) {
|
||||
$this->connection->exec('SET unique_checks=1');
|
||||
$this->connection->exec('SET autocommit=1');
|
||||
throw new MigrationException($table->getName(), $e->getMessage());
|
||||
}
|
||||
$this->connection->exec('SET unique_checks=1');
|
||||
$this->connection->exec('SET autocommit=1');
|
||||
}
|
||||
try {
|
||||
parent::checkTableMigrate($table);
|
||||
} catch (\Exception $e) {
|
||||
$this->connection->exec('SET unique_checks=1');
|
||||
$this->connection->exec('SET autocommit=1');
|
||||
throw new MigrationException($table->getName(), $e->getMessage());
|
||||
}
|
||||
$this->connection->exec('SET unique_checks=1');
|
||||
$this->connection->exec('SET autocommit=1');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,14 +62,14 @@ use OCP\IDBConnection;
|
|||
*/
|
||||
class Database extends ABackend
|
||||
implements IAddToGroupBackend,
|
||||
ICountDisabledInGroup,
|
||||
ICountUsersBackend,
|
||||
ICreateGroupBackend,
|
||||
IDeleteGroupBackend,
|
||||
IGetDisplayNameBackend,
|
||||
IGroupDetailsBackend,
|
||||
IRemoveFromGroupBackend,
|
||||
ISetDisplayNameBackend {
|
||||
ICountDisabledInGroup,
|
||||
ICountUsersBackend,
|
||||
ICreateGroupBackend,
|
||||
IDeleteGroupBackend,
|
||||
IGetDisplayNameBackend,
|
||||
IGroupDetailsBackend,
|
||||
IRemoveFromGroupBackend,
|
||||
ISetDisplayNameBackend {
|
||||
|
||||
/** @var string[] */
|
||||
private $groupCache = [];
|
||||
|
|
|
@ -165,13 +165,13 @@ class MetaData {
|
|||
*/
|
||||
private function generateGroupMetaData(\OCP\IGroup $group, $userSearch) {
|
||||
return [
|
||||
'id' => $group->getGID(),
|
||||
'name' => $group->getDisplayName(),
|
||||
'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0,
|
||||
'disabled' => $group->countDisabled(),
|
||||
'canAdd' => $group->canAddUser(),
|
||||
'canRemove' => $group->canRemoveUser(),
|
||||
];
|
||||
'id' => $group->getGID(),
|
||||
'name' => $group->getDisplayName(),
|
||||
'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0,
|
||||
'disabled' => $group->countDisabled(),
|
||||
'canAdd' => $group->canAddUser(),
|
||||
'canRemove' => $group->canRemoveUser(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -239,10 +239,10 @@ class Checker {
|
|||
$signature = $privateKey->sign(json_encode($hashes));
|
||||
|
||||
return [
|
||||
'hashes' => $hashes,
|
||||
'signature' => base64_encode($signature),
|
||||
'certificate' => $certificate->saveX509($certificate->currentCert),
|
||||
];
|
||||
'hashes' => $hashes,
|
||||
'signature' => base64_encode($signature),
|
||||
'certificate' => $certificate->saveX509($certificate->currentCert),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -509,10 +509,10 @@ class Checker {
|
|||
);
|
||||
} catch (\Exception $e) {
|
||||
$result = [
|
||||
'EXCEPTION' => [
|
||||
'class' => \get_class($e),
|
||||
'message' => $e->getMessage(),
|
||||
],
|
||||
'EXCEPTION' => [
|
||||
'class' => \get_class($e),
|
||||
'message' => $e->getMessage(),
|
||||
],
|
||||
];
|
||||
}
|
||||
$this->storeResults($appId, $result);
|
||||
|
@ -559,10 +559,10 @@ class Checker {
|
|||
);
|
||||
} catch (\Exception $e) {
|
||||
$result = [
|
||||
'EXCEPTION' => [
|
||||
'class' => \get_class($e),
|
||||
'message' => $e->getMessage(),
|
||||
],
|
||||
'EXCEPTION' => [
|
||||
'class' => \get_class($e),
|
||||
'message' => $e->getMessage(),
|
||||
],
|
||||
];
|
||||
}
|
||||
$this->storeResults('core', $result);
|
||||
|
|
|
@ -330,9 +330,9 @@ class Generator {
|
|||
}
|
||||
|
||||
/*
|
||||
* Make sure the requested height and width fall within the max
|
||||
* of the preview.
|
||||
*/
|
||||
* Make sure the requested height and width fall within the max
|
||||
* of the preview.
|
||||
*/
|
||||
if ($height > $maxHeight) {
|
||||
$ratio = $height / $maxHeight;
|
||||
$height = $maxHeight;
|
||||
|
|
|
@ -99,9 +99,9 @@ class TrustedDomainHelper {
|
|||
}
|
||||
$regex = '/^' . implode('[-\.a-zA-Z0-9]*', array_map(function($v) { return preg_quote($v, '/'); }, explode('*', $trusted))) . '$/i';
|
||||
if (preg_match($regex, $domain) || preg_match($regex, $domainWithPort)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1359,7 +1359,7 @@ class Share extends Constants {
|
|||
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,'
|
||||
. '`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,'
|
||||
. '`file_source`, `path`, `file_target`, `*PREFIX*share`.`permissions`,'
|
||||
. '`stime`, `expiration`, `token`, `storage`, `mail_send`,'
|
||||
. '`stime`, `expiration`, `token`, `storage`, `mail_send`,'
|
||||
. '`*PREFIX*storages`.`id` AS `storage_id`, `*PREFIX*filecache`.`parent` as `file_parent`';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -838,7 +838,7 @@ class DefaultShareProvider implements IShareProvider {
|
|||
$pathSections = explode('/', $data['path'], 2);
|
||||
// FIXME: would not detect rare md5'd home storage case properly
|
||||
if ($pathSections[0] !== 'files'
|
||||
&& in_array(explode(':', $data['storage_string_id'], 2)[0], ['home', 'object'])) {
|
||||
&& in_array(explode(':', $data['storage_string_id'], 2)[0], ['home', 'object'])) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -961,8 +961,8 @@ class DefaultShareProvider implements IShareProvider {
|
|||
}
|
||||
|
||||
/*
|
||||
* Resolve all group shares to user specific shares
|
||||
*/
|
||||
* Resolve all group shares to user specific shares
|
||||
*/
|
||||
$shares = $this->resolveGroupShares($shares2, $userId);
|
||||
} else {
|
||||
throw new BackendError('Invalid backend');
|
||||
|
|
|
@ -932,7 +932,7 @@ class Manager implements IManager {
|
|||
|
||||
// We can only change the recipient on user shares
|
||||
if ($share->getSharedWith() !== $originalShare->getSharedWith() &&
|
||||
$share->getShareType() !== \OCP\Share::SHARE_TYPE_USER) {
|
||||
$share->getShareType() !== \OCP\Share::SHARE_TYPE_USER) {
|
||||
throw new \InvalidArgumentException('Can only update recipient on user shares');
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class SubAdmin extends PublicEmitter implements ISubAdmin {
|
|||
* @param IDBConnection $dbConn
|
||||
*/
|
||||
public function __construct(IUserManager $userManager,
|
||||
IGroupManager $groupManager,
|
||||
IGroupManager $groupManager,
|
||||
IDBConnection $dbConn) {
|
||||
$this->userManager = $userManager;
|
||||
$this->groupManager = $groupManager;
|
||||
|
|
|
@ -65,11 +65,11 @@ class Tag extends Entity {
|
|||
*/
|
||||
public function columnToProperty($columnName){
|
||||
if ($columnName === 'category') {
|
||||
return 'name';
|
||||
return 'name';
|
||||
} elseif ($columnName === 'uid') {
|
||||
return 'owner';
|
||||
return 'owner';
|
||||
} else {
|
||||
return parent::columnToProperty($columnName);
|
||||
return parent::columnToProperty($columnName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,11 +81,11 @@ class Tag extends Entity {
|
|||
*/
|
||||
public function propertyToColumn($property){
|
||||
if ($property === 'name') {
|
||||
return 'category';
|
||||
return 'category';
|
||||
} elseif ($property === 'owner') {
|
||||
return 'uid';
|
||||
return 'uid';
|
||||
} else {
|
||||
return parent::propertyToColumn($property);
|
||||
return parent::propertyToColumn($property);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -504,7 +504,7 @@ class Tags implements ITags {
|
|||
'objid' => $relation['objid'],
|
||||
'categoryid' => $tagId,
|
||||
'type' => $this->type,
|
||||
]);
|
||||
]);
|
||||
} catch(\Exception $e) {
|
||||
\OC::$server->getLogger()->logException($e, [
|
||||
'message' => __METHOD__,
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue