diff --git a/.mailmap b/.mailmap index b96269235cf4f..41d9ad6e582eb 100644 --- a/.mailmap +++ b/.mailmap @@ -182,7 +182,8 @@ Jesús Macias Jesus Macias jknockaert Joan Joar Wandborg -Joas Schilling Joas Schilling +Joas Schilling Joas Schilling +Joas Schilling Joas Schilling joel hansson Johan Björk Johannes Twittmann diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index ce4940829761d..565ad0ec663a9 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1079,22 +1079,27 @@ function createSubscription($principalUri, $uri, array $properties) { 'lastmodified' => time(), ]; - foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { - if (isset($properties[$xmlName])) { + $propertiesBoolean = ['striptodos', 'stripalarms', 'stripattachments']; - $values[$dbName] = $properties[$xmlName]; - $fieldNames[] = $dbName; + foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) { + if (array_key_exists($xmlName, $properties)) { + $values[$dbName] = $properties[$xmlName]; + if (in_array($dbName, $propertiesBoolean)) { + $values[$dbName] = true; + } } } + $valuesToInsert = array(); + $query = $this->db->getQueryBuilder(); + + foreach (array_keys($values) as $name) { + $valuesToInsert[$name] = $query->createNamedParameter($values[$name]); + } + $query->insert('calendarsubscriptions') - ->values([ - 'principaluri' => $query->createNamedParameter($values['principaluri']), - 'uri' => $query->createNamedParameter($values['uri']), - 'source' => $query->createNamedParameter($values['source']), - 'lastmodified' => $query->createNamedParameter($values['lastmodified']), - ]) + ->values($valuesToInsert) ->execute(); return $this->db->lastInsertId('*PREFIX*calendarsubscriptions'); diff --git a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php index 977bdf15c8e3b..baa8540c43cf3 100644 --- a/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php +++ b/apps/dav/tests/unit/CalDAV/CalDavBackendTest.php @@ -333,15 +333,20 @@ public function testSyncSupport() { public function testSubscriptions() { $id = $this->backend->createSubscription(self::UNIT_TEST_USER, 'Subscription', [ - '{http://calendarserver.org/ns/}source' => new Href('test-source') + '{http://calendarserver.org/ns/}source' => new Href('test-source'), + '{http://apple.com/ns/ical/}calendar-color' => '#1C4587', + '{http://calendarserver.org/ns/}subscribed-strip-todos' => '' ]); $subscriptions = $this->backend->getSubscriptionsForUser(self::UNIT_TEST_USER); $this->assertEquals(1, count($subscriptions)); + $this->assertEquals('#1C4587', $subscriptions[0]['{http://apple.com/ns/ical/}calendar-color']); + $this->assertEquals(true, $subscriptions[0]['{http://calendarserver.org/ns/}subscribed-strip-todos']); $this->assertEquals($id, $subscriptions[0]['id']); $patch = new PropPatch([ '{DAV:}displayname' => 'Unit test', + '{http://apple.com/ns/ical/}calendar-color' => '#ac0606', ]); $this->backend->updateSubscription($id, $patch); $patch->commit(); @@ -350,6 +355,7 @@ public function testSubscriptions() { $this->assertEquals(1, count($subscriptions)); $this->assertEquals($id, $subscriptions[0]['id']); $this->assertEquals('Unit test', $subscriptions[0]['{DAV:}displayname']); + $this->assertEquals('#ac0606', $subscriptions[0]['{http://apple.com/ns/ical/}calendar-color']); $this->backend->deleteSubscription($id); $subscriptions = $this->backend->getSubscriptionsForUser(self::UNIT_TEST_USER); diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index 40e2e8a472f9d..1ea31f2dbc038 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -217,28 +217,32 @@ protected function createFederatedShare(IShare $share) { $share->getPermissions(), $token ); - $sharedByFederatedId = $share->getSharedBy(); - if ($this->userManager->userExists($sharedByFederatedId)) { - $sharedByFederatedId = $sharedByFederatedId . '@' . $this->addressHandler->generateRemoteURL(); - } - $send = $this->notifications->sendRemoteShare( - $token, - $share->getSharedWith(), - $share->getNode()->getName(), - $shareId, - $share->getShareOwner(), - $share->getShareOwner() . '@' . $this->addressHandler->generateRemoteURL(), - $share->getSharedBy(), - $sharedByFederatedId - ); - if ($send === false) { - $data = $this->getRawShare($shareId); - $share = $this->createShareObject($data); - $this->removeShareFromTable($share); - $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.', - [$share->getNode()->getName(), $share->getSharedWith()]); - throw new \Exception($message_t); + try { + $sharedByFederatedId = $share->getSharedBy(); + if ($this->userManager->userExists($sharedByFederatedId)) { + $sharedByFederatedId = $sharedByFederatedId . '@' . $this->addressHandler->generateRemoteURL(); + } + $send = $this->notifications->sendRemoteShare( + $token, + $share->getSharedWith(), + $share->getNode()->getName(), + $shareId, + $share->getShareOwner(), + $share->getShareOwner() . '@' . $this->addressHandler->generateRemoteURL(), + $share->getSharedBy(), + $sharedByFederatedId + ); + + if ($send === false) { + $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable.', + [$share->getNode()->getName(), $share->getSharedWith()]); + throw new \Exception($message_t); + } + } catch (\Exception $e) { + $this->logger->error('Failed to notify remote server of federated share, removing share (' . $e->getMessage() . ')'); + $this->removeShareFromTableById($shareId); + throw $e; } return $shareId; @@ -526,13 +530,22 @@ protected function revokeShare($share, $isOwner) { * @param IShare $share */ public function removeShareFromTable(IShare $share) { + $this->removeShareFromTableById($share->getId()); + } + + /** + * remove share from table + * + * @param string $shareId + */ + private function removeShareFromTableById($shareId) { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share') - ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))); + ->where($qb->expr()->eq('id', $qb->createNamedParameter($shareId))); $qb->execute(); $qb->delete('federated_reshares') - ->where($qb->expr()->eq('share_id', $qb->createNamedParameter($share->getId()))); + ->where($qb->expr()->eq('share_id', $qb->createNamedParameter($shareId))); $qb->execute(); } diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 6792e534cc6ef..8c5efdab7b00e 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -217,10 +217,6 @@ public function testCreateCouldNotFindServer() { 'sharedBy@http://localhost/' )->willReturn(false); - $this->rootFolder->expects($this->once()) - ->method('getUserFolder') - ->with('shareOwner') - ->will($this->returnSelf()); $this->rootFolder->method('getById') ->with('42') ->willReturn([$node]); @@ -244,6 +240,62 @@ public function testCreateCouldNotFindServer() { $this->assertFalse($data); } + public function testCreateException() { + $share = $this->shareManager->newShare(); + + $node = $this->getMock('\OCP\Files\File'); + $node->method('getId')->willReturn(42); + $node->method('getName')->willReturn('myFile'); + + $share->setSharedWith('user@server.com') + ->setSharedBy('sharedBy') + ->setShareOwner('shareOwner') + ->setPermissions(19) + ->setNode($node); + + $this->tokenHandler->method('generateToken')->willReturn('token'); + + $this->addressHandler->expects($this->any())->method('generateRemoteURL') + ->willReturn('http://localhost/'); + $this->addressHandler->expects($this->any())->method('splitUserRemote') + ->willReturn(['user', 'server.com']); + + $this->notifications->expects($this->once()) + ->method('sendRemoteShare') + ->with( + $this->equalTo('token'), + $this->equalTo('user@server.com'), + $this->equalTo('myFile'), + $this->anything(), + 'shareOwner', + 'shareOwner@http://localhost/', + 'sharedBy', + 'sharedBy@http://localhost/' + )->willThrowException(new \Exception('dummy')); + + $this->rootFolder->method('getById') + ->with('42') + ->willReturn([$node]); + + try { + $share = $this->provider->create($share); + $this->fail(); + } catch (\Exception $e) { + $this->assertEquals('dummy', $e->getMessage()); + } + + $qb = $this->connection->getQueryBuilder(); + $stmt = $qb->select('*') + ->from('share') + ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) + ->execute(); + + $data = $stmt->fetch(); + $stmt->closeCursor(); + + $this->assertFalse($data); + } + public function testCreateShareWithSelf() { $share = $this->shareManager->newShare(); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 593f182cf7317..cb0df9eaf20e2 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -513,7 +513,7 @@ * Event handler for when the URL changed */ _onUrlChanged: function(e) { - if (e && e.dir) { + if (e && _.isString(e.dir)) { this.changeDirectory(e.dir, false, true); } }, @@ -1397,6 +1397,16 @@ return OC.linkTo('files', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/'); }, + _isValidPath: function(path) { + var sections = path.split('/'); + for (var i = 0; i < sections.length; i++) { + if (sections[i] === '..') { + return false; + } + } + return true; + }, + /** * Sets the current directory name and updates the breadcrumb. * @param targetDir directory to display @@ -1404,7 +1414,11 @@ * @param {string} [fileId] file id */ _setCurrentDir: function(targetDir, changeUrl, fileId) { - targetDir = targetDir.replace(/\\/g, '/').replace(/\/\.\.\//g, '/'); + targetDir = targetDir.replace(/\\/g, '/'); + if (!this._isValidPath(targetDir)) { + targetDir = '/'; + changeUrl = true; + } var previousDir = this.getCurrentDirectory(), baseDir = OC.basename(targetDir); @@ -1415,6 +1429,9 @@ this.setPageTitle(); } + if (targetDir.length > 0 && targetDir[0] !== '/') { + targetDir = '/' + targetDir; + } this._currentDirectory = targetDir; // legacy stuff diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 453f1cafcafcd..98511fd3d64de 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -1334,13 +1334,32 @@ describe('OCA.Files.FileList tests', function() { fileList.changeDirectory('/another\\subdir'); expect(fileList.getCurrentDirectory()).toEqual('/another/subdir'); }); - it('converts backslashes to slashes and removes traversals when calling changeDirectory()', function() { - fileList.changeDirectory('/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../'); - expect(fileList.getCurrentDirectory()).toEqual('/another/subdir/foo/bar/file/folder/'); + it('switches to root dir when current directory is invalid', function() { + _.each([ + '..', + '/..', + '../', + '/../', + '/../abc', + '/abc/..', + '/abc/../', + '/../abc/', + '/another\\subdir/../foo\\../bar\\..\\file/..\\folder/../' + ], function(path) { + fileList.changeDirectory(path); + expect(fileList.getCurrentDirectory()).toEqual('/'); + }); }); - it('does not convert folders with a ".." in the name', function() { - fileList.changeDirectory('/abc../def'); - expect(fileList.getCurrentDirectory()).toEqual('/abc../def'); + it('allows paths with dotdot at the beginning or end', function() { + _.each([ + '/..abc', + '/def..', + '/...', + '/abc../def' + ], function(path) { + fileList.changeDirectory(path); + expect(fileList.getCurrentDirectory()).toEqual(path); + }); }); it('switches to root dir when current directory does not exist', function() { fileList.changeDirectory('/unexist'); @@ -1404,6 +1423,12 @@ describe('OCA.Files.FileList tests', function() { setDirSpy.restore(); getFolderContentsStub.restore(); }); + it('prepends a slash to directory if none was given', function() { + fileList.changeDirectory(''); + expect(fileList.getCurrentDirectory()).toEqual('/'); + fileList.changeDirectory('noslash'); + expect(fileList.getCurrentDirectory()).toEqual('/noslash'); + }); }); describe('breadcrumb events', function() { var deferredList; diff --git a/apps/files_external/lib/Command/Backends.php b/apps/files_external/lib/Command/Backends.php index 260ea210397ed..d1da6db3f6a6e 100644 --- a/apps/files_external/lib/Command/Backends.php +++ b/apps/files_external/lib/Command/Backends.php @@ -98,15 +98,30 @@ private function serializeAuthBackend(\JsonSerializable $backend) { $result = [ 'name' => $data['name'], 'identifier' => $data['identifier'], - 'configuration' => array_map(function (DefinitionParameter $parameter) { - return $parameter->getTypeName(); - }, $data['configuration']) + 'configuration' => $this->formatConfiguration($data['configuration']) ]; if ($backend instanceof Backend) { $result['storage_class'] = $backend->getStorageClass(); $authBackends = $this->backendService->getAuthMechanismsByScheme(array_keys($backend->getAuthSchemes())); $result['supported_authentication_backends'] = array_keys($authBackends); + $authConfig = array_map(function (AuthMechanism $auth) { + return $this->serializeAuthBackend($auth)['configuration']; + }, $authBackends); + $result['authentication_configuration'] = array_combine(array_keys($authBackends), $authConfig); } return $result; } + + /** + * @param DefinitionParameter[] $parameters + * @return string[] + */ + private function formatConfiguration(array $parameters) { + $configuration = array_filter($parameters, function (DefinitionParameter $parameter) { + return $parameter->getType() !== DefinitionParameter::VALUE_HIDDEN; + }); + return array_map(function (DefinitionParameter $parameter) { + return $parameter->getTypeName(); + }, $configuration); + } } diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index da0f957ed99b8..dccd6027b02d6 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -79,6 +79,42 @@ var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE; $tr.attr('data-permissions', permission); } + + // add row with expiration date for link only shares - influenced by _createRow of filelist + if (this._linksOnly) { + var expirationTimestamp = 0; + if(fileData.shares[0].expiration !== null) { + expirationTimestamp = moment(fileData.shares[0].expiration).valueOf(); + } + $tr.attr('data-expiration', expirationTimestamp); + + // date column (1000 milliseconds to seconds, 60 seconds, 60 minutes, 24 hours) + // difference in days multiplied by 5 - brightest shade for expiry dates in more than 32 days (160/5) + var modifiedColor = Math.round((expirationTimestamp - (new Date()).getTime()) / 1000 / 60 / 60 / 24 * 5); + // ensure that the brightest color is still readable + if (modifiedColor >= 160) { + modifiedColor = 160; + } + + if (expirationTimestamp > 0) { + formatted = OC.Util.formatDate(expirationTimestamp); + text = OC.Util.relativeModifiedDate(expirationTimestamp); + } else { + formatted = t('files_sharing', 'No expiration date set'); + text = ''; + modifiedColor = 160; + } + td = $('').attr({"class": "date"}); + td.append($('').attr({ + "class": "modified", + "title": formatted, + "style": 'color:rgb(' + modifiedColor + ',' + modifiedColor + ',' + modifiedColor + ')' + }).text(text) + .tooltip({placement: 'top'}) + ); + + $tr.append(td); + } return $tr; }, @@ -98,6 +134,11 @@ // root has special permissions this.$el.find('#emptycontent').toggleClass('hidden', !this.isEmpty); this.$el.find('#filestable thead th').toggleClass('hidden', this.isEmpty); + + // hide expiration date header for non link only shares + if (!this._linksOnly) { + this.$el.find('th.column-expiration').addClass('hidden'); + } } else { OCA.Files.FileList.prototype.updateEmptyContent.apply(this, arguments); @@ -249,6 +290,7 @@ type: share.share_type, target: share.share_with, stime: share.stime * 1000, + expiration: share.expiration, }; if (self._sharedWithUser) { file.shareOwner = share.displayname_owner; diff --git a/apps/files_sharing/templates/list.php b/apps/files_sharing/templates/list.php index fa0365c749c42..f59cb7653d888 100644 --- a/apps/files_sharing/templates/list.php +++ b/apps/files_sharing/templates/list.php @@ -22,6 +22,9 @@ t( 'Share time' )); ?> + + t( 'Expiration date' )); ?> + diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index f69098cde7b01..90d9f0a8567eb 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -30,6 +30,9 @@ use OCP\Share\IManager; use OCP\Files\Mount\IMountPoint; +/** + * @group DB + */ class MountProviderTest extends \Test\TestCase { /** @var MountProvider */ diff --git a/apps/files_sharing/tests/js/sharedfilelistSpec.js b/apps/files_sharing/tests/js/sharedfilelistSpec.js index 0b0676a19e638..f177b61c78a04 100644 --- a/apps/files_sharing/tests/js/sharedfilelistSpec.js +++ b/apps/files_sharing/tests/js/sharedfilelistSpec.js @@ -38,6 +38,9 @@ describe('OCA.Sharing.FileList tests', function() { '' + '' + '' + + '' + + 'Expiration date' + + '' + '' + '' + '' + @@ -512,6 +515,9 @@ describe('OCA.Sharing.FileList tests', function() { fileList.reload(); + var expirationDateInADay = moment() + .add(1, 'days').format('YYYY-MM-DD HH:mm:ss'); + /* jshint camelcase: false */ ocsResponse = { ocs: { @@ -528,12 +534,28 @@ describe('OCA.Sharing.FileList tests', function() { path: '/local path/local name.txt', permissions: 1, stime: 11111, + expiration: null, share_type: OC.Share.SHARE_TYPE_LINK, share_with: null, token: 'abc', mimetype: 'text/plain', uid_owner: 'user1', displayname_owner: 'User One' + },{ + id: 8, + item_type: 'file', + item_source: 50, + file_source: 50, + path: '/local path2/local name2.txt', + permissions: 1, + stime: 11112, + expiration: expirationDateInADay, + share_type: OC.Share.SHARE_TYPE_LINK, + share_with: null, + token: 'abcd', + mimetype: 'text/plain2', + uid_owner: 'user2', + displayname_owner: 'User One2' }] } }; @@ -570,10 +592,10 @@ describe('OCA.Sharing.FileList tests', function() { JSON.stringify(ocsResponse) ); - // only renders the link share entry + // only renders the link share entries var $rows = fileList.$el.find('tbody tr'); var $tr = $rows.eq(0); - expect($rows.length).toEqual(1); + expect($rows.length).toEqual(2); expect($tr.attr('data-id')).toEqual('49'); expect($tr.attr('data-type')).toEqual('file'); expect($tr.attr('data-file')).toEqual('local name.txt'); @@ -588,8 +610,17 @@ describe('OCA.Sharing.FileList tests', function() { expect($tr.find('a.name').attr('href')).toEqual( OC.webroot + '/remote.php/webdav/local%20path/local%20name.txt' ); + expect($tr.attr('data-expiration')).toEqual('0'); + expect($tr.find('td:last-child span').text()).toEqual(''); expect($tr.find('.nametext').text().trim()).toEqual('local name.txt'); + + // change to next row + $tr = $rows.eq(1); + expect($tr.attr('data-id')).toEqual('50'); + expect($tr.attr('data-file')).toEqual('local name2.txt'); + expect($tr.attr('data-expiration')).not.toEqual('0'); + expect($tr.find('td:last-child span').text()).toEqual('in a day'); }); it('does not show virtual token recipient as recipient when password was set', function() { /* jshint camelcase: false */ @@ -613,7 +644,7 @@ describe('OCA.Sharing.FileList tests', function() { // only renders the link share entry var $rows = fileList.$el.find('tbody tr'); var $tr = $rows.eq(0); - expect($rows.length).toEqual(1); + expect($rows.length).toEqual(2); expect($tr.attr('data-id')).toEqual('49'); expect($tr.attr('data-type')).toEqual('file'); expect($tr.attr('data-file')).toEqual('local name.txt'); diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php index f0cd9d6531052..cd4830d546966 100644 --- a/apps/files_versions/lib/Storage.php +++ b/apps/files_versions/lib/Storage.php @@ -645,7 +645,7 @@ protected static function getAutoExpireList($time, $versions) { //distance between two version too small, mark to delete $toDelete[$key] = $version['path'] . '.v' . $version['version']; $size += $version['size']; - \OCP\Util::writeLog('files_versions', 'Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, \OCP\Util::DEBUG); + \OCP\Util::writeLog('files_versions', 'Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, \OCP\Util::INFO); } else { $nextVersion = $version['version'] - $step; $prevTimestamp = $version['version']; @@ -766,7 +766,7 @@ public static function expire($filename) { self::deleteVersion($versionsFileview, $path); \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED)); unset($allVersions[$key]); // update array with the versions we keep - \OCP\Util::writeLog('files_versions', "Expire: " . $path, \OCP\Util::DEBUG); + \OCP\Util::writeLog('files_versions', "Expire: " . $path, \OCP\Util::INFO); } // Check if enough space is available after versions are rearranged. @@ -782,7 +782,7 @@ public static function expire($filename) { \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED)); self::deleteVersion($versionsFileview, $version['path'] . '.v' . $version['version']); \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED)); - \OCP\Util::writeLog('files_versions', 'running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'] , \OCP\Util::DEBUG); + \OCP\Util::writeLog('files_versions', 'running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'] , \OCP\Util::INFO); $versionsSize -= $version['size']; $availableSpace += $version['size']; next($allVersions); diff --git a/apps/user_ldap/lib/User/Manager.php b/apps/user_ldap/lib/User/Manager.php index 55d7ac8a81c8d..767a2351aebf3 100644 --- a/apps/user_ldap/lib/User/Manager.php +++ b/apps/user_ldap/lib/User/Manager.php @@ -25,6 +25,7 @@ namespace OCA\User_LDAP\User; +use OC\Cache\CappedMemoryCache; use OCA\User_LDAP\LogWrapper; use OCA\User_LDAP\FilesystemHelper; use OCP\IAvatarManager; @@ -62,14 +63,13 @@ class Manager { protected $avatarManager; /** - * array['byDN'] \OCA\User_LDAP\User\User[] - * ['byUid'] \OCA\User_LDAP\User\User[] - * @var array $users + * @var CappedMemoryCache $usersByDN */ - protected $users = array( - 'byDN' => array(), - 'byUid' => array(), - ); + protected $usersByDN; + /** + * @var CappedMemoryCache $usersByUid + */ + protected $usersByUid; /** * @param IConfig $ocConfig @@ -93,6 +93,8 @@ public function __construct(IConfig $ocConfig, $this->image = $image; $this->db = $db; $this->userManager = $userManager; + $this->usersByDN = new CappedMemoryCache(); + $this->usersByUid = new CappedMemoryCache(); } /** @@ -116,8 +118,8 @@ private function createAndCache($dn, $uid) { $user = new User($uid, $dn, $this->access, $this->ocConfig, $this->ocFilesystem, clone $this->image, $this->ocLog, $this->avatarManager, $this->userManager); - $this->users['byDN'][$dn] = $user; - $this->users['byUid'][$uid] = $user; + $this->usersByDN[$dn] = $user; + $this->usersByUid[$uid] = $user; return $user; } @@ -219,10 +221,10 @@ protected function createInstancyByUserName($id) { */ public function get($id) { $this->checkAccess(); - if(isset($this->users['byDN'][$id])) { - return $this->users['byDN'][$id]; - } else if(isset($this->users['byUid'][$id])) { - return $this->users['byUid'][$id]; + if(isset($this->usersByDN[$id])) { + return $this->usersByDN[$id]; + } else if(isset($this->usersByUid[$id])) { + return $this->usersByUid[$id]; } if($this->access->stringResemblesDN($id) ) { diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 230c82a304559..7929394893b25 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -228,6 +228,10 @@ public function userExistsOnLDAP($user) { return false; } $newDn = $this->access->getUserDnByUuid($uuid); + //check if renamed user is still valid by reapplying the ldap filter + if(!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) { + return false; + } $this->access->getUserMapper()->setDNbyUUID($newDn, $uuid); return true; } catch (\Exception $e) { diff --git a/apps/user_ldap/templates/part.settingcontrols.php b/apps/user_ldap/templates/part.settingcontrols.php index 4dc57eae6d204..3f7a53dd4dc28 100644 --- a/apps/user_ldap/templates/part.settingcontrols.php +++ b/apps/user_ldap/templates/part.settingcontrols.php @@ -4,7 +4,7 @@ - t('Help'));?> diff --git a/apps/user_ldap/templates/part.wizardcontrols.php b/apps/user_ldap/templates/part.wizardcontrols.php index 4760aa0d8ef0f..2df1fd8d83f63 100644 --- a/apps/user_ldap/templates/part.wizardcontrols.php +++ b/apps/user_ldap/templates/part.wizardcontrols.php @@ -10,7 +10,7 @@ - t('Help'));?> diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature index 3878e741f60e2..18dc3447594f6 100644 --- a/build/integration/features/sharing-v1.feature +++ b/build/integration/features/sharing-v1.feature @@ -26,6 +26,21 @@ Feature: sharing Then the OCS status code should be "100" And the HTTP status code should be "200" + Scenario: Creating a new share with user who already received a share through their group + Given As an "admin" + And user "user0" exists + And user "user1" exists + And group "sharing-group" exists + And user "user1" belongs to group "sharing-group" + And file "welcome.txt" of user "user0" is shared with group "sharing-group" + And As an "user0" + Then sending "POST" to "/apps/files_sharing/api/v1/shares" with + | path | welcome.txt | + | shareWith | user1 | + | shareType | 0 | + Then the OCS status code should be "100" + And the HTTP status code should be "200" + Scenario: Creating a new public share Given user "user0" exists And As an "user0" diff --git a/core/Application.php b/core/Application.php index 8ea2672e54ea8..a87917b626a2c 100644 --- a/core/Application.php +++ b/core/Application.php @@ -32,7 +32,6 @@ use OC\Core\Controller\AvatarController; use OC\Core\Controller\LoginController; use OC\Core\Controller\LostController; -use OC\Core\Controller\OccController; use OC\Core\Controller\TokenController; use OC\Core\Controller\TwoFactorChallengeController; use OC\Core\Controller\UserController; @@ -126,18 +125,6 @@ public function __construct(array $urlParams=array()){ $c->query('SecureRandom') ); }); - $container->registerService('OccController', function(SimpleContainer $c) { - return new OccController( - $c->query('AppName'), - $c->query('Request'), - $c->query('Config'), - new \OC\Console\Application( - $c->query('Config'), - $c->query('ServerContainer')->getEventDispatcher(), - $c->query('Request') - ) - ); - }); /** * Core class wrappers diff --git a/core/Controller/OccController.php b/core/Controller/OccController.php deleted file mode 100644 index 917d02f37f19c..0000000000000 --- a/core/Controller/OccController.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see - * - */ - -namespace OC\Core\Controller; - -use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\JSONResponse; -use OC\Console\Application; -use OCP\IConfig; -use OCP\IRequest; -use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Output\BufferedOutput; - -class OccController extends Controller { - - /** @var array */ - private $allowedCommands = [ - 'app:disable', - 'app:enable', - 'app:getpath', - 'app:list', - 'check', - 'config:list', - 'maintenance:mode', - 'status', - 'upgrade' - ]; - - /** @var IConfig */ - private $config; - /** @var Application */ - private $console; - - /** - * OccController constructor. - * - * @param string $appName - * @param IRequest $request - * @param IConfig $config - * @param Application $console - */ - public function __construct($appName, IRequest $request, - IConfig $config, Application $console) { - parent::__construct($appName, $request); - $this->config = $config; - $this->console = $console; - } - - /** - * @PublicPage - * @NoCSRFRequired - * - * Execute occ command - * Sample request - * POST http://domain.tld/index.php/occ/status', - * { - * 'params': { - * '--no-warnings':'1', - * '--output':'json' - * }, - * 'token': 'someToken' - * } - * - * @param string $command - * @param string $token - * @param array $params - * - * @return JSONResponse - * @throws \Exception - */ - public function execute($command, $token, $params = []) { - try { - $this->validateRequest($command, $token); - - $output = new BufferedOutput(); - $formatter = $output->getFormatter(); - $formatter->setDecorated(false); - $this->console->setAutoExit(false); - $this->console->loadCommands(new ArrayInput([]), $output); - - $inputArray = array_merge(['command' => $command], $params); - $input = new ArrayInput($inputArray); - - $exitCode = $this->console->run($input, $output); - $response = $output->fetch(); - - $json = [ - 'exitCode' => $exitCode, - 'response' => $response - ]; - - } catch (\UnexpectedValueException $e){ - $json = [ - 'exitCode' => 126, - 'response' => 'Not allowed', - 'details' => $e->getMessage() - ]; - } - return new JSONResponse($json); - } - - /** - * Check if command is allowed and has a valid security token - * @param $command - * @param $token - */ - protected function validateRequest($command, $token){ - if (!in_array($this->request->getRemoteAddress(), ['::1', '127.0.0.1', 'localhost'])) { - throw new \UnexpectedValueException('Web executor is not allowed to run from a different host'); - } - - if (!in_array($command, $this->allowedCommands)) { - throw new \UnexpectedValueException(sprintf('Command "%s" is not allowed to run via web request', $command)); - } - - $coreToken = $this->config->getSystemValue('updater.secret', ''); - if ($coreToken === '') { - throw new \UnexpectedValueException( - 'updater.secret is undefined in config/config.php. Either browse the admin settings in your ownCloud and click "Open updater" or define a strong secret using
php -r \'echo password_hash("MyStrongSecretDoUseYourOwn!", PASSWORD_DEFAULT)."\n";\'
and set this in the config.php.' - ); - } - - if (!password_verify($token, $coreToken)) { - throw new \UnexpectedValueException( - 'updater.secret does not match the provided token' - ); - } - } -} diff --git a/core/img/actions/add.png b/core/img/actions/add.png deleted file mode 100644 index 8ae17cfe11b43..0000000000000 Binary files a/core/img/actions/add.png and /dev/null differ diff --git a/core/img/actions/caret-dark.png b/core/img/actions/caret-dark.png deleted file mode 100644 index 97c64c6a7203c..0000000000000 Binary files a/core/img/actions/caret-dark.png and /dev/null differ diff --git a/core/img/actions/caret.png b/core/img/actions/caret.png deleted file mode 100644 index 3a8dd99176d69..0000000000000 Binary files a/core/img/actions/caret.png and /dev/null differ diff --git a/core/img/actions/checkbox-checked-disabled.png b/core/img/actions/checkbox-checked-disabled.png deleted file mode 100644 index 55980ba730d19..0000000000000 Binary files a/core/img/actions/checkbox-checked-disabled.png and /dev/null differ diff --git a/core/img/actions/checkbox-checked-white.png b/core/img/actions/checkbox-checked-white.png deleted file mode 100644 index ed8e3d3d5579d..0000000000000 Binary files a/core/img/actions/checkbox-checked-white.png and /dev/null differ diff --git a/core/img/actions/checkbox-checked.png b/core/img/actions/checkbox-checked.png deleted file mode 100644 index 58e9f8ba00b19..0000000000000 Binary files a/core/img/actions/checkbox-checked.png and /dev/null differ diff --git a/core/img/actions/checkbox-disabled-white.png b/core/img/actions/checkbox-disabled-white.png deleted file mode 100644 index e1f48439d270f..0000000000000 Binary files a/core/img/actions/checkbox-disabled-white.png and /dev/null differ diff --git a/core/img/actions/checkbox-disabled.png b/core/img/actions/checkbox-disabled.png deleted file mode 100644 index a2ead20996562..0000000000000 Binary files a/core/img/actions/checkbox-disabled.png and /dev/null differ diff --git a/core/img/actions/checkbox-mixed-white.png b/core/img/actions/checkbox-mixed-white.png deleted file mode 100644 index 0b81f998fc599..0000000000000 Binary files a/core/img/actions/checkbox-mixed-white.png and /dev/null differ diff --git a/core/img/actions/checkbox-mixed.png b/core/img/actions/checkbox-mixed.png deleted file mode 100644 index cc27ec651eaf2..0000000000000 Binary files a/core/img/actions/checkbox-mixed.png and /dev/null differ diff --git a/core/img/actions/checkbox-white.png b/core/img/actions/checkbox-white.png deleted file mode 100644 index f0f903c77c6fa..0000000000000 Binary files a/core/img/actions/checkbox-white.png and /dev/null differ diff --git a/core/img/actions/checkbox.png b/core/img/actions/checkbox.png deleted file mode 100644 index 770b7ef82037f..0000000000000 Binary files a/core/img/actions/checkbox.png and /dev/null differ diff --git a/core/img/actions/checkmark-color.png b/core/img/actions/checkmark-color.png deleted file mode 100644 index a8ab849cad726..0000000000000 Binary files a/core/img/actions/checkmark-color.png and /dev/null differ diff --git a/core/img/actions/checkmark-white.png b/core/img/actions/checkmark-white.png deleted file mode 100644 index 27f17204b1da7..0000000000000 Binary files a/core/img/actions/checkmark-white.png and /dev/null differ diff --git a/core/img/actions/checkmark.png b/core/img/actions/checkmark.png deleted file mode 100644 index c1a8be786cd59..0000000000000 Binary files a/core/img/actions/checkmark.png and /dev/null differ diff --git a/core/img/actions/close.png b/core/img/actions/close.png deleted file mode 100644 index 66e3c26cc65a1..0000000000000 Binary files a/core/img/actions/close.png and /dev/null differ diff --git a/core/img/actions/comment.png b/core/img/actions/comment.png deleted file mode 100644 index 08867cf6361ef..0000000000000 Binary files a/core/img/actions/comment.png and /dev/null differ diff --git a/core/img/actions/confirm.png b/core/img/actions/confirm.png deleted file mode 100644 index 3021d4c27d6db..0000000000000 Binary files a/core/img/actions/confirm.png and /dev/null differ diff --git a/core/img/actions/delete-hover.png b/core/img/actions/delete-hover.png deleted file mode 100644 index ed12640df7133..0000000000000 Binary files a/core/img/actions/delete-hover.png and /dev/null differ diff --git a/core/img/actions/delete-white.png b/core/img/actions/delete-white.png deleted file mode 100644 index 07a5de3425268..0000000000000 Binary files a/core/img/actions/delete-white.png and /dev/null differ diff --git a/core/img/actions/delete.png b/core/img/actions/delete.png deleted file mode 100644 index 20e894c7f740d..0000000000000 Binary files a/core/img/actions/delete.png and /dev/null differ diff --git a/core/img/actions/details.png b/core/img/actions/details.png deleted file mode 100644 index 9145025be26c0..0000000000000 Binary files a/core/img/actions/details.png and /dev/null differ diff --git a/core/img/actions/download-white.png b/core/img/actions/download-white.png deleted file mode 100644 index 815b551354f42..0000000000000 Binary files a/core/img/actions/download-white.png and /dev/null differ diff --git a/core/img/actions/download.png b/core/img/actions/download.png deleted file mode 100644 index 1f8e1a4f7e167..0000000000000 Binary files a/core/img/actions/download.png and /dev/null differ diff --git a/core/img/actions/edit.png b/core/img/actions/edit.png deleted file mode 100644 index 7ca20eba363b7..0000000000000 Binary files a/core/img/actions/edit.png and /dev/null differ diff --git a/core/img/actions/error-color.png b/core/img/actions/error-color.png deleted file mode 100644 index 7d00282312ab9..0000000000000 Binary files a/core/img/actions/error-color.png and /dev/null differ diff --git a/core/img/actions/error-white.png b/core/img/actions/error-white.png deleted file mode 100644 index 6e15865401d6b..0000000000000 Binary files a/core/img/actions/error-white.png and /dev/null differ diff --git a/core/img/actions/error.png b/core/img/actions/error.png deleted file mode 100644 index 61df76b53ea5e..0000000000000 Binary files a/core/img/actions/error.png and /dev/null differ diff --git a/core/img/actions/external.png b/core/img/actions/external.png deleted file mode 100644 index af03dbf3e0539..0000000000000 Binary files a/core/img/actions/external.png and /dev/null differ diff --git a/core/img/actions/history.png b/core/img/actions/history.png deleted file mode 100644 index ec2bbd0587fc5..0000000000000 Binary files a/core/img/actions/history.png and /dev/null differ diff --git a/core/img/actions/info-white.png b/core/img/actions/info-white.png deleted file mode 100644 index 670d7309c4eec..0000000000000 Binary files a/core/img/actions/info-white.png and /dev/null differ diff --git a/core/img/actions/info.png b/core/img/actions/info.png deleted file mode 100644 index b280a019ab4be..0000000000000 Binary files a/core/img/actions/info.png and /dev/null differ diff --git a/core/img/actions/logout.png b/core/img/actions/logout.png deleted file mode 100644 index 7739106678975..0000000000000 Binary files a/core/img/actions/logout.png and /dev/null differ diff --git a/core/img/actions/mail.png b/core/img/actions/mail.png deleted file mode 100644 index 6d06259cd0882..0000000000000 Binary files a/core/img/actions/mail.png and /dev/null differ diff --git a/core/img/actions/menu.png b/core/img/actions/menu.png deleted file mode 100644 index 583ce319175c4..0000000000000 Binary files a/core/img/actions/menu.png and /dev/null differ diff --git a/core/img/actions/more.png b/core/img/actions/more.png deleted file mode 100644 index 880d5dccce386..0000000000000 Binary files a/core/img/actions/more.png and /dev/null differ diff --git a/core/img/actions/password.png b/core/img/actions/password.png deleted file mode 100644 index 3619fabab9a05..0000000000000 Binary files a/core/img/actions/password.png and /dev/null differ diff --git a/core/img/actions/pause-big.png b/core/img/actions/pause-big.png deleted file mode 100644 index 054281c63143b..0000000000000 Binary files a/core/img/actions/pause-big.png and /dev/null differ diff --git a/core/img/actions/pause.png b/core/img/actions/pause.png deleted file mode 100644 index d4b865e340185..0000000000000 Binary files a/core/img/actions/pause.png and /dev/null differ diff --git a/core/img/actions/play-add.png b/core/img/actions/play-add.png deleted file mode 100644 index ccf77d2a062e9..0000000000000 Binary files a/core/img/actions/play-add.png and /dev/null differ diff --git a/core/img/actions/play-big.png b/core/img/actions/play-big.png deleted file mode 100644 index 7d4916cb204c7..0000000000000 Binary files a/core/img/actions/play-big.png and /dev/null differ diff --git a/core/img/actions/play-next.png b/core/img/actions/play-next.png deleted file mode 100644 index 50cd91d240ec5..0000000000000 Binary files a/core/img/actions/play-next.png and /dev/null differ diff --git a/core/img/actions/play-previous.png b/core/img/actions/play-previous.png deleted file mode 100644 index c380e96bb58df..0000000000000 Binary files a/core/img/actions/play-previous.png and /dev/null differ diff --git a/core/img/actions/play.png b/core/img/actions/play.png deleted file mode 100644 index 7994424c65cb1..0000000000000 Binary files a/core/img/actions/play.png and /dev/null differ diff --git a/core/img/actions/public.png b/core/img/actions/public.png deleted file mode 100644 index 772838ad2058e..0000000000000 Binary files a/core/img/actions/public.png and /dev/null differ diff --git a/core/img/actions/radio-checked-disabled.png b/core/img/actions/radio-checked-disabled.png deleted file mode 100644 index 09abc410f6182..0000000000000 Binary files a/core/img/actions/radio-checked-disabled.png and /dev/null differ diff --git a/core/img/actions/radio-checked.png b/core/img/actions/radio-checked.png deleted file mode 100644 index f3d061156933b..0000000000000 Binary files a/core/img/actions/radio-checked.png and /dev/null differ diff --git a/core/img/actions/radio-disabled.png b/core/img/actions/radio-disabled.png deleted file mode 100644 index ac7f49ed53310..0000000000000 Binary files a/core/img/actions/radio-disabled.png and /dev/null differ diff --git a/core/img/actions/radio-white.png b/core/img/actions/radio-white.png deleted file mode 100644 index 04beefdff0141..0000000000000 Binary files a/core/img/actions/radio-white.png and /dev/null differ diff --git a/core/img/actions/radio.png b/core/img/actions/radio.png deleted file mode 100644 index 70ac4741b978b..0000000000000 Binary files a/core/img/actions/radio.png and /dev/null differ diff --git a/core/img/actions/rename.png b/core/img/actions/rename.png deleted file mode 100644 index 975bd2d7031d5..0000000000000 Binary files a/core/img/actions/rename.png and /dev/null differ diff --git a/core/img/actions/search-white.png b/core/img/actions/search-white.png deleted file mode 100644 index 9812c44a3d6bc..0000000000000 Binary files a/core/img/actions/search-white.png and /dev/null differ diff --git a/core/img/actions/search.png b/core/img/actions/search.png deleted file mode 100644 index 5f4767a6f4619..0000000000000 Binary files a/core/img/actions/search.png and /dev/null differ diff --git a/core/img/actions/settings.png b/core/img/actions/settings.png deleted file mode 100644 index 3ab939ca37a4f..0000000000000 Binary files a/core/img/actions/settings.png and /dev/null differ diff --git a/core/img/actions/share.png b/core/img/actions/share.png deleted file mode 100644 index fdacbbabebcf0..0000000000000 Binary files a/core/img/actions/share.png and /dev/null differ diff --git a/core/img/actions/shared.png b/core/img/actions/shared.png deleted file mode 100644 index fdacbbabebcf0..0000000000000 Binary files a/core/img/actions/shared.png and /dev/null differ diff --git a/core/img/actions/sound-off.png b/core/img/actions/sound-off.png deleted file mode 100644 index 0457de8e4d1cb..0000000000000 Binary files a/core/img/actions/sound-off.png and /dev/null differ diff --git a/core/img/actions/sound.png b/core/img/actions/sound.png deleted file mode 100644 index e849b4d248b35..0000000000000 Binary files a/core/img/actions/sound.png and /dev/null differ diff --git a/core/img/actions/star.png b/core/img/actions/star.png deleted file mode 100644 index 88e4ad54584fa..0000000000000 Binary files a/core/img/actions/star.png and /dev/null differ diff --git a/core/img/actions/starred.png b/core/img/actions/starred.png deleted file mode 100644 index 22e68c757e795..0000000000000 Binary files a/core/img/actions/starred.png and /dev/null differ diff --git a/core/img/actions/toggle-filelist.png b/core/img/actions/toggle-filelist.png deleted file mode 100644 index 0926a726d53e1..0000000000000 Binary files a/core/img/actions/toggle-filelist.png and /dev/null differ diff --git a/core/img/actions/toggle-pictures.png b/core/img/actions/toggle-pictures.png deleted file mode 100644 index 7499d5b780988..0000000000000 Binary files a/core/img/actions/toggle-pictures.png and /dev/null differ diff --git a/core/img/actions/toggle.png b/core/img/actions/toggle.png deleted file mode 100644 index 24a6a4d47de12..0000000000000 Binary files a/core/img/actions/toggle.png and /dev/null differ diff --git a/core/img/actions/triangle-e.png b/core/img/actions/triangle-e.png deleted file mode 100644 index 4ce1086f61d4f..0000000000000 Binary files a/core/img/actions/triangle-e.png and /dev/null differ diff --git a/core/img/actions/triangle-n.png b/core/img/actions/triangle-n.png deleted file mode 100644 index 2042d66532c01..0000000000000 Binary files a/core/img/actions/triangle-n.png and /dev/null differ diff --git a/core/img/actions/triangle-s.png b/core/img/actions/triangle-s.png deleted file mode 100644 index 97c64c6a7203c..0000000000000 Binary files a/core/img/actions/triangle-s.png and /dev/null differ diff --git a/core/img/actions/upload-white.png b/core/img/actions/upload-white.png deleted file mode 100644 index 28693f855d3e8..0000000000000 Binary files a/core/img/actions/upload-white.png and /dev/null differ diff --git a/core/img/actions/upload.png b/core/img/actions/upload.png deleted file mode 100644 index 8955ed9641202..0000000000000 Binary files a/core/img/actions/upload.png and /dev/null differ diff --git a/core/img/actions/user.png b/core/img/actions/user.png deleted file mode 100644 index 5f2fddc0ea3fb..0000000000000 Binary files a/core/img/actions/user.png and /dev/null differ diff --git a/core/img/actions/view-close.png b/core/img/actions/view-close.png deleted file mode 100644 index eae9acc7a4301..0000000000000 Binary files a/core/img/actions/view-close.png and /dev/null differ diff --git a/core/img/actions/view-download.png b/core/img/actions/view-download.png deleted file mode 100644 index 29e1b6fec70bd..0000000000000 Binary files a/core/img/actions/view-download.png and /dev/null differ diff --git a/core/img/actions/view-next.png b/core/img/actions/view-next.png deleted file mode 100644 index be8cc15cecdf1..0000000000000 Binary files a/core/img/actions/view-next.png and /dev/null differ diff --git a/core/img/actions/view-pause.png b/core/img/actions/view-pause.png deleted file mode 100644 index 94cd1a5dc6c93..0000000000000 Binary files a/core/img/actions/view-pause.png and /dev/null differ diff --git a/core/img/actions/view-play.png b/core/img/actions/view-play.png deleted file mode 100644 index a8398d5758f44..0000000000000 Binary files a/core/img/actions/view-play.png and /dev/null differ diff --git a/core/img/actions/view-previous.png b/core/img/actions/view-previous.png deleted file mode 100644 index 86e2a809626cb..0000000000000 Binary files a/core/img/actions/view-previous.png and /dev/null differ diff --git a/core/img/breadcrumb.png b/core/img/breadcrumb.png deleted file mode 100644 index 5556920aa73b4..0000000000000 Binary files a/core/img/breadcrumb.png and /dev/null differ diff --git a/core/img/desktopapp.png b/core/img/desktopapp.png deleted file mode 100644 index 272397c949e68..0000000000000 Binary files a/core/img/desktopapp.png and /dev/null differ diff --git a/core/img/filetypes/application-pdf.png b/core/img/filetypes/application-pdf.png deleted file mode 100644 index c215094eaa777..0000000000000 Binary files a/core/img/filetypes/application-pdf.png and /dev/null differ diff --git a/core/img/filetypes/application.png b/core/img/filetypes/application.png deleted file mode 100644 index d9db3b9114cca..0000000000000 Binary files a/core/img/filetypes/application.png and /dev/null differ diff --git a/core/img/filetypes/audio.png b/core/img/filetypes/audio.png deleted file mode 100644 index 3d52756341acd..0000000000000 Binary files a/core/img/filetypes/audio.png and /dev/null differ diff --git a/core/img/filetypes/file.png b/core/img/filetypes/file.png deleted file mode 100644 index 74add13f2760e..0000000000000 Binary files a/core/img/filetypes/file.png and /dev/null differ diff --git a/core/img/filetypes/folder-drag-accept.png b/core/img/filetypes/folder-drag-accept.png deleted file mode 100644 index 44a3720fef4ae..0000000000000 Binary files a/core/img/filetypes/folder-drag-accept.png and /dev/null differ diff --git a/core/img/filetypes/folder-external.png b/core/img/filetypes/folder-external.png deleted file mode 100644 index 79dcbeaf73154..0000000000000 Binary files a/core/img/filetypes/folder-external.png and /dev/null differ diff --git a/core/img/filetypes/folder-public.png b/core/img/filetypes/folder-public.png deleted file mode 100644 index b9181f640b268..0000000000000 Binary files a/core/img/filetypes/folder-public.png and /dev/null differ diff --git a/core/img/filetypes/folder-shared.png b/core/img/filetypes/folder-shared.png deleted file mode 100644 index 1cc6de7a029fb..0000000000000 Binary files a/core/img/filetypes/folder-shared.png and /dev/null differ diff --git a/core/img/filetypes/folder-starred.png b/core/img/filetypes/folder-starred.png deleted file mode 100644 index 99d79c14a1d3d..0000000000000 Binary files a/core/img/filetypes/folder-starred.png and /dev/null differ diff --git a/core/img/filetypes/folder.png b/core/img/filetypes/folder.png deleted file mode 100644 index 2262998cb3c72..0000000000000 Binary files a/core/img/filetypes/folder.png and /dev/null differ diff --git a/core/img/filetypes/image.png b/core/img/filetypes/image.png deleted file mode 100644 index 8ff5e6c119fda..0000000000000 Binary files a/core/img/filetypes/image.png and /dev/null differ diff --git a/core/img/filetypes/package-x-generic.png b/core/img/filetypes/package-x-generic.png deleted file mode 100644 index 389b44cc2a3be..0000000000000 Binary files a/core/img/filetypes/package-x-generic.png and /dev/null differ diff --git a/core/img/filetypes/text-calendar.png b/core/img/filetypes/text-calendar.png deleted file mode 100644 index f21c3a9951d2e..0000000000000 Binary files a/core/img/filetypes/text-calendar.png and /dev/null differ diff --git a/core/img/filetypes/text-code.png b/core/img/filetypes/text-code.png deleted file mode 100644 index 69744e499e6ed..0000000000000 Binary files a/core/img/filetypes/text-code.png and /dev/null differ diff --git a/core/img/filetypes/text-vcard.png b/core/img/filetypes/text-vcard.png deleted file mode 100644 index 087eadaabd123..0000000000000 Binary files a/core/img/filetypes/text-vcard.png and /dev/null differ diff --git a/core/img/filetypes/text.png b/core/img/filetypes/text.png deleted file mode 100644 index d6bec70cf43e2..0000000000000 Binary files a/core/img/filetypes/text.png and /dev/null differ diff --git a/core/img/filetypes/video.png b/core/img/filetypes/video.png deleted file mode 100644 index 7cc1ecdc46a0e..0000000000000 Binary files a/core/img/filetypes/video.png and /dev/null differ diff --git a/core/img/filetypes/x-office-document.png b/core/img/filetypes/x-office-document.png deleted file mode 100644 index 3bc2f08d1f9d7..0000000000000 Binary files a/core/img/filetypes/x-office-document.png and /dev/null differ diff --git a/core/img/filetypes/x-office-presentation.png b/core/img/filetypes/x-office-presentation.png deleted file mode 100644 index 644fb852009e9..0000000000000 Binary files a/core/img/filetypes/x-office-presentation.png and /dev/null differ diff --git a/core/img/filetypes/x-office-spreadsheet.png b/core/img/filetypes/x-office-spreadsheet.png deleted file mode 100644 index 8f79c32fe01e2..0000000000000 Binary files a/core/img/filetypes/x-office-spreadsheet.png and /dev/null differ diff --git a/core/img/logo-icon.png b/core/img/logo-icon.png deleted file mode 100644 index 4ffb2bb953ada..0000000000000 Binary files a/core/img/logo-icon.png and /dev/null differ diff --git a/core/img/places/calendar-dark.png b/core/img/places/calendar-dark.png deleted file mode 100644 index 9dc21d8a7b8e9..0000000000000 Binary files a/core/img/places/calendar-dark.png and /dev/null differ diff --git a/core/img/places/contacts-dark.png b/core/img/places/contacts-dark.png deleted file mode 100644 index fe03bbfe1a4f0..0000000000000 Binary files a/core/img/places/contacts-dark.png and /dev/null differ diff --git a/core/img/places/files.png b/core/img/places/files.png deleted file mode 100644 index e317fc3c722b9..0000000000000 Binary files a/core/img/places/files.png and /dev/null differ diff --git a/core/img/places/home.png b/core/img/places/home.png deleted file mode 100644 index 2e0313d59a7a5..0000000000000 Binary files a/core/img/places/home.png and /dev/null differ diff --git a/core/img/places/link.png b/core/img/places/link.png deleted file mode 100644 index 8ba9f6530fb65..0000000000000 Binary files a/core/img/places/link.png and /dev/null differ diff --git a/core/img/places/music.png b/core/img/places/music.png deleted file mode 100644 index 0670544fedc63..0000000000000 Binary files a/core/img/places/music.png and /dev/null differ diff --git a/core/img/places/picture.png b/core/img/places/picture.png deleted file mode 100644 index 171af526e9d51..0000000000000 Binary files a/core/img/places/picture.png and /dev/null differ diff --git a/core/js/jquery.ocdialog.js b/core/js/jquery.ocdialog.js index ea034f0aff706..15b58f9e08643 100644 --- a/core/js/jquery.ocdialog.js +++ b/core/js/jquery.ocdialog.js @@ -145,7 +145,7 @@ break; case 'closeButton': if(value) { - var $closeButton = $(''); + var $closeButton = $(''); this.$dialog.prepend($closeButton); $closeButton.on('click', function() { self.close(); diff --git a/core/js/js.js b/core/js/js.js index 7f98668dcb277..07ed396bec9be 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -327,8 +327,8 @@ var OC={ * @return {string} */ imagePath:function(app,file){ - if(file.indexOf('.')==-1){//if no extension is given, use png or svg depending on browser support - file+=(OC.Util.hasSVGSupport())?'.svg':'.png'; + if(file.indexOf('.')==-1){//if no extension is given, use svg + file+='.svg'; } return OC.filePath(app,'img',file); }, @@ -592,7 +592,7 @@ var OC={ var arrowclass = settings.hasClass('topright') ? 'up' : 'left'; var jqxhr = $.get(OC.filePath(props.appid, '', props.scriptName), function(data) { popup.html(data).ready(function() { - popup.prepend('

'+t('core', 'Settings')+'

').show(); + popup.prepend('

'+t('core', 'Settings')+'

').show(); popup.find('.close').bind('click', function() { popup.remove(); }); @@ -613,9 +613,6 @@ var OC={ throw e; }); } - if(!OC.Util.hasSVGSupport()) { - OC.Util.replaceSVG(); - } }).show(); }, 'html'); } @@ -1357,49 +1354,6 @@ if(typeof localStorage !=='undefined' && localStorage !== null){ }; } -/** - * check if the browser support svg images - * @return {boolean} - */ -function SVGSupport() { - return SVGSupport.checkMimeType.correct && !!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', "svg").createSVGRect; -} -SVGSupport.checkMimeType=function(){ - $.ajax({ - url: OC.imagePath('core','breadcrumb.svg'), - success:function(data,text,xhr){ - var headerParts=xhr.getAllResponseHeaders().split("\n"); - var headers={}; - $.each(headerParts,function(i,text){ - if(text){ - var parts=text.split(':',2); - if(parts.length===2){ - var value=parts[1].trim(); - if(value[0]==='"'){ - value=value.substr(1,value.length-2); - } - headers[parts[0].toLowerCase()]=value; - } - } - }); - if(headers["content-type"]!=='image/svg+xml'){ - OC.Util.replaceSVG(); - SVGSupport.checkMimeType.correct=false; - } - } - }); -}; -SVGSupport.checkMimeType.correct=true; - -/** - * Replace all svg images with png for browser compatibility - * @param $el - * @deprecated use OC.Util.replaceSVG instead - */ -function replaceSVG($el){ - return OC.Util.replaceSVG($el); -} - /** * prototypical inheritance functions * @todo Write documentation @@ -1517,12 +1471,6 @@ function initCore() { initSessionHeartBeat(); } - if(!OC.Util.hasSVGSupport()){ //replace all svg images with png images for browser that don't support svg - OC.Util.replaceSVG(); - }else{ - SVGSupport.checkMimeType(); - } - OC.registerMenu($('#expand'), $('#expanddiv')); // toggle for menus @@ -1791,24 +1739,21 @@ OC.Util = { }, /** * Returns whether the browser supports SVG + * @deprecated SVG is always supported (since 9.0) * @return {boolean} true if the browser supports SVG, false otherwise */ - // TODO: replace with original function - hasSVGSupport: SVGSupport, + hasSVGSupport: function(){ + return true + }, /** * If SVG is not supported, replaces the given icon's extension * from ".svg" to ".png". * If SVG is supported, return the image path as is. * @param {string} file image path with svg extension + * @deprecated SVG is always supported (since 9.0) * @return {string} fixed image path with png extension if SVG is not supported */ replaceSVGIcon: function(file) { - if (file && !OC.Util.hasSVGSupport()) { - var i = file.lastIndexOf('.svg'); - if (i >= 0) { - file = file.substr(0, i) + '.png' + file.substr(i+4); - } - } return file; }, /** @@ -1816,39 +1761,9 @@ OC.Util = { * with PNG images. * * @param $el root element from which to search, defaults to $('body') + * @deprecated SVG is always supported (since 9.0) */ - replaceSVG: function($el) { - if (!$el) { - $el = $('body'); - } - $el.find('img.svg').each(function(index,element){ - element=$(element); - var src=element.attr('src'); - element.attr('src',src.substr(0, src.length-3) + 'png'); - }); - $el.find('.svg').each(function(index,element){ - element = $(element); - var background = element.css('background-image'); - if (background){ - var i = background.lastIndexOf('.svg'); - if (i >= 0){ - background = background.substr(0,i) + '.png' + background.substr(i + 4); - element.css('background-image', background); - } - } - element.find('*').each(function(index, element) { - element = $(element); - var background = element.css('background-image'); - if (background) { - var i = background.lastIndexOf('.svg'); - if(i >= 0){ - background = background.substr(0,i) + '.png' + background.substr(i + 4); - element.css('background-image', background); - } - } - }); - }); - }, + replaceSVG: function($el) {}, /** * Fix image scaling for IE8, since background-size is not supported. diff --git a/core/js/mimetype.js b/core/js/mimetype.js index 3cc33ce283051..0d30da26c2659 100644 --- a/core/js/mimetype.js +++ b/core/js/mimetype.js @@ -29,7 +29,7 @@ OC.MimeType = { * Cache that maps mimeTypes to icon urls */ _mimeTypeIcons: {}, - + /** * Return the file icon we want to use for the given mimeType. * The file needs to be present in the supplied file list @@ -60,7 +60,7 @@ OC.MimeType = { return null; }, - + /** * Return the url to icon of the given mimeType * @@ -91,19 +91,14 @@ OC.MimeType = { path += icon; } } - + // If we do not yet have an icon fall back to the default if (gotIcon === null) { path = OC.webroot + '/core/img/filetypes/'; path += OC.MimeType._getFile(mimeType, OC.MimeTypeList.files); } - // Use svg if we can - if(OC.Util.hasSVGSupport()){ - path += '.svg'; - } else { - path += '.png'; - } + path += '.svg'; // Cache the result OC.MimeType._mimeTypeIcons[mimeType] = path; @@ -111,5 +106,3 @@ OC.MimeType = { } }; - - diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 83fde15461506..85dee97898769 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -38,7 +38,7 @@ '' + '' + '' + - '{{crudsLabel}}' + + '{{crudsLabel}}' + '' + '{{/if}}' + '