diff options
-rw-r--r-- | .mention-bot | 2 | ||||
-rw-r--r-- | apps/comments/appinfo/app.php | 7 | ||||
-rw-r--r-- | apps/comments/l10n/ar.js | 17 | ||||
-rw-r--r-- | apps/comments/l10n/ar.json | 17 | ||||
-rw-r--r-- | apps/dav/lib/Comments/EntityCollection.php | 15 | ||||
-rw-r--r-- | apps/dav/lib/Comments/EntityTypeCollection.php | 22 | ||||
-rw-r--r-- | apps/dav/lib/Comments/RootCollection.php | 51 | ||||
-rw-r--r-- | apps/dav/lib/RootCollection.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagMappingNode.php | 83 | ||||
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagNode.php | 43 | ||||
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagPlugin.php | 68 | ||||
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagsByIdCollection.php | 9 | ||||
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php | 73 | ||||
-rw-r--r-- | apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php | 13 | ||||
-rw-r--r-- | apps/dav/tests/unit/comments/entitycollection.php | 8 | ||||
-rw-r--r-- | apps/dav/tests/unit/comments/entitytypecollection.php | 35 | ||||
-rw-r--r-- | apps/dav/tests/unit/comments/rootcollection.php | 24 | ||||
-rw-r--r-- | apps/dav/tests/unit/systemtag/systemtagmappingnode.php | 58 | ||||
-rw-r--r-- | apps/dav/tests/unit/systemtag/systemtagnode.php | 82 | ||||
-rw-r--r-- | apps/dav/tests/unit/systemtag/systemtagplugin.php | 350 | ||||
-rw-r--r-- | apps/dav/tests/unit/systemtag/systemtagsbyidcollection.php | 57 | ||||
-rw-r--r-- | apps/dav/tests/unit/systemtag/systemtagsobjectmappingcollection.php | 165 | ||||
-rw-r--r-- | apps/encryption/l10n/ro.js | 43 | ||||
-rw-r--r-- | apps/encryption/l10n/ro.json | 43 | ||||
-rw-r--r-- | apps/federatedfilesharing/appinfo/app.php | 17 | ||||
-rw-r--r-- | apps/federatedfilesharing/appinfo/database.xml | 41 | ||||
-rw-r--r-- | apps/federatedfilesharing/appinfo/info.xml | 2 | ||||
-rw-r--r-- | apps/federatedfilesharing/l10n/cs_CZ.js | 2 | ||||
-rw-r--r-- | apps/federatedfilesharing/l10n/cs_CZ.json | 2 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/AppInfo/Application.php | 3 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php (renamed from apps/federatedfilesharing/lib/BackgroundJob/UnShare.php) | 32 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/FederatedShareProvider.php | 300 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/Notifications.php | 147 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/RequestHandler.php | 580 | ||||
-rw-r--r-- | apps/federatedfilesharing/lib/notifier.php (renamed from apps/files_sharing/lib/notifier.php) | 14 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/AddressHandlerTest.php | 3 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/DiscoveryManagerTest.php | 3 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/FederatedShareProviderTest.php | 116 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/NotificationsTest.php | 29 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/RequestHandlerTest.php (renamed from apps/files_sharing/tests/server2server.php) | 170 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/TestCase.php | 132 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/TokenHandlerTest.php | 3 | ||||
-rw-r--r-- | apps/files/js/files.js | 21 | ||||
-rw-r--r-- | apps/files/l10n/cs_CZ.js | 27 | ||||
-rw-r--r-- | apps/files/l10n/cs_CZ.json | 27 | ||||
-rw-r--r-- | apps/files/l10n/es.js | 5 | ||||
-rw-r--r-- | apps/files/l10n/es.json | 5 | ||||
-rw-r--r-- | apps/files/l10n/ja.js | 1 | ||||
-rw-r--r-- | apps/files/l10n/ja.json | 1 | ||||
-rw-r--r-- | apps/files/lib/Command/Scan.php | 15 | ||||
-rw-r--r-- | apps/files_external/appinfo/application.php | 38 | ||||
-rw-r--r-- | apps/files_external/l10n/cs_CZ.js | 4 | ||||
-rw-r--r-- | apps/files_external/l10n/cs_CZ.json | 4 | ||||
-rw-r--r-- | apps/files_external/l10n/sl.js | 1 | ||||
-rw-r--r-- | apps/files_external/l10n/sl.json | 1 | ||||
-rw-r--r-- | apps/files_external/lib/config/iauthmechanismprovider.php | 38 | ||||
-rw-r--r-- | apps/files_external/lib/config/ibackendprovider.php | 38 | ||||
-rw-r--r-- | apps/files_external/service/backendservice.php | 50 | ||||
-rw-r--r-- | apps/files_external/tests/service/backendservicetest.php | 76 | ||||
-rw-r--r-- | apps/files_sharing/api/server2server.php | 325 | ||||
-rw-r--r-- | apps/files_sharing/api/share20ocs.php | 12 | ||||
-rw-r--r-- | apps/files_sharing/appinfo/app.php | 12 | ||||
-rw-r--r-- | apps/files_sharing/l10n/cs_CZ.js | 12 | ||||
-rw-r--r-- | apps/files_sharing/l10n/cs_CZ.json | 12 | ||||
-rw-r--r-- | apps/files_sharing/l10n/es.js | 5 | ||||
-rw-r--r-- | apps/files_sharing/l10n/es.json | 5 | ||||
-rw-r--r-- | apps/files_sharing/l10n/sl.js | 1 | ||||
-rw-r--r-- | apps/files_sharing/l10n/sl.json | 1 | ||||
-rw-r--r-- | apps/files_sharing/lib/external/manager.php | 36 | ||||
-rw-r--r-- | apps/files_sharing/tests/api/share20ocstest.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/tests/deleteorphanedsharesjobtest.php | 2 | ||||
-rw-r--r-- | apps/files_trashbin/l10n/cs_CZ.js | 2 | ||||
-rw-r--r-- | apps/files_trashbin/l10n/cs_CZ.json | 2 | ||||
-rw-r--r-- | apps/systemtags/js/systemtagsinfoview.js | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/bg_BG.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/bg_BG.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/cs_CZ.js | 4 | ||||
-rw-r--r-- | apps/systemtags/l10n/cs_CZ.json | 4 | ||||
-rw-r--r-- | apps/systemtags/l10n/de.js | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/de.json | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/de_DE.js | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/de_DE.json | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/en_GB.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/en_GB.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/eo.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/eo.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/es.js | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/es.json | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/et_EE.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/et_EE.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/fr.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/fr.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/he.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/he.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/hu_HU.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/hu_HU.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/is.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/is.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/it.js | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/it.json | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/ja.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/ja.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/nb_NO.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/nb_NO.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/nl.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/nl.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/pl.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/pl.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/pt_BR.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/pt_BR.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/pt_PT.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/pt_PT.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/ro.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/ro.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/ru.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/ru.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/sl.js | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/sl.json | 2 | ||||
-rw-r--r-- | apps/systemtags/l10n/sq.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/sq.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/sr.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/sr.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/th_TH.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/th_TH.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/tr.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/tr.json | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/zh_CN.js | 1 | ||||
-rw-r--r-- | apps/systemtags/l10n/zh_CN.json | 1 | ||||
-rw-r--r-- | apps/systemtags/lib/Activity/Extension.php | 2 | ||||
-rw-r--r-- | apps/systemtags/tests/js/systemtagsinfoviewSpec.js | 43 | ||||
-rw-r--r-- | apps/updatenotification/l10n/bg_BG.js | 6 | ||||
-rw-r--r-- | apps/updatenotification/l10n/bg_BG.json | 6 | ||||
-rw-r--r-- | apps/user_ldap/l10n/cs_CZ.js | 6 | ||||
-rw-r--r-- | apps/user_ldap/l10n/cs_CZ.json | 6 | ||||
-rw-r--r-- | apps/user_ldap/l10n/ro.js | 66 | ||||
-rw-r--r-- | apps/user_ldap/l10n/ro.json | 66 | ||||
-rw-r--r-- | build/integration/features/bootstrap/TagsContext.php | 192 | ||||
-rw-r--r-- | build/integration/features/tags.feature | 57 | ||||
-rw-r--r-- | build/jsdocs9.tar.bz2 | bin | 0 -> 575999 bytes | |||
-rw-r--r-- | config/config.sample.php | 11 | ||||
-rw-r--r-- | core/js/systemtags/systemtagmodel.js | 10 | ||||
-rw-r--r-- | core/js/systemtags/systemtags.js | 2 | ||||
-rw-r--r-- | core/js/systemtags/systemtagsinputfield.js | 8 | ||||
-rw-r--r-- | core/js/tests/specs/systemtags/systemtagsSpec.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js | 71 | ||||
-rw-r--r-- | core/l10n/ar.js | 1 | ||||
-rw-r--r-- | core/l10n/ar.json | 1 | ||||
-rw-r--r-- | core/l10n/cs_CZ.js | 8 | ||||
-rw-r--r-- | core/l10n/cs_CZ.json | 8 | ||||
-rw-r--r-- | core/l10n/de.js | 2 | ||||
-rw-r--r-- | core/l10n/de.json | 2 | ||||
-rw-r--r-- | core/l10n/de_AT.js | 1 | ||||
-rw-r--r-- | core/l10n/de_AT.json | 1 | ||||
-rw-r--r-- | core/l10n/de_DE.js | 2 | ||||
-rw-r--r-- | core/l10n/de_DE.json | 2 | ||||
-rw-r--r-- | core/l10n/en_GB.js | 1 | ||||
-rw-r--r-- | core/l10n/en_GB.json | 1 | ||||
-rw-r--r-- | core/l10n/eo.js | 1 | ||||
-rw-r--r-- | core/l10n/eo.json | 1 | ||||
-rw-r--r-- | core/l10n/es.js | 2 | ||||
-rw-r--r-- | core/l10n/es.json | 2 | ||||
-rw-r--r-- | core/l10n/et_EE.js | 1 | ||||
-rw-r--r-- | core/l10n/et_EE.json | 1 | ||||
-rw-r--r-- | core/l10n/fi_FI.js | 1 | ||||
-rw-r--r-- | core/l10n/fi_FI.json | 1 | ||||
-rw-r--r-- | core/l10n/fr.js | 1 | ||||
-rw-r--r-- | core/l10n/fr.json | 1 | ||||
-rw-r--r-- | core/l10n/he.js | 1 | ||||
-rw-r--r-- | core/l10n/he.json | 1 | ||||
-rw-r--r-- | core/l10n/hu_HU.js | 1 | ||||
-rw-r--r-- | core/l10n/hu_HU.json | 1 | ||||
-rw-r--r-- | core/l10n/is.js | 1 | ||||
-rw-r--r-- | core/l10n/is.json | 1 | ||||
-rw-r--r-- | core/l10n/it.js | 1 | ||||
-rw-r--r-- | core/l10n/it.json | 1 | ||||
-rw-r--r-- | core/l10n/ja.js | 1 | ||||
-rw-r--r-- | core/l10n/ja.json | 1 | ||||
-rw-r--r-- | core/l10n/ko.js | 1 | ||||
-rw-r--r-- | core/l10n/ko.json | 1 | ||||
-rw-r--r-- | core/l10n/lv.js | 2 | ||||
-rw-r--r-- | core/l10n/lv.json | 2 | ||||
-rw-r--r-- | core/l10n/mk.js | 1 | ||||
-rw-r--r-- | core/l10n/mk.json | 1 | ||||
-rw-r--r-- | core/l10n/nb_NO.js | 1 | ||||
-rw-r--r-- | core/l10n/nb_NO.json | 1 | ||||
-rw-r--r-- | core/l10n/nl.js | 1 | ||||
-rw-r--r-- | core/l10n/nl.json | 1 | ||||
-rw-r--r-- | core/l10n/pt_BR.js | 1 | ||||
-rw-r--r-- | core/l10n/pt_BR.json | 1 | ||||
-rw-r--r-- | core/l10n/pt_PT.js | 1 | ||||
-rw-r--r-- | core/l10n/pt_PT.json | 1 | ||||
-rw-r--r-- | core/l10n/ro.js | 1 | ||||
-rw-r--r-- | core/l10n/ro.json | 1 | ||||
-rw-r--r-- | core/l10n/ru.js | 1 | ||||
-rw-r--r-- | core/l10n/ru.json | 1 | ||||
-rw-r--r-- | core/l10n/sl.js | 1 | ||||
-rw-r--r-- | core/l10n/sl.json | 1 | ||||
-rw-r--r-- | core/l10n/sq.js | 1 | ||||
-rw-r--r-- | core/l10n/sq.json | 1 | ||||
-rw-r--r-- | core/l10n/sv.js | 1 | ||||
-rw-r--r-- | core/l10n/sv.json | 1 | ||||
-rw-r--r-- | core/l10n/th_TH.js | 1 | ||||
-rw-r--r-- | core/l10n/th_TH.json | 1 | ||||
-rw-r--r-- | core/l10n/tr.js | 1 | ||||
-rw-r--r-- | core/l10n/tr.json | 1 | ||||
-rw-r--r-- | core/l10n/zh_CN.js | 1 | ||||
-rw-r--r-- | core/l10n/zh_CN.json | 1 | ||||
-rw-r--r-- | core/l10n/zh_TW.js | 1 | ||||
-rw-r--r-- | core/l10n/zh_TW.json | 1 | ||||
-rw-r--r-- | core/shipped.json | 1 | ||||
-rw-r--r-- | cron.php | 28 | ||||
-rw-r--r-- | db_structure.xml | 60 | ||||
-rw-r--r-- | lib/autoloader.php | 12 | ||||
-rw-r--r-- | lib/base.php | 8 | ||||
-rw-r--r-- | lib/l10n/cs_CZ.js | 12 | ||||
-rw-r--r-- | lib/l10n/cs_CZ.json | 12 | ||||
-rw-r--r-- | lib/l10n/de.js | 4 | ||||
-rw-r--r-- | lib/l10n/de.json | 4 | ||||
-rw-r--r-- | lib/l10n/de_DE.js | 4 | ||||
-rw-r--r-- | lib/l10n/de_DE.json | 4 | ||||
-rw-r--r-- | lib/l10n/es.js | 4 | ||||
-rw-r--r-- | lib/l10n/es.json | 4 | ||||
-rw-r--r-- | lib/l10n/fi_FI.js | 4 | ||||
-rw-r--r-- | lib/l10n/fi_FI.json | 4 | ||||
-rw-r--r-- | lib/l10n/it.js | 4 | ||||
-rw-r--r-- | lib/l10n/it.json | 4 | ||||
-rw-r--r-- | lib/private/AppFramework/Db/Db.php | 17 | ||||
-rw-r--r-- | lib/private/Authentication/Token/DefaultTokenMapper.php | 28 | ||||
-rw-r--r-- | lib/private/Authentication/Token/DefaultTokenProvider.php | 14 | ||||
-rw-r--r-- | lib/private/Authentication/Token/IProvider.php | 12 | ||||
-rw-r--r-- | lib/private/BackgroundJob/JobList.php | 86 | ||||
-rw-r--r-- | lib/private/DB/Adapter.php | 20 | ||||
-rw-r--r-- | lib/private/DB/AdapterMySQL.php | 12 | ||||
-rw-r--r-- | lib/private/DB/AdapterSqlite.php | 12 | ||||
-rw-r--r-- | lib/private/DB/Connection.php | 38 | ||||
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 47 | ||||
-rw-r--r-- | lib/private/OCS/Provider.php (renamed from ocs-provider/provider.php) | 2 | ||||
-rw-r--r-- | lib/private/Server.php | 6 | ||||
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 2 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 15 | ||||
-rw-r--r-- | lib/private/Share20/ProviderFactory.php | 3 | ||||
-rw-r--r-- | lib/private/Share20/Share.php | 17 | ||||
-rw-r--r-- | lib/private/SystemTag/ManagerFactory.php | 1 | ||||
-rw-r--r-- | lib/private/SystemTag/SystemTagManager.php | 113 | ||||
-rw-r--r-- | lib/private/User/Session.php | 4 | ||||
-rw-r--r-- | lib/public/API.php (renamed from lib/public/api.php) | 0 | ||||
-rw-r--r-- | lib/public/App.php (renamed from lib/public/app.php) | 0 | ||||
-rw-r--r-- | lib/public/AutoloadNotAllowedException.php (renamed from lib/public/autoloadnotallowedexception.php) | 0 | ||||
-rw-r--r-- | lib/public/BackgroundJob.php (renamed from lib/public/backgroundjob.php) | 0 | ||||
-rw-r--r-- | lib/public/BackgroundJob/IJobList.php | 11 | ||||
-rw-r--r-- | lib/public/Comments/CommentsEntityEvent.php | 76 | ||||
-rw-r--r-- | lib/public/Config.php (renamed from lib/public/config.php) | 0 | ||||
-rw-r--r-- | lib/public/Constants.php (renamed from lib/public/constants.php) | 0 | ||||
-rw-r--r-- | lib/public/Contacts.php (renamed from lib/public/contacts.php) | 0 | ||||
-rw-r--r-- | lib/public/DB.php (renamed from lib/public/db.php) | 0 | ||||
-rw-r--r-- | lib/public/Defaults.php (renamed from lib/public/defaults.php) | 0 | ||||
-rw-r--r-- | lib/public/Files.php (renamed from lib/public/files.php) | 0 | ||||
-rw-r--r-- | lib/public/GroupInterface.php (renamed from lib/public/groupinterface.php) | 0 | ||||
-rw-r--r-- | lib/public/IAddressBook.php (renamed from lib/public/iaddressbook.php) | 0 | ||||
-rw-r--r-- | lib/public/IAppConfig.php (renamed from lib/public/iappconfig.php) | 0 | ||||
-rw-r--r-- | lib/public/IAvatar.php (renamed from lib/public/iavatar.php) | 0 | ||||
-rw-r--r-- | lib/public/IAvatarManager.php (renamed from lib/public/iavatarmanager.php) | 0 | ||||
-rw-r--r-- | lib/public/ICache.php (renamed from lib/public/icache.php) | 0 | ||||
-rw-r--r-- | lib/public/ICacheFactory.php (renamed from lib/public/icachefactory.php) | 0 | ||||
-rw-r--r-- | lib/public/ICertificate.php (renamed from lib/public/icertificate.php) | 0 | ||||
-rw-r--r-- | lib/public/ICertificateManager.php (renamed from lib/public/icertificatemanager.php) | 0 | ||||
-rw-r--r-- | lib/public/IConfig.php (renamed from lib/public/iconfig.php) | 0 | ||||
-rw-r--r-- | lib/public/IContainer.php (renamed from lib/public/icontainer.php) | 0 | ||||
-rw-r--r-- | lib/public/IDBConnection.php (renamed from lib/public/idbconnection.php) | 19 | ||||
-rw-r--r-- | lib/public/IDateTimeFormatter.php (renamed from lib/public/idatetimeformatter.php) | 0 | ||||
-rw-r--r-- | lib/public/IDateTimeZone.php (renamed from lib/public/idatetimezone.php) | 0 | ||||
-rw-r--r-- | lib/public/IDb.php (renamed from lib/public/idb.php) | 0 | ||||
-rw-r--r-- | lib/public/IEventSource.php (renamed from lib/public/ieventsource.php) | 0 | ||||
-rw-r--r-- | lib/public/IGroup.php (renamed from lib/public/igroup.php) | 0 | ||||
-rw-r--r-- | lib/public/IGroupManager.php (renamed from lib/public/igroupmanager.php) | 0 | ||||
-rw-r--r-- | lib/public/IHelper.php (renamed from lib/public/ihelper.php) | 0 | ||||
-rw-r--r-- | lib/public/IImage.php (renamed from lib/public/iimage.php) | 0 | ||||
-rw-r--r-- | lib/public/IL10N.php (renamed from lib/public/il10n.php) | 0 | ||||
-rw-r--r-- | lib/public/ILogger.php (renamed from lib/public/ilogger.php) | 0 | ||||
-rw-r--r-- | lib/public/IMemcache.php (renamed from lib/public/imemcache.php) | 0 | ||||
-rw-r--r-- | lib/public/IMemcacheTTL.php (renamed from lib/public/imemcachettl.php) | 0 | ||||
-rw-r--r-- | lib/public/INavigationManager.php (renamed from lib/public/inavigationmanager.php) | 0 | ||||
-rw-r--r-- | lib/public/IPreview.php (renamed from lib/public/ipreview.php) | 0 | ||||
-rw-r--r-- | lib/public/IRequest.php (renamed from lib/public/irequest.php) | 0 | ||||
-rw-r--r-- | lib/public/ISearch.php (renamed from lib/public/isearch.php) | 0 | ||||
-rw-r--r-- | lib/public/ISession.php (renamed from lib/public/isession.php) | 0 | ||||
-rw-r--r-- | lib/public/ITagManager.php (renamed from lib/public/itagmanager.php) | 0 | ||||
-rw-r--r-- | lib/public/ITags.php (renamed from lib/public/itags.php) | 0 | ||||
-rw-r--r-- | lib/public/ITempManager.php (renamed from lib/public/itempmanager.php) | 0 | ||||
-rw-r--r-- | lib/public/IURLGenerator.php (renamed from lib/public/iurlgenerator.php) | 0 | ||||
-rw-r--r-- | lib/public/IUser.php (renamed from lib/public/iuser.php) | 0 | ||||
-rw-r--r-- | lib/public/IUserBackend.php (renamed from lib/public/iuserbackend.php) | 0 | ||||
-rw-r--r-- | lib/public/IUserManager.php (renamed from lib/public/iusermanager.php) | 0 | ||||
-rw-r--r-- | lib/public/IUserSession.php (renamed from lib/public/iusersession.php) | 0 | ||||
-rw-r--r-- | lib/public/Image.php (renamed from lib/public/image.php) | 0 | ||||
-rw-r--r-- | lib/public/JSON.php (renamed from lib/public/json.php) | 0 | ||||
-rw-r--r-- | lib/public/Lock/ILockingProvider.php (renamed from lib/public/lock/ilockingprovider.php) | 0 | ||||
-rw-r--r-- | lib/public/Lock/LockedException.php (renamed from lib/public/lock/lockedexception.php) | 0 | ||||
-rw-r--r-- | lib/public/Mail/IMailer.php (renamed from lib/public/mail/imailer.php) | 0 | ||||
-rw-r--r-- | lib/public/Migration/IOutput.php (renamed from lib/public/migration/ioutput.php) | 0 | ||||
-rw-r--r-- | lib/public/Migration/IRepairStep.php (renamed from lib/public/migration/irepairstep.php) | 0 | ||||
-rw-r--r-- | lib/public/Notification/IAction.php (renamed from lib/public/notification/iaction.php) | 0 | ||||
-rw-r--r-- | lib/public/Notification/IApp.php (renamed from lib/public/notification/iapp.php) | 0 | ||||
-rw-r--r-- | lib/public/Notification/IManager.php (renamed from lib/public/notification/imanager.php) | 0 | ||||
-rw-r--r-- | lib/public/Notification/INotification.php (renamed from lib/public/notification/inotification.php) | 0 | ||||
-rw-r--r-- | lib/public/Notification/INotifier.php (renamed from lib/public/notification/inotifier.php) | 0 | ||||
-rw-r--r-- | lib/public/PreConditionNotMetException.php (renamed from lib/public/preconditionnotmetexception.php) | 0 | ||||
-rw-r--r-- | lib/public/Preview/IProvider.php (renamed from lib/public/preview/iprovider.php) | 0 | ||||
-rw-r--r-- | lib/public/Response.php (renamed from lib/public/response.php) | 0 | ||||
-rw-r--r-- | lib/public/Route/IRoute.php (renamed from lib/public/route/iroute.php) | 0 | ||||
-rw-r--r-- | lib/public/Route/IRouter.php (renamed from lib/public/route/irouter.php) | 0 | ||||
-rw-r--r-- | lib/public/SabrePluginEvent.php (renamed from lib/public/sabrepluginevent.php) | 0 | ||||
-rw-r--r-- | lib/public/SabrePluginException.php (renamed from lib/public/sabrepluginexception.php) | 0 | ||||
-rw-r--r-- | lib/public/Security/IContentSecurityPolicyManager.php (renamed from lib/public/security/icontentsecuritypolicymanager.php) | 0 | ||||
-rw-r--r-- | lib/public/Security/ICredentialsManager.php (renamed from lib/public/security/icredentialsmanager.php) | 0 | ||||
-rw-r--r-- | lib/public/Security/ICrypto.php (renamed from lib/public/security/icrypto.php) | 0 | ||||
-rw-r--r-- | lib/public/Security/IHasher.php (renamed from lib/public/security/ihasher.php) | 0 | ||||
-rw-r--r-- | lib/public/Security/ISecureRandom.php (renamed from lib/public/security/isecurerandom.php) | 0 | ||||
-rw-r--r-- | lib/public/Security/StringUtils.php (renamed from lib/public/security/stringutils.php) | 0 | ||||
-rw-r--r-- | lib/public/Share.php (renamed from lib/public/share.php) | 0 | ||||
-rw-r--r-- | lib/public/Share_Backend.php (renamed from lib/public/share_backend.php) | 0 | ||||
-rw-r--r-- | lib/public/Share_Backend_Collection.php (renamed from lib/public/share_backend_collection.php) | 0 | ||||
-rw-r--r-- | lib/public/Share_Backend_File_Dependent.php (renamed from lib/public/share_backend_file_dependent.php) | 0 | ||||
-rw-r--r-- | lib/public/SystemTag/ISystemTag.php (renamed from lib/public/systemtag/isystemtag.php) | 0 | ||||
-rw-r--r-- | lib/public/SystemTag/ISystemTagManager.php (renamed from lib/public/systemtag/isystemtagmanager.php) | 48 | ||||
-rw-r--r-- | lib/public/SystemTag/ISystemTagManagerFactory.php (renamed from lib/public/systemtag/isystemtagmanagerfactory.php) | 0 | ||||
-rw-r--r-- | lib/public/SystemTag/ISystemTagObjectMapper.php (renamed from lib/public/systemtag/isystemtagobjectmapper.php) | 0 | ||||
-rw-r--r-- | lib/public/SystemTag/ManagerEvent.php (renamed from lib/public/systemtag/managerevent.php) | 0 | ||||
-rw-r--r-- | lib/public/SystemTag/MapperEvent.php (renamed from lib/public/systemtag/mapperevent.php) | 0 | ||||
-rw-r--r-- | lib/public/SystemTag/TagAlreadyExistsException.php (renamed from lib/public/systemtag/tagalreadyexistsexception.php) | 0 | ||||
-rw-r--r-- | lib/public/SystemTag/TagNotFoundException.php (renamed from lib/public/systemtag/tagnotfoundexception.php) | 0 | ||||
-rw-r--r-- | lib/public/Template.php (renamed from lib/public/template.php) | 0 | ||||
-rw-r--r-- | lib/public/User.php (renamed from lib/public/user.php) | 0 | ||||
-rw-r--r-- | lib/public/UserInterface.php (renamed from lib/public/userinterface.php) | 0 | ||||
-rw-r--r-- | lib/public/Util.php (renamed from lib/public/util.php) | 0 | ||||
-rw-r--r-- | ocs-provider/index.php | 3 | ||||
-rw-r--r-- | ocs/routes.php | 42 | ||||
-rw-r--r-- | settings/js/settings.js | 15 | ||||
-rw-r--r-- | settings/l10n/lv.js | 3 | ||||
-rw-r--r-- | settings/l10n/lv.json | 3 | ||||
-rw-r--r-- | settings/l10n/ro.js | 2 | ||||
-rw-r--r-- | settings/l10n/ro.json | 2 | ||||
-rw-r--r-- | tests/bootstrap.php | 3 | ||||
-rw-r--r-- | tests/lib/APITest.php (renamed from tests/lib/api.php) | 14 | ||||
-rw-r--r-- | tests/lib/Activity/ManagerTest.php (renamed from tests/lib/activity/managertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/AllConfigTest.php (renamed from tests/lib/allconfig.php) | 4 | ||||
-rw-r--r-- | tests/lib/App/CodeChecker/CodeCheckerTest.php (renamed from tests/lib/app/codechecker/codecheckertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/App/CodeChecker/DeprecationCheckTest.php (renamed from tests/lib/app/codechecker/deprecationchecktest.php) | 0 | ||||
-rw-r--r-- | tests/lib/App/CodeChecker/InfoCheckerTest.php (renamed from tests/lib/app/codechecker/infocheckertest.php) | 5 | ||||
-rw-r--r-- | tests/lib/App/CodeChecker/Mock/TestList.php (renamed from tests/lib/app/codechecker/mock/testlist.php) | 0 | ||||
-rw-r--r-- | tests/lib/App/CodeChecker/NodeVisitorTest.php (renamed from tests/lib/app/codechecker/nodevisitortest.php) | 2 | ||||
-rw-r--r-- | tests/lib/App/CodeChecker/StrongComparisonCheckTest.php (renamed from tests/lib/app/codechecker/strongcomparisonchecktest.php) | 0 | ||||
-rw-r--r-- | tests/lib/App/DependencyAnalyzerTest.php (renamed from tests/lib/app/dependencyanalyzer.php) | 2 | ||||
-rw-r--r-- | tests/lib/App/InfoParserTest.php (renamed from tests/lib/app/infoparser.php) | 2 | ||||
-rw-r--r-- | tests/lib/App/ManagerTest.php (renamed from tests/lib/app/manager.php) | 2 | ||||
-rw-r--r-- | tests/lib/App/PlatformRepositoryTest.php (renamed from tests/lib/app/platformrepository.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppConfigTest.php (renamed from tests/lib/appconfig.php) | 10 | ||||
-rw-r--r-- | tests/lib/AppFramework/AppTest.php (renamed from tests/lib/appframework/AppTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Controller/ApiControllerTest.php (renamed from tests/lib/appframework/controller/ApiControllerTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Controller/ControllerTest.php (renamed from tests/lib/appframework/controller/ControllerTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Controller/OCSControllerTest.php (renamed from tests/lib/appframework/controller/OCSControllerTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Db/EntityTest.php (renamed from tests/lib/appframework/db/EntityTest.php) | 5 | ||||
-rw-r--r-- | tests/lib/AppFramework/Db/MapperTest.php (renamed from tests/lib/appframework/db/mappertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/AppFramework/Db/MapperTestUtility.php (renamed from tests/lib/appframework/db/mappertestutility.php) | 0 | ||||
-rw-r--r-- | tests/lib/AppFramework/DependencyInjection/DIContainerTest.php (renamed from tests/lib/appframework/dependencyinjection/DIContainerTest.php) | 4 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php (renamed from tests/lib/appframework/http/ContentSecurityPolicyTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/DataResponseTest.php (renamed from tests/lib/appframework/http/DataResponseTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/DispatcherTest.php (renamed from tests/lib/appframework/http/DispatcherTest.php) | 4 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/DownloadResponseTest.php (renamed from tests/lib/appframework/http/DownloadResponseTest.php) | 4 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php (renamed from tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/HttpTest.php (renamed from tests/lib/appframework/http/HttpTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/JSONResponseTest.php (renamed from tests/lib/appframework/http/JSONResponseTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/OCSResponseTest.php (renamed from tests/lib/appframework/http/OCSResponseTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/RedirectResponseTest.php (renamed from tests/lib/appframework/http/RedirectResponseTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/RequestStream.php (renamed from tests/lib/appframework/http/requeststream.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/RequestTest.php (renamed from tests/lib/appframework/http/RequestTest.php) | 6 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/ResponseTest.php (renamed from tests/lib/appframework/http/ResponseTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/StreamResponseTest.php (renamed from tests/lib/appframework/http/StreamResponseTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/TemplateResponseTest.php (renamed from tests/lib/appframework/http/TemplateResponseTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php (renamed from tests/lib/appframework/middleware/MiddlewareDispatcherTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/MiddlewareTest.php (renamed from tests/lib/appframework/middleware/MiddlewareTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php (renamed from tests/lib/appframework/middleware/security/CORSMiddlewareTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php (renamed from tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php (renamed from tests/lib/appframework/middleware/sessionmiddlewaretest.php) | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Routing/RoutingTest.php (renamed from tests/lib/appframework/routing/RoutingTest.php) | 4 | ||||
-rw-r--r-- | tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php (renamed from tests/lib/appframework/utility/ControllerMethodReflectorTest.php) | 26 | ||||
-rw-r--r-- | tests/lib/AppFramework/Utility/SimpleContainerTest.php (renamed from tests/lib/appframework/utility/SimpleContainerTest.php) | 0 | ||||
-rw-r--r-- | tests/lib/AppTest.php (renamed from tests/lib/app.php) | 15 | ||||
-rw-r--r-- | tests/lib/Archive/TARTest.php (renamed from tests/lib/archive/tar.php) | 11 | ||||
-rw-r--r-- | tests/lib/Archive/TestBase.php (renamed from tests/lib/archive.php) | 33 | ||||
-rw-r--r-- | tests/lib/Archive/ZIPTest.php (renamed from tests/lib/archive/zip.php) | 11 | ||||
-rw-r--r-- | tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php (renamed from tests/lib/authentication/token/defaulttokencleanupjobtest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Authentication/Token/DefaultTokenMapperTest.php (renamed from tests/lib/authentication/token/defaulttokenmappertest.php) | 18 | ||||
-rw-r--r-- | tests/lib/Authentication/Token/DefaultTokenProviderTest.php (renamed from tests/lib/authentication/token/defaulttokenprovidertest.php) | 10 | ||||
-rw-r--r-- | tests/lib/AutoLoaderTest.php (renamed from tests/lib/autoloader.php) | 30 | ||||
-rw-r--r-- | tests/lib/AvatarManagerTest.php (renamed from tests/lib/avatarmanagertest.php) | 5 | ||||
-rw-r--r-- | tests/lib/AvatarTest.php (renamed from tests/lib/avatartest.php) | 19 | ||||
-rw-r--r-- | tests/lib/BackgroundJob/DummyJobList.php (renamed from tests/lib/backgroundjob/dummyjoblist.php) | 0 | ||||
-rw-r--r-- | tests/lib/BackgroundJob/JobListTest.php (renamed from tests/lib/backgroundjob/joblist.php) | 128 | ||||
-rw-r--r-- | tests/lib/BackgroundJob/JobTest.php (renamed from tests/lib/backgroundjob/job.php) | 2 | ||||
-rw-r--r-- | tests/lib/BackgroundJob/QueuedJobTest.php (renamed from tests/lib/backgroundjob/queuedjob.php) | 4 | ||||
-rw-r--r-- | tests/lib/BackgroundJob/TestJob.php (renamed from tests/lib/backgroundjob/testjob.php) | 2 | ||||
-rw-r--r-- | tests/lib/BackgroundJob/TimedJobTest.php (renamed from tests/lib/backgroundjob/timedjob.php) | 4 | ||||
-rw-r--r-- | tests/lib/Cache/CappedMemoryCacheTest.php (renamed from tests/lib/cache/cappedmemorycache.php) | 4 | ||||
-rw-r--r-- | tests/lib/Cache/FileCacheTest.php (renamed from tests/lib/cache/file.php) | 4 | ||||
-rw-r--r-- | tests/lib/Cache/TestCache.php (renamed from tests/lib/cache.php) | 4 | ||||
-rw-r--r-- | tests/lib/CapabilitiesManagerTest.php (renamed from tests/lib/capabilitiesmanager.php) | 2 | ||||
-rw-r--r-- | tests/lib/Command/AsyncBusTest.php (renamed from tests/lib/command/asyncbus.php) | 16 | ||||
-rw-r--r-- | tests/lib/Command/BackgroundJobsTest.php (renamed from tests/lib/command/background.php) | 2 | ||||
-rw-r--r-- | tests/lib/Command/Integrity/SignAppTest.php (renamed from tests/lib/command/integrity/SignAppTest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Command/Integrity/SignCoreTest.php (renamed from tests/lib/command/integrity/SignCoreTest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Comments/CommentTest.php (renamed from tests/lib/comments/comment.php) | 3 | ||||
-rw-r--r-- | tests/lib/Comments/FakeFactory.php (renamed from tests/lib/comments/fakefactory.php) | 0 | ||||
-rw-r--r-- | tests/lib/Comments/FakeManager.php (renamed from tests/lib/comments/fakemanager.php) | 0 | ||||
-rw-r--r-- | tests/lib/Comments/ManagerTest.php (renamed from tests/lib/comments/manager.php) | 5 | ||||
-rw-r--r-- | tests/lib/ConfigTest.php (renamed from tests/lib/configtests.php) | 2 | ||||
-rw-r--r-- | tests/lib/ContactsManagerTest.php (renamed from tests/lib/contactsmanager.php) | 5 | ||||
-rw-r--r-- | tests/lib/DB/ConnectionTest.php (renamed from tests/lib/db/connection.php) | 2 | ||||
-rw-r--r-- | tests/lib/DB/DBSchemaTest.php (renamed from tests/lib/dbschema.php) | 12 | ||||
-rw-r--r-- | tests/lib/DB/LegacyDBTest.php (renamed from tests/lib/db.php) | 10 | ||||
-rw-r--r-- | tests/lib/DB/MDB2SchemaManagerTest.php (renamed from tests/lib/db/mdb2schemamanager.php) | 2 | ||||
-rw-r--r-- | tests/lib/DB/MDB2SchemaReaderTest.php (renamed from tests/lib/db/mdb2schemareader.php) | 2 | ||||
-rw-r--r-- | tests/lib/DB/MigratorTest.php (renamed from tests/lib/db/migrator.php) | 4 | ||||
-rw-r--r-- | tests/lib/DB/MySqlMigrationTest.php (renamed from tests/lib/db/mysqlmigration.php) | 6 | ||||
-rw-r--r-- | tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php (renamed from tests/lib/db/querybuilder/expressionbuildertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/DB/QueryBuilder/QueryBuilderTest.php (renamed from tests/lib/db/querybuilder/querybuildertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/DB/QueryBuilder/QuoteHelperTest.php (renamed from tests/lib/db/querybuilder/quotehelpertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/DB/SqliteMigrationTest.php (renamed from tests/lib/db/sqlitemigration.php) | 6 | ||||
-rw-r--r-- | tests/lib/DB/testschema.xml (renamed from tests/lib/db/testschema.xml) | 0 | ||||
-rw-r--r-- | tests/lib/DB/ts-autoincrement-after.xml (renamed from tests/lib/db/ts-autoincrement-after.xml) | 0 | ||||
-rw-r--r-- | tests/lib/DB/ts-autoincrement-before.xml (renamed from tests/lib/db/ts-autoincrement-before.xml) | 0 | ||||
-rw-r--r-- | tests/lib/DateTimeFormatterTest.php (renamed from tests/lib/datetimeformatter.php) | 2 | ||||
-rw-r--r-- | tests/lib/Encryption/DecryptAllTest.php (renamed from tests/lib/encryption/decryptalltest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Encryption/EncryptionWrapperTest.php (renamed from tests/lib/encryption/encryptionwrappertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Encryption/Keys/StorageTest.php (renamed from tests/lib/encryption/keys/storage.php) | 0 | ||||
-rw-r--r-- | tests/lib/Encryption/ManagerTest.php (renamed from tests/lib/encryption/managertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Encryption/UpdateTest.php (renamed from tests/lib/encryption/updatetest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Encryption/UtilTest.php (renamed from tests/lib/encryption/utiltest.php) | 0 | ||||
-rw-r--r-- | tests/lib/ErrorHandlerTest.php (renamed from tests/lib/errorHandler.php) | 4 | ||||
-rw-r--r-- | tests/lib/FileChunkingTest.php (renamed from tests/lib/filechunking.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Cache/CacheTest.php (renamed from tests/lib/files/cache/cache.php) | 7 | ||||
-rw-r--r-- | tests/lib/Files/Cache/HomeCacheTest.php (renamed from tests/lib/files/cache/homecache.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Cache/MoveFromCacheTraitTest.php (renamed from tests/lib/files/cache/movefromcachetraittest.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Cache/ScannerTest.php (renamed from tests/lib/files/cache/scanner.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Cache/UpdaterLegacyTest.php (renamed from tests/lib/files/cache/updaterlegacy.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Cache/UpdaterTest.php (renamed from tests/lib/files/cache/updater.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Cache/WatcherTest.php (renamed from tests/lib/files/cache/watcher.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Cache/Wrapper/CacheJailTest.php (renamed from tests/lib/files/cache/wrapper/cachejail.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php (renamed from tests/lib/files/cache/wrapper/cachepermissionsmask.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Config/UserMountCacheTest.php (renamed from tests/lib/files/config/usermountcache.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/EtagTest.php (renamed from tests/lib/files/etagtest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Files/FilesystemTest.php (renamed from tests/lib/files/filesystem.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Mount/ManagerTest.php (renamed from tests/lib/files/mount/manager.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Mount/MountPointTest.php (renamed from tests/lib/files/mount/mountpoint.php) | 6 | ||||
-rw-r--r-- | tests/lib/Files/Mount/MountTest.php (renamed from tests/lib/files/mount/mount.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Node/FileTest.php (renamed from tests/lib/files/node/file.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Node/FolderTest.php (renamed from tests/lib/files/node/folder.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Node/HookConnectorTest.php (renamed from tests/lib/files/node/hookconnector.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Node/IntegrationTest.php (renamed from tests/lib/files/node/integration.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Node/NodeTest.php (renamed from tests/lib/files/node/node.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Node/RootTest.php (renamed from tests/lib/files/node/root.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/ObjectStore/NoopScannerTest.php (renamed from tests/lib/files/objectstore/noopscanner.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/ObjectStore/SwiftTest.php (renamed from tests/lib/files/objectstore/swift.php) | 14 | ||||
-rw-r--r-- | tests/lib/Files/PathVerificationTest.php (renamed from tests/lib/files/pathverificationtest.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Storage/CommonTest.php (renamed from tests/lib/files/storage/commontest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Files/Storage/CopyDirectoryTest.php (renamed from tests/lib/files/storage/copydirectory.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Storage/HomeStorageQuotaTest.php (renamed from tests/lib/files/storage/homestoragequota.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Storage/HomeTest.php (renamed from tests/lib/files/storage/home.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Storage/LocalTest.php (renamed from tests/lib/files/storage/local.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Storage.php (renamed from tests/lib/files/storage/storage.php) | 0 | ||||
-rw-r--r-- | tests/lib/Files/Storage/StorageFactoryTest.php (renamed from tests/lib/files/storage/storagefactory.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/AvailabilityTest.php (renamed from tests/lib/files/storage/wrapper/availability.php) | 3 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/EncryptionTest.php (renamed from tests/lib/files/storage/wrapper/encryption.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/JailTest.php (renamed from tests/lib/files/storage/wrapper/jail.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php (renamed from tests/lib/files/storage/wrapper/permissionsmask.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/QuotaTest.php (renamed from tests/lib/files/storage/wrapper/quota.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/Storage/Wrapper/WrapperTest.php (renamed from tests/lib/files/storage/wrapper/wrapper.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Stream/DummyEncryptionWrapper.php (renamed from tests/lib/files/stream/dummyencryptionwrapper.php) | 0 | ||||
-rw-r--r-- | tests/lib/Files/Stream/EncryptionTest.php (renamed from tests/lib/files/stream/encryption.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Stream/QuotaTest.php (renamed from tests/lib/files/stream/quota.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Stream/StaticStreamTest.php (renamed from tests/lib/files/stream/staticstream.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Type/DetectionTest.php (renamed from tests/lib/files/type/detection.php) | 0 | ||||
-rw-r--r-- | tests/lib/Files/Type/LoaderTest.php (renamed from tests/lib/files/type/loadertest.php) | 2 | ||||
-rw-r--r-- | tests/lib/Files/Utils/ScannerTest.php (renamed from tests/lib/files/utils/scanner.php) | 4 | ||||
-rw-r--r-- | tests/lib/Files/ViewTest.php (renamed from tests/lib/files/view.php) | 8 | ||||
-rw-r--r-- | tests/lib/FilesTest.php (renamed from tests/lib/files.php) | 2 | ||||
-rw-r--r-- | tests/lib/Group/Backend.php (renamed from tests/lib/group/backend.php) | 6 | ||||
-rw-r--r-- | tests/lib/Group/DatabaseTest.php (renamed from tests/lib/group/database.php) | 6 | ||||
-rw-r--r-- | tests/lib/Group/Dummy.php (renamed from tests/lib/group/dummy.php) | 6 | ||||
-rw-r--r-- | tests/lib/Group/GroupTest.php (renamed from tests/lib/group/group.php) | 2 | ||||
-rw-r--r-- | tests/lib/Group/LegacyGroupTest.php (renamed from tests/lib/group.php) | 7 | ||||
-rw-r--r-- | tests/lib/Group/ManagerTest.php (renamed from tests/lib/group/manager.php) | 2 | ||||
-rw-r--r-- | tests/lib/Group/MetaDataTest.php (renamed from tests/lib/group/metadata.php) | 2 | ||||
-rw-r--r-- | tests/lib/HTTPHelperTest.php (renamed from tests/lib/httphelper.php) | 4 | ||||
-rw-r--r-- | tests/lib/HelperStorageTest.php (renamed from tests/lib/helperstorage.php) | 4 | ||||
-rw-r--r-- | tests/lib/HookHelper.php (renamed from tests/lib/hookhelper.php) | 0 | ||||
-rw-r--r-- | tests/lib/Hooks/BasicEmitterTest.php (renamed from tests/lib/hooks/basicemitter.php) | 4 | ||||
-rw-r--r-- | tests/lib/Hooks/ForwardingEmitterTest.php (renamed from tests/lib/hooks/forwardingemitter.php) | 2 | ||||
-rw-r--r-- | tests/lib/Hooks/LegacyEmitterTest.php (renamed from tests/lib/hooks/legacyemitter.php) | 6 | ||||
-rw-r--r-- | tests/lib/Http/Client/ClientServiceTest.php (renamed from tests/lib/http/client/clientservicetest.php) | 4 | ||||
-rw-r--r-- | tests/lib/Http/Client/ClientTest.php (renamed from tests/lib/http/client/clienttest.php) | 3 | ||||
-rw-r--r-- | tests/lib/Http/Client/ResponseTest.php (renamed from tests/lib/http/client/responsetest.php) | 3 | ||||
-rw-r--r-- | tests/lib/ImageTest.php (renamed from tests/lib/image.php) | 6 | ||||
-rw-r--r-- | tests/lib/IntegrityCheck/CheckerTest.php (renamed from tests/lib/integritycheck/checkertest.php) | 1 | ||||
-rw-r--r-- | tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php (renamed from tests/lib/integritycheck/helpers/AppLocatorTest.php) | 0 | ||||
-rw-r--r-- | tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php (renamed from tests/lib/integritycheck/helpers/EnvironmentHelperTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php (renamed from tests/lib/integritycheck/helpers/FileAccessHelperTest.php) | 0 | ||||
-rw-r--r-- | tests/lib/L10N/FactoryTest.php (renamed from tests/lib/l10n/factorytest.php) | 0 | ||||
-rw-r--r-- | tests/lib/L10N/L10nLegacyTest.php (renamed from tests/lib/l10n/l10nlegacytest.php) | 0 | ||||
-rw-r--r-- | tests/lib/L10N/L10nTest.php (renamed from tests/lib/l10n/l10ntest.php) | 0 | ||||
-rw-r--r-- | tests/lib/LargeFileHelperGetFileSizeTest.php (renamed from tests/lib/largefilehelpergetfilesize.php) | 2 | ||||
-rw-r--r-- | tests/lib/LargeFileHelperTest.php (renamed from tests/lib/largefilehelper.php) | 2 | ||||
-rw-r--r-- | tests/lib/LegacyHelperTest.php (renamed from tests/lib/helper.php) | 6 | ||||
-rw-r--r-- | tests/lib/Lock/DBLockingProviderTest.php (renamed from tests/lib/lock/dblockingprovider.php) | 2 | ||||
-rw-r--r-- | tests/lib/Lock/LockingProvider.php (renamed from tests/lib/lock/lockingprovider.php) | 0 | ||||
-rw-r--r-- | tests/lib/Lock/MemcacheLockingProviderTest.php (renamed from tests/lib/lock/memcachelockingprovider.php) | 2 | ||||
-rw-r--r-- | tests/lib/Log/OwncloudTest.php (renamed from tests/lib/log/owncloud.php) | 0 | ||||
-rw-r--r-- | tests/lib/LoggerTest.php (renamed from tests/lib/logger.php) | 4 | ||||
-rw-r--r-- | tests/lib/Mail/MailerTest.php (renamed from tests/lib/mail/mailer.php) | 4 | ||||
-rw-r--r-- | tests/lib/Mail/MessageTest.php (renamed from tests/lib/mail/message.php) | 3 | ||||
-rw-r--r-- | tests/lib/Memcache/APCTest.php (renamed from tests/lib/memcache/apc.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/APCuTest.php (renamed from tests/lib/memcache/apcu.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/ArrayCacheTest.php (renamed from tests/lib/memcache/arraycache.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/Cache.php (renamed from tests/lib/memcache/cache.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/CasTraitTest.php (renamed from tests/lib/memcache/castrait.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/FactoryTest.php (renamed from tests/lib/memcache/factory.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/MemcachedTest.php (renamed from tests/lib/memcache/memcached.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/RedisTest.php (renamed from tests/lib/memcache/redis.php) | 2 | ||||
-rw-r--r-- | tests/lib/Memcache/XCacheTest.php (renamed from tests/lib/memcache/xcache.php) | 2 | ||||
-rw-r--r-- | tests/lib/Migration/BackgroundRepairTest.php (renamed from tests/lib/migration/BackgroundRepairTest.php) | 0 | ||||
-rw-r--r-- | tests/lib/NaturalSortTest.php (renamed from tests/lib/naturalsort.php) | 4 | ||||
-rw-r--r-- | tests/lib/NavigationManagerTest.php (renamed from tests/lib/navigationmanagertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Notification/ActionTest.php (renamed from tests/lib/notification/actiontest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Notification/ManagerTest.php (renamed from tests/lib/notification/managertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Notification/NotificationTest.php (renamed from tests/lib/notification/notificationtest.php) | 0 | ||||
-rw-r--r-- | tests/lib/OCS/MapStatusCodeTest.php (renamed from tests/ocs/response.php) | 10 | ||||
-rw-r--r-- | tests/lib/OCS/PrivatedataTest.php (renamed from tests/lib/ocs/privatedata.php) | 8 | ||||
-rw-r--r-- | tests/lib/OCS/ProviderTest.php (renamed from tests/ocs-provider/provider.php) | 8 | ||||
-rw-r--r-- | tests/lib/OCSClientTest.php (renamed from tests/lib/ocsclienttest.php) | 2 | ||||
-rw-r--r-- | tests/lib/Preview/BitmapTest.php (renamed from tests/lib/preview/bitmap.php) | 4 | ||||
-rw-r--r-- | tests/lib/Preview/ImageTest.php (renamed from tests/lib/preview/image.php) | 4 | ||||
-rw-r--r-- | tests/lib/Preview/MP3Test.php (renamed from tests/lib/preview/mp3.php) | 4 | ||||
-rw-r--r-- | tests/lib/Preview/MovieTest.php (renamed from tests/lib/preview/movie.php) | 4 | ||||
-rw-r--r-- | tests/lib/Preview/OfficeTest.php (renamed from tests/lib/preview/office.php) | 4 | ||||
-rw-r--r-- | tests/lib/Preview/Provider.php (renamed from tests/lib/preview/provider.php) | 0 | ||||
-rw-r--r-- | tests/lib/Preview/SVGTest.php (renamed from tests/lib/preview/svg.php) | 4 | ||||
-rw-r--r-- | tests/lib/Preview/TXTTest.php (renamed from tests/lib/preview/txt.php) | 4 | ||||
-rw-r--r-- | tests/lib/PreviewTest.php (renamed from tests/lib/preview.php) | 4 | ||||
-rw-r--r-- | tests/lib/PublicNamespace/ContactsTest.php (renamed from tests/lib/public/contacts.php) | 30 | ||||
-rw-r--r-- | tests/lib/PublicNamespace/OCPConfigTest.php (renamed from tests/lib/public/ocpconfig.php) | 4 | ||||
-rw-r--r-- | tests/lib/PublicNamespace/UtilTest.php (renamed from tests/lib/public/util.php) | 7 | ||||
-rw-r--r-- | tests/lib/Repair/CleanTagsTest.php (renamed from tests/lib/repair/cleantags.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/DropOldJobsTest.php (renamed from tests/lib/repair/dropoldjobs.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/DropOldTablesTest.php (renamed from tests/lib/repair/dropoldtables.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/OldGroupMembershipSharesTest.php (renamed from tests/lib/repair/oldgroupmembershipsharestest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Repair/RemoveGetETagEntriesTest.php (renamed from tests/lib/repair/removegetetagentriestest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Repair/RepairCollationTest.php (renamed from tests/lib/repair/repaircollation.php) | 5 | ||||
-rw-r--r-- | tests/lib/Repair/RepairInnoDBTest.php (renamed from tests/lib/repair/repairinnodb.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/RepairInvalidSharesTest.php (renamed from tests/lib/repair/repairinvalidsharestest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Repair/RepairLegacyStoragesTest.php (renamed from tests/lib/repair/repairlegacystorage.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/RepairMimeTypesTest.php (renamed from tests/lib/repair/repairmimetypes.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/RepairSharePropagationTest.php (renamed from tests/lib/repair/repairsharepropagation.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/RepairSqliteAutoincrementTest.php (renamed from tests/lib/repair/repairsqliteautoincrement.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/UpdateOutdatedOcsIdsTest.php (renamed from tests/lib/repair/updateoutdatedocsids.php) | 2 | ||||
-rw-r--r-- | tests/lib/Repair/fixtures/dropoldtables.xml (renamed from tests/lib/repair/fixtures/dropoldtables.xml) | 0 | ||||
-rw-r--r-- | tests/lib/RepairStepTest.php (renamed from tests/lib/RepairTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php (renamed from tests/lib/security/csp/ContentSecurityPolicyManagerTest.php) | 3 | ||||
-rw-r--r-- | tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php (renamed from tests/lib/security/csrf/CsrfTokenGeneratorTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/CSRF/CsrfTokenManagerTest.php (renamed from tests/lib/security/csrf/CsrfTokenManagerTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/CSRF/CsrfTokenTest.php (renamed from tests/lib/security/csrf/CsrfTokenTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php (renamed from tests/lib/security/csrf/tokenstorage/SessionStorageTest.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/CertificateManagerTest.php (renamed from tests/lib/security/certificatemanager.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/CertificateTest.php (renamed from tests/lib/security/certificate.php) | 12 | ||||
-rw-r--r-- | tests/lib/Security/CredentialsManagerTest.php (renamed from tests/lib/security/credentialsmanager.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/CryptoTest.php (renamed from tests/lib/security/crypto.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/HasherTest.php (renamed from tests/lib/security/hasher.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/SecureRandomTest.php (renamed from tests/lib/security/securerandom.php) | 2 | ||||
-rw-r--r-- | tests/lib/Security/TrustedDomainHelperTest.php (renamed from tests/lib/security/trusteddomainhelper.php) | 2 | ||||
-rw-r--r-- | tests/lib/ServerTest.php (renamed from tests/lib/server.php) | 2 | ||||
-rw-r--r-- | tests/lib/Session/CryptoSessionDataTest.php (renamed from tests/lib/session/cryptosessiondatatest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Session/CryptoWrappingTest.php (renamed from tests/lib/session/cryptowrappingtest.php) | 0 | ||||
-rw-r--r-- | tests/lib/Session/MemoryTest.php (renamed from tests/lib/session/memory.php) | 4 | ||||
-rw-r--r-- | tests/lib/Session/Session.php (renamed from tests/lib/session/session.php) | 0 | ||||
-rw-r--r-- | tests/lib/SetupTest.php (renamed from tests/lib/setup.php) | 18 | ||||
-rw-r--r-- | tests/lib/Share/Backend.php (renamed from tests/lib/share/backend.php) | 4 | ||||
-rw-r--r-- | tests/lib/Share/HelperTest.php (renamed from tests/lib/share/helper.php) | 6 | ||||
-rw-r--r-- | tests/lib/Share/MailNotificationsTest.php (renamed from tests/lib/share/MailNotificationsTest.php) | 14 | ||||
-rw-r--r-- | tests/lib/Share/SearchResultSorterTest.php (renamed from tests/lib/share/searchresultsorter.php) | 4 | ||||
-rw-r--r-- | tests/lib/Share/ShareTest.php (renamed from tests/lib/share/share.php) | 490 | ||||
-rw-r--r-- | tests/lib/Share20/DefaultShareProviderTest.php (renamed from tests/lib/share20/defaultshareprovidertest.php) | 8 | ||||
-rw-r--r-- | tests/lib/Share20/ManagerTest.php (renamed from tests/lib/share20/managertest.php) | 5 | ||||
-rw-r--r-- | tests/lib/Share20/ShareTest.php (renamed from tests/lib/share20/sharetest.php) | 3 | ||||
-rw-r--r-- | tests/lib/StreamWrappersTest.php (renamed from tests/lib/streamwrappers.php) | 8 | ||||
-rw-r--r-- | tests/lib/SubAdminTest.php (renamed from tests/lib/subadmin.php) | 2 | ||||
-rw-r--r-- | tests/lib/SystemTag/SystemTagManagerTest.php (renamed from tests/lib/systemtag/systemtagmanagertest.php) | 106 | ||||
-rw-r--r-- | tests/lib/SystemTag/SystemTagObjectMapperTest.php (renamed from tests/lib/systemtag/systemtagobjectmappertest.php) | 0 | ||||
-rw-r--r-- | tests/lib/TagsTest.php (renamed from tests/lib/tags.php) | 36 | ||||
-rw-r--r-- | tests/lib/TempManagerTest.php (renamed from tests/lib/tempmanager.php) | 2 | ||||
-rw-r--r-- | tests/lib/Template/ResourceLocatorTest.php (renamed from tests/lib/template/resourcelocator.php) | 2 | ||||
-rw-r--r-- | tests/lib/TemplateFunctionsTest.php (renamed from tests/lib/template.php) | 8 | ||||
-rw-r--r-- | tests/lib/TestCase.php (renamed from tests/lib/testcase.php) | 0 | ||||
-rw-r--r-- | tests/lib/TestMoveableMountPoint.php (renamed from tests/lib/testmoveablemountpoint.php) | 0 | ||||
-rw-r--r-- | tests/lib/Traits/EncryptionTrait.php (renamed from tests/lib/traits/encryptiontrait.php) | 0 | ||||
-rw-r--r-- | tests/lib/Traits/MountProviderTrait.php (renamed from tests/lib/traits/mountprovidertrait.php) | 0 | ||||
-rw-r--r-- | tests/lib/Traits/UserTrait.php (renamed from tests/lib/traits/usertrait.php) | 0 | ||||
-rw-r--r-- | tests/lib/Updater/VersionCheckTest.php (renamed from tests/lib/updater/versioncheck.php) | 2 | ||||
-rw-r--r-- | tests/lib/UpdaterTest.php (renamed from tests/lib/updater.php) | 3 | ||||
-rw-r--r-- | tests/lib/UrlGeneratorTest.php (renamed from tests/lib/urlGenerator.php) | 6 | ||||
-rw-r--r-- | tests/lib/User/AvatarUserDummy.php (renamed from tests/lib/user/avataruserdummy.php) | 6 | ||||
-rw-r--r-- | tests/lib/User/Backend.php (renamed from tests/lib/user/backend.php) | 4 | ||||
-rw-r--r-- | tests/lib/User/DatabaseTest.php (renamed from tests/lib/user/database.php) | 6 | ||||
-rw-r--r-- | tests/lib/User/Dummy.php (renamed from tests/lib/user/dummy.php) | 4 | ||||
-rw-r--r-- | tests/lib/User/ManagerTest.php (renamed from tests/lib/user/manager.php) | 4 | ||||
-rw-r--r-- | tests/lib/User/SessionTest.php (renamed from tests/lib/user/session.php) | 34 | ||||
-rw-r--r-- | tests/lib/User/UserTest.php (renamed from tests/lib/user/user.php) | 13 | ||||
-rw-r--r-- | tests/lib/UserTest.php (renamed from tests/lib/user.php) | 2 | ||||
-rw-r--r-- | tests/lib/Util/Group/Dummy.php (renamed from tests/lib/util/group/dummy.php) | 0 | ||||
-rw-r--r-- | tests/lib/Util/User/Dummy.php (renamed from tests/lib/util/user/dummy.php) | 0 | ||||
-rw-r--r-- | tests/lib/UtilCheckServerTest.php (renamed from tests/lib/utilcheckserver.php) | 6 | ||||
-rw-r--r-- | tests/lib/UtilTest.php (renamed from tests/lib/util.php) | 12 | ||||
-rw-r--r-- | version.php | 2 |
621 files changed, 4943 insertions, 2070 deletions
diff --git a/.mention-bot b/.mention-bot index 3e6c0fddb67..ca3a86dd18b 100644 --- a/.mention-bot +++ b/.mention-bot @@ -14,7 +14,7 @@ "lib/private/Activity/**", "lib/private/Notification/**", "lib/public/Activity/**", - "lib/public/notification/**" + "lib/public/Notification/**" ] }, { diff --git a/apps/comments/appinfo/app.php b/apps/comments/appinfo/app.php index cd1ccb2d7d3..b060a5db1ca 100644 --- a/apps/comments/appinfo/app.php +++ b/apps/comments/appinfo/app.php @@ -51,3 +51,10 @@ $managerListener = function(\OCP\Comments\CommentsEvent $event) use ($activityMa }; $eventDispatcher->addListener(\OCP\Comments\CommentsEvent::EVENT_ADD, $managerListener); + +$eventDispatcher->addListener(\OCP\Comments\CommentsEntityEvent::EVENT_ENTITY, function(\OCP\Comments\CommentsEntityEvent $event) { + $event->addEntityCollection('files', function($name) { + $nodes = \OC::$server->getUserFolder()->getById(intval($name)); + return !empty($nodes); + }); +}); diff --git a/apps/comments/l10n/ar.js b/apps/comments/l10n/ar.js index ec211e25e43..3d8f9c0165a 100644 --- a/apps/comments/l10n/ar.js +++ b/apps/comments/l10n/ar.js @@ -1,8 +1,23 @@ OC.L10N.register( "comments", { + "Type in a new comment..." : "اكتب تعليق جديد...", + "Delete comment" : "حذف التعليق", + "Post" : "مشاركة", "Cancel" : "إلغاء", + "Edit comment" : "تعديل التعليق", + "[Deleted user]" : "[مستخدم محذوف]", + "Comments" : "تعليقات", + "No other comments available" : "لا يوجد تعليقات أخرى متاحة", + "More comments..." : "مزيد من التعليقات...", "Save" : "حفظ", - "Comment" : "تعليق" + "Allowed characters {count} of {max}" : "عدد الأحرف المسموح بها {عدد} من {العدد الأقصى}", + "{count} unread comments" : "{عدد} الرسائل الغير مقروءة", + "Comment" : "تعليق", + "<strong>Comments</strong> for files <em>(always listed in stream)</em>" : "<strong>تعليقات</strong> للملفات <em>(دائماً مصنف في جدول)</em>", + "You commented" : "قمت بكتابة تعليق", + "%1$s commented" : "%1$s قام بكتابة تعليق", + "You commented on %2$s" : "انت قمت بكتابة تعليق على %2$s", + "%1$s commented on %2$s" : "%1$s قام بكتابة تعليق على %2$s" }, "nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;"); diff --git a/apps/comments/l10n/ar.json b/apps/comments/l10n/ar.json index 8f601e76e16..9c7e9919103 100644 --- a/apps/comments/l10n/ar.json +++ b/apps/comments/l10n/ar.json @@ -1,6 +1,21 @@ { "translations": { + "Type in a new comment..." : "اكتب تعليق جديد...", + "Delete comment" : "حذف التعليق", + "Post" : "مشاركة", "Cancel" : "إلغاء", + "Edit comment" : "تعديل التعليق", + "[Deleted user]" : "[مستخدم محذوف]", + "Comments" : "تعليقات", + "No other comments available" : "لا يوجد تعليقات أخرى متاحة", + "More comments..." : "مزيد من التعليقات...", "Save" : "حفظ", - "Comment" : "تعليق" + "Allowed characters {count} of {max}" : "عدد الأحرف المسموح بها {عدد} من {العدد الأقصى}", + "{count} unread comments" : "{عدد} الرسائل الغير مقروءة", + "Comment" : "تعليق", + "<strong>Comments</strong> for files <em>(always listed in stream)</em>" : "<strong>تعليقات</strong> للملفات <em>(دائماً مصنف في جدول)</em>", + "You commented" : "قمت بكتابة تعليق", + "%1$s commented" : "%1$s قام بكتابة تعليق", + "You commented on %2$s" : "انت قمت بكتابة تعليق على %2$s", + "%1$s commented on %2$s" : "%1$s قام بكتابة تعليق على %2$s" },"pluralForm" :"nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;" }
\ No newline at end of file diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php index a55a18c00c0..8fa13da6162 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -22,11 +22,12 @@ namespace OCA\DAV\Comments; use OCP\Comments\ICommentsManager; -use OCP\Files\Folder; +use OCP\Comments\NotFoundException; use OCP\ILogger; use OCP\IUserManager; use OCP\IUserSession; use Sabre\DAV\Exception\NotFound; +use Sabre\DAV\IProperties; use Sabre\DAV\PropPatch; /** @@ -37,12 +38,9 @@ use Sabre\DAV\PropPatch; * * @package OCA\DAV\Comments */ -class EntityCollection extends RootCollection implements \Sabre\DAV\IProperties { +class EntityCollection extends RootCollection implements IProperties { const PROPERTY_NAME_READ_MARKER = '{http://owncloud.org/ns}readMarker'; - /** @var Folder */ - protected $fileRoot; - /** @var string */ protected $id; @@ -53,7 +51,6 @@ class EntityCollection extends RootCollection implements \Sabre\DAV\IProperties * @param string $id * @param string $name * @param ICommentsManager $commentsManager - * @param Folder $fileRoot * @param IUserManager $userManager * @param IUserSession $userSession * @param ILogger $logger @@ -62,7 +59,6 @@ class EntityCollection extends RootCollection implements \Sabre\DAV\IProperties $id, $name, ICommentsManager $commentsManager, - Folder $fileRoot, IUserManager $userManager, IUserSession $userSession, ILogger $logger @@ -76,7 +72,6 @@ class EntityCollection extends RootCollection implements \Sabre\DAV\IProperties $this->id = $id; $this->name = $name; $this->commentsManager = $commentsManager; - $this->fileRoot = $fileRoot; $this->logger = $logger; $this->userManager = $userManager; $this->userSession = $userSession; @@ -111,7 +106,7 @@ class EntityCollection extends RootCollection implements \Sabre\DAV\IProperties $this->userSession, $this->logger ); - } catch (\OCP\Comments\NotFoundException $e) { + } catch (NotFoundException $e) { throw new NotFound(); } } @@ -159,7 +154,7 @@ class EntityCollection extends RootCollection implements \Sabre\DAV\IProperties try { $this->commentsManager->get($name); return true; - } catch (\OCP\Comments\NotFoundException $e) { + } catch (NotFoundException $e) { return false; } } diff --git a/apps/dav/lib/Comments/EntityTypeCollection.php b/apps/dav/lib/Comments/EntityTypeCollection.php index 6bc42484207..66fdb7f8de6 100644 --- a/apps/dav/lib/Comments/EntityTypeCollection.php +++ b/apps/dav/lib/Comments/EntityTypeCollection.php @@ -22,7 +22,6 @@ namespace OCA\DAV\Comments; use OCP\Comments\ICommentsManager; -use OCP\Files\Folder; use OCP\ILogger; use OCP\IUserManager; use OCP\IUserSession; @@ -41,27 +40,31 @@ use Sabre\DAV\Exception\NotFound; * @package OCA\DAV\Comments */ class EntityTypeCollection extends RootCollection { - /** @var Folder */ - protected $fileRoot; /** @var ILogger */ protected $logger; + /** @var IUserManager */ + protected $userManager; + + /** @var \Closure */ + protected $childExistsFunction; + /** * @param string $name * @param ICommentsManager $commentsManager - * @param Folder $fileRoot * @param IUserManager $userManager * @param IUserSession $userSession * @param ILogger $logger + * @param \Closure $childExistsFunction */ public function __construct( $name, ICommentsManager $commentsManager, - Folder $fileRoot, IUserManager $userManager, IUserSession $userSession, - ILogger $logger + ILogger $logger, + \Closure $childExistsFunction ) { $name = trim($name); if(empty($name) || !is_string($name)) { @@ -69,10 +72,10 @@ class EntityTypeCollection extends RootCollection { } $this->name = $name; $this->commentsManager = $commentsManager; - $this->fileRoot = $fileRoot; $this->logger = $logger; $this->userManager = $userManager; $this->userSession = $userSession; + $this->childExistsFunction = $childExistsFunction; } /** @@ -93,7 +96,6 @@ class EntityTypeCollection extends RootCollection { $name, $this->name, $this->commentsManager, - $this->fileRoot, $this->userManager, $this->userSession, $this->logger @@ -117,9 +119,7 @@ class EntityTypeCollection extends RootCollection { * @return bool */ function childExists($name) { - $nodes = $this->fileRoot->getById(intval($name)); - return !empty($nodes); + return call_user_func($this->childExistsFunction, $name); } - } diff --git a/apps/dav/lib/Comments/RootCollection.php b/apps/dav/lib/Comments/RootCollection.php index cda666f7162..b02532b0674 100644 --- a/apps/dav/lib/Comments/RootCollection.php +++ b/apps/dav/lib/Comments/RootCollection.php @@ -21,8 +21,8 @@ namespace OCA\DAV\Comments; +use OCP\Comments\CommentsEntityEvent; use OCP\Comments\ICommentsManager; -use OCP\Files\IRootFolder; use OCP\ILogger; use OCP\IUserManager; use OCP\IUserSession; @@ -30,11 +30,12 @@ use Sabre\DAV\Exception\NotAuthenticated; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\ICollection; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; class RootCollection implements ICollection { - /** @var EntityTypeCollection[] */ - private $entityTypeCollections = []; + /** @var EntityTypeCollection[]|null */ + private $entityTypeCollections; /** @var ICommentsManager */ protected $commentsManager; @@ -47,34 +48,32 @@ class RootCollection implements ICollection { /** @var IUserManager */ protected $userManager; - /** - * @var IUserSession - */ + + /** @var IUserSession */ protected $userSession; - /** - * @var IRootFolder - */ - protected $rootFolder; + + /** @var EventDispatcherInterface */ + protected $dispatcher; /** * @param ICommentsManager $commentsManager * @param IUserManager $userManager * @param IUserSession $userSession - * @param IRootFolder $rootFolder + * @param EventDispatcherInterface $dispatcher * @param ILogger $logger */ public function __construct( ICommentsManager $commentsManager, IUserManager $userManager, IUserSession $userSession, - IRootFolder $rootFolder, + EventDispatcherInterface $dispatcher, ILogger $logger) { $this->commentsManager = $commentsManager; $this->logger = $logger; $this->userManager = $userManager; $this->userSession = $userSession; - $this->rootFolder = $rootFolder; + $this->dispatcher = $dispatcher; } /** @@ -85,22 +84,28 @@ class RootCollection implements ICollection { * @throws NotAuthenticated */ protected function initCollections() { - if(!empty($this->entityTypeCollections)) { + if($this->entityTypeCollections !== null) { return; } $user = $this->userSession->getUser(); if(is_null($user)) { throw new NotAuthenticated(); } - $userFolder = $this->rootFolder->getUserFolder($user->getUID()); - $this->entityTypeCollections['files'] = new EntityTypeCollection( - 'files', - $this->commentsManager, - $userFolder, - $this->userManager, - $this->userSession, - $this->logger - ); + + $event = new CommentsEntityEvent(CommentsEntityEvent::EVENT_ENTITY); + $this->dispatcher->dispatch(CommentsEntityEvent::EVENT_ENTITY, $event); + + $this->entityTypeCollections = []; + foreach ($event->getEntityCollections() as $entity => $entityExistsFunction) { + $this->entityTypeCollections[$entity] = new EntityTypeCollection( + $entity, + $this->commentsManager, + $this->userManager, + $this->userSession, + $this->logger, + $entityExistsFunction + ); + } } /** diff --git a/apps/dav/lib/RootCollection.php b/apps/dav/lib/RootCollection.php index b6e1747e990..f18bfaf496d 100644 --- a/apps/dav/lib/RootCollection.php +++ b/apps/dav/lib/RootCollection.php @@ -77,7 +77,7 @@ class RootCollection extends SimpleCollection { \OC::$server->getCommentsManager(), \OC::$server->getUserManager(), \OC::$server->getUserSession(), - \OC::$server->getRootFolder(), + \OC::$server->getEventDispatcher(), \OC::$server->getLogger() ); diff --git a/apps/dav/lib/SystemTag/SystemTagMappingNode.php b/apps/dav/lib/SystemTag/SystemTagMappingNode.php index bb2936c13dc..09a3c79c757 100644 --- a/apps/dav/lib/SystemTag/SystemTagMappingNode.php +++ b/apps/dav/lib/SystemTag/SystemTagMappingNode.php @@ -24,21 +24,22 @@ namespace OCA\DAV\SystemTag; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\Exception\Forbidden; +use Sabre\DAV\Exception\MethodNotAllowed; use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; use OCP\SystemTag\TagNotFoundException; +use OCP\IUser; /** * Mapping node for system tag to object id */ -class SystemTagMappingNode extends SystemTagNode { - +class SystemTagMappingNode implements \Sabre\DAV\INode { /** - * @var ISystemTagObjectMapper + * @var ISystemTag */ - private $tagMapper; + protected $tag; /** * @var string @@ -51,12 +52,29 @@ class SystemTagMappingNode extends SystemTagNode { private $objectType; /** + * User + * + * @var IUser + */ + protected $user; + + /** + * @var ISystemTagManager + */ + protected $tagManager; + + /** + * @var ISystemTagObjectMapper + */ + private $tagMapper; + + /** * Sets up the node, expects a full path name * * @param ISystemTag $tag system tag * @param string $objectId * @param string $objectType - * @param bool $isAdmin whether to allow permissions for admin + * @param IUser $user user * @param ISystemTagManager $tagManager * @param ISystemTagObjectMapper $tagMapper */ @@ -64,14 +82,16 @@ class SystemTagMappingNode extends SystemTagNode { ISystemTag $tag, $objectId, $objectType, - $isAdmin, + IUser $user, ISystemTagManager $tagManager, ISystemTagObjectMapper $tagMapper ) { + $this->tag = $tag; $this->objectId = $objectId; $this->objectType = $objectType; + $this->user = $user; + $this->tagManager = $tagManager; $this->tagMapper = $tagMapper; - parent::__construct($tag, $isAdmin, $tagManager); } /** @@ -93,17 +113,52 @@ class SystemTagMappingNode extends SystemTagNode { } /** + * Returns the system tag represented by this node + * + * @return ISystemTag system tag + */ + public function getSystemTag() { + return $this->tag; + } + + /** + * Returns the id of the tag + * + * @return string + */ + public function getName() { + return $this->tag->getId(); + } + + /** + * Renames the node + * + * @param string $name The new name + * + * @throws MethodNotAllowed not allowed to rename node + */ + public function setName($name) { + throw new MethodNotAllowed(); + } + + /** + * Returns null, not supported + * + */ + public function getLastModified() { + return null; + } + + /** * Delete tag to object association */ public function delete() { try { - if (!$this->isAdmin) { - if (!$this->tag->isUserVisible()) { - throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found'); - } - if (!$this->tag->isUserAssignable()) { - throw new Forbidden('No permission to unassign tag ' . $this->tag->getId()); - } + if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) { + throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found'); + } + if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) { + throw new Forbidden('No permission to unassign tag ' . $this->tag->getId()); } $this->tagMapper->unassignTags($this->objectId, $this->objectType, $this->tag->getId()); } catch (TagNotFoundException $e) { diff --git a/apps/dav/lib/SystemTag/SystemTagNode.php b/apps/dav/lib/SystemTag/SystemTagNode.php index 500e1a3adea..f139a3335c8 100644 --- a/apps/dav/lib/SystemTag/SystemTagNode.php +++ b/apps/dav/lib/SystemTag/SystemTagNode.php @@ -32,6 +32,7 @@ use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\TagNotFoundException; use OCP\SystemTag\TagAlreadyExistsException; +use OCP\IUser; /** * DAV node representing a system tag, with the name being the tag id. @@ -49,6 +50,13 @@ class SystemTagNode implements \Sabre\DAV\INode { protected $tagManager; /** + * User + * + * @var IUser + */ + protected $user; + + /** * Whether to allow permissions for admins * * @var bool @@ -59,11 +67,13 @@ class SystemTagNode implements \Sabre\DAV\INode { * Sets up the node, expects a full path name * * @param ISystemTag $tag system tag + * @param IUser $user user * @param bool $isAdmin whether to allow operations for admins - * @param ISystemTagManager $tagManager + * @param ISystemTagManager $tagManager tag manager */ - public function __construct(ISystemTag $tag, $isAdmin, ISystemTagManager $tagManager) { + public function __construct(ISystemTag $tag, IUser $user, $isAdmin, ISystemTagManager $tagManager) { $this->tag = $tag; + $this->user = $user; $this->isAdmin = $isAdmin; $this->tagManager = $tagManager; } @@ -109,14 +119,15 @@ class SystemTagNode implements \Sabre\DAV\INode { */ public function update($name, $userVisible, $userAssignable) { try { - if (!$this->isAdmin) { - if (!$this->tag->isUserVisible()) { - throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist'); - } - if (!$this->tag->isUserAssignable()) { - throw new Forbidden('No permission to update tag ' . $this->tag->getId()); - } + if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) { + throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist'); + } + if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) { + throw new Forbidden('No permission to update tag ' . $this->tag->getId()); + } + // only admin is able to change permissions, regular users can only rename + if (!$this->isAdmin) { // only renaming is allowed for regular users if ($userVisible !== $this->tag->isUserVisible() || $userAssignable !== $this->tag->isUserAssignable() @@ -124,6 +135,7 @@ class SystemTagNode implements \Sabre\DAV\INode { throw new Forbidden('No permission to update permissions for tag ' . $this->tag->getId()); } } + $this->tagManager->updateTag($this->tag->getId(), $name, $userVisible, $userAssignable); } catch (TagNotFoundException $e) { throw new NotFound('Tag with id ' . $this->tag->getId() . ' does not exist'); @@ -145,14 +157,13 @@ class SystemTagNode implements \Sabre\DAV\INode { public function delete() { try { - if (!$this->isAdmin) { - if (!$this->tag->isUserVisible()) { - throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found'); - } - if (!$this->tag->isUserAssignable()) { - throw new Forbidden('No permission to delete tag ' . $this->tag->getId()); - } + if (!$this->tagManager->canUserSeeTag($this->tag, $this->user)) { + throw new NotFound('Tag with id ' . $this->tag->getId() . ' not found'); } + if (!$this->tagManager->canUserAssignTag($this->tag, $this->user)) { + throw new Forbidden('No permission to delete tag ' . $this->tag->getId()); + } + $this->tagManager->deleteTags($this->tag->getId()); } catch (TagNotFoundException $e) { // can happen if concurrent deletion occurred diff --git a/apps/dav/lib/SystemTag/SystemTagPlugin.php b/apps/dav/lib/SystemTag/SystemTagPlugin.php index a266b4a1214..af683954b87 100644 --- a/apps/dav/lib/SystemTag/SystemTagPlugin.php +++ b/apps/dav/lib/SystemTag/SystemTagPlugin.php @@ -24,18 +24,20 @@ namespace OCA\DAV\SystemTag; use OCP\IGroupManager; use OCP\IUserSession; -use Sabre\DAV\Exception\NotFound; use Sabre\DAV\PropFind; use Sabre\DAV\PropPatch; use Sabre\DAV\Exception\BadRequest; -use Sabre\DAV\Exception\UnsupportedMediaType; use Sabre\DAV\Exception\Conflict; +use Sabre\DAV\Exception\Forbidden; +use Sabre\DAV\Exception\NotFound; +use Sabre\DAV\Exception\UnsupportedMediaType; use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\TagAlreadyExistsException; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; +use OCA\DAV\SystemTag\SystemTagMappingNode; /** * Sabre plugin to handle system tags: @@ -52,6 +54,8 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { const DISPLAYNAME_PROPERTYNAME = '{http://owncloud.org/ns}display-name'; const USERVISIBLE_PROPERTYNAME = '{http://owncloud.org/ns}user-visible'; const USERASSIGNABLE_PROPERTYNAME = '{http://owncloud.org/ns}user-assignable'; + const GROUPS_PROPERTYNAME = '{http://owncloud.org/ns}groups'; + const CANASSIGN_PROPERTYNAME = '{http://owncloud.org/ns}can-assign'; /** * @var \Sabre\DAV\Server $server @@ -181,14 +185,26 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { $userAssignable = (bool)$data['userAssignable']; } - if($userVisible === false || $userAssignable === false) { + $groups = []; + if (isset($data['groups'])) { + $groups = $data['groups']; + if (is_string($groups)) { + $groups = explode('|', $groups); + } + } + + if($userVisible === false || $userAssignable === false || !empty($groups)) { if(!$this->userSession->isLoggedIn() || !$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) { throw new BadRequest('Not sufficient permissions'); } } try { - return $this->tagManager->createTag($tagName, $userVisible, $userAssignable); + $tag = $this->tagManager->createTag($tagName, $userVisible, $userAssignable); + if (!empty($groups)) { + $this->tagManager->setTagGroups($tag, $groups); + } + return $tag; } catch (TagAlreadyExistsException $e) { throw new Conflict('Tag already exists', 0, $e); } @@ -205,7 +221,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { PropFind $propFind, \Sabre\DAV\INode $node ) { - if (!($node instanceof SystemTagNode)) { + if (!($node instanceof SystemTagNode) && !($node instanceof SystemTagMappingNode)) { return; } @@ -222,8 +238,27 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { }); $propFind->handle(self::USERASSIGNABLE_PROPERTYNAME, function() use ($node) { + // this is the tag's inherent property "is user assignable" return $node->getSystemTag()->isUserAssignable() ? 'true' : 'false'; }); + + $propFind->handle(self::CANASSIGN_PROPERTYNAME, function() use ($node) { + // this is the effective permission for the current user + return $this->tagManager->canUserAssignTag($node->getSystemTag(), $this->userSession->getUser()) ? 'true' : 'false'; + }); + + $propFind->handle(self::GROUPS_PROPERTYNAME, function() use ($node) { + if (!$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) { + // property only available for admins + throw new Forbidden(); + } + $groups = []; + // no need to retrieve groups for namespaces that don't qualify + if ($node->getSystemTag()->isUserVisible() && !$node->getSystemTag()->isUserAssignable()) { + $groups = $this->tagManager->getTagGroups($node->getSystemTag()); + } + return implode('|', $groups); + }); } /** @@ -239,6 +274,7 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { self::DISPLAYNAME_PROPERTYNAME, self::USERVISIBLE_PROPERTYNAME, self::USERASSIGNABLE_PROPERTYNAME, + self::GROUPS_PROPERTYNAME, ], function($props) use ($path) { $node = $this->server->tree->getNodeForPath($path); if (!($node instanceof SystemTagNode)) { @@ -250,22 +286,42 @@ class SystemTagPlugin extends \Sabre\DAV\ServerPlugin { $userVisible = $tag->isUserVisible(); $userAssignable = $tag->isUserAssignable(); + $updateTag = false; + if (isset($props[self::DISPLAYNAME_PROPERTYNAME])) { $name = $props[self::DISPLAYNAME_PROPERTYNAME]; + $updateTag = true; } if (isset($props[self::USERVISIBLE_PROPERTYNAME])) { $propValue = $props[self::USERVISIBLE_PROPERTYNAME]; $userVisible = ($propValue !== 'false' && $propValue !== '0'); + $updateTag = true; } if (isset($props[self::USERASSIGNABLE_PROPERTYNAME])) { $propValue = $props[self::USERASSIGNABLE_PROPERTYNAME]; $userAssignable = ($propValue !== 'false' && $propValue !== '0'); + $updateTag = true; + } + + if (isset($props[self::GROUPS_PROPERTYNAME])) { + if (!$this->groupManager->isAdmin($this->userSession->getUser()->getUID())) { + // property only available for admins + throw new Forbidden(); + } + + $propValue = $props[self::GROUPS_PROPERTYNAME]; + $groupIds = explode('|', $propValue); + $this->tagManager->setTagGroups($tag, $groupIds); + } + + if ($updateTag) { + $node->update($name, $userVisible, $userAssignable); } - $node->update($name, $userVisible, $userAssignable); return true; }); + } } diff --git a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php index 298902501ab..2b24bce9f35 100644 --- a/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsByIdCollection.php @@ -32,6 +32,7 @@ use OCP\SystemTag\ISystemTag; use OCP\SystemTag\TagNotFoundException; use OCP\IGroupManager; use OCP\IUserSession; +use OC\User\NoUserException; class SystemTagsByIdCollection implements ICollection { @@ -69,6 +70,8 @@ class SystemTagsByIdCollection implements ICollection { /** * Returns whether the currently logged in user is an administrator + * + * @return bool true if the user is an admin */ private function isAdmin() { $user = $this->userSession->getUser(); @@ -101,7 +104,7 @@ class SystemTagsByIdCollection implements ICollection { try { $tag = $this->tagManager->getTagsByIds([$name]); $tag = current($tag); - if (!$this->isAdmin() && !$tag->isUserVisible()) { + if (!$this->tagManager->canUserSeeTag($tag, $this->userSession->getUser())) { throw new NotFound('Tag with id ' . $name . ' not found'); } return $this->makeNode($tag); @@ -131,7 +134,7 @@ class SystemTagsByIdCollection implements ICollection { try { $tag = $this->tagManager->getTagsByIds([$name]); $tag = current($tag); - if (!$this->isAdmin() && !$tag->isUserVisible()) { + if (!$this->tagManager->canUserSeeTag($tag, $this->userSession->getUser())) { return false; } return true; @@ -171,6 +174,6 @@ class SystemTagsByIdCollection implements ICollection { * @return SystemTagNode */ private function makeNode(ISystemTag $tag) { - return new SystemTagNode($tag, $this->isAdmin(), $this->tagManager); + return new SystemTagNode($tag, $this->userSession->getUser(), $this->isAdmin(), $this->tagManager); } } diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php index eb75ed06393..c4c45dc76d6 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectMappingCollection.php @@ -31,6 +31,7 @@ use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; use OCP\SystemTag\ISystemTag; use OCP\SystemTag\TagNotFoundException; +use OCP\IUser; /** * Collection containing tags by object id @@ -58,11 +59,11 @@ class SystemTagsObjectMappingCollection implements ICollection { private $tagMapper; /** - * Whether to return results only visible for admins + * User * - * @var bool + * @var IUser */ - private $isAdmin; + private $user; /** @@ -70,30 +71,35 @@ class SystemTagsObjectMappingCollection implements ICollection { * * @param string $objectId object id * @param string $objectType object type - * @param bool $isAdmin whether to return results visible only for admins - * @param ISystemTagManager $tagManager - * @param ISystemTagObjectMapper $tagMapper + * @param IUser $user user + * @param ISystemTagManager $tagManager tag manager + * @param ISystemTagObjectMapper $tagMapper tag mapper */ - public function __construct($objectId, $objectType, $isAdmin, $tagManager, $tagMapper) { + public function __construct( + $objectId, + $objectType, + IUser $user, + ISystemTagManager $tagManager, + ISystemTagObjectMapper $tagMapper + ) { $this->tagManager = $tagManager; $this->tagMapper = $tagMapper; $this->objectId = $objectId; $this->objectType = $objectType; - $this->isAdmin = $isAdmin; + $this->user = $user; } function createFile($tagId, $data = null) { try { - if (!$this->isAdmin) { - $tag = $this->tagManager->getTagsByIds($tagId); - $tag = current($tag); - if (!$tag->isUserVisible()) { - throw new PreconditionFailed('Tag with id ' . $tagId . ' does not exist, cannot assign'); - } - if (!$tag->isUserAssignable()) { - throw new Forbidden('No permission to assign tag ' . $tag->getId()); - } + $tags = $this->tagManager->getTagsByIds([$tagId]); + $tag = current($tags); + if (!$this->tagManager->canUserSeeTag($tag, $this->user)) { + throw new PreconditionFailed('Tag with id ' . $tagId . ' does not exist, cannot assign'); } + if (!$this->tagManager->canUserAssignTag($tag, $this->user)) { + throw new Forbidden('No permission to assign tag ' . $tagId); + } + $this->tagMapper->assignTags($this->objectId, $this->objectType, $tagId); } catch (TagNotFoundException $e) { throw new PreconditionFailed('Tag with id ' . $tagId . ' does not exist, cannot assign'); @@ -109,7 +115,7 @@ class SystemTagsObjectMappingCollection implements ICollection { if ($this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true)) { $tag = $this->tagManager->getTagsByIds([$tagId]); $tag = current($tag); - if ($this->isAdmin || $tag->isUserVisible()) { + if ($this->tagManager->canUserSeeTag($tag, $this->user)) { return $this->makeNode($tag); } } @@ -127,12 +133,12 @@ class SystemTagsObjectMappingCollection implements ICollection { return []; } $tags = $this->tagManager->getTagsByIds($tagIds); - if (!$this->isAdmin) { - // filter out non-visible tags - $tags = array_filter($tags, function($tag) { - return $tag->isUserVisible(); - }); - } + + // filter out non-visible tags + $tags = array_filter($tags, function($tag) { + return $this->tagManager->canUserSeeTag($tag, $this->user); + }); + return array_values(array_map(function($tag) { return $this->makeNode($tag); }, $tags)); @@ -141,17 +147,16 @@ class SystemTagsObjectMappingCollection implements ICollection { function childExists($tagId) { try { $result = ($this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true)); - if ($this->isAdmin || !$result) { - return $result; - } - // verify if user is allowed to see this tag - $tag = $this->tagManager->getTagsByIds($tagId); - $tag = current($tag); - if (!$tag->isUserVisible()) { - return false; + if ($result) { + $tags = $this->tagManager->getTagsByIds([$tagId]); + $tag = current($tags); + if (!$this->tagManager->canUserSeeTag($tag, $this->user)) { + return false; + } } - return true; + + return $result; } catch (\InvalidArgumentException $e) { throw new BadRequest('Invalid tag id', 0, $e); } catch (TagNotFoundException $e) { @@ -193,7 +198,7 @@ class SystemTagsObjectMappingCollection implements ICollection { $tag, $this->objectId, $this->objectType, - $this->isAdmin, + $this->user, $this->tagManager, $this->tagMapper ); diff --git a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php index bdbc73c4e32..ae4b9d51a1b 100644 --- a/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php +++ b/apps/dav/lib/SystemTag/SystemTagsObjectTypeCollection.php @@ -95,17 +95,6 @@ class SystemTagsObjectTypeCollection implements ICollection { } /** - * Returns whether the currently logged in user is an administrator - */ - private function isAdmin() { - $user = $this->userSession->getUser(); - if ($user !== null) { - return $this->groupManager->isAdmin($user->getUID()); - } - return false; - } - - /** * @param string $name * @param resource|string $data Initial payload * @throws Forbidden @@ -132,7 +121,7 @@ class SystemTagsObjectTypeCollection implements ICollection { return new SystemTagsObjectMappingCollection( $objectId, $this->objectType, - $this->isAdmin(), + $this->userSession->getUser(), $this->tagManager, $this->tagMapper ); diff --git a/apps/dav/tests/unit/comments/entitycollection.php b/apps/dav/tests/unit/comments/entitycollection.php index 5bf155f12ba..bc009e92549 100644 --- a/apps/dav/tests/unit/comments/entitycollection.php +++ b/apps/dav/tests/unit/comments/entitycollection.php @@ -23,18 +23,21 @@ namespace OCA\DAV\Tests\Unit\Comments; class EntityCollection extends \Test\TestCase { + /** @var \OCP\Comments\ICommentsManager|\PHPUnit_Framework_MockObject_MockObject */ protected $commentsManager; - protected $folder; + /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */ protected $userManager; + /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */ protected $logger; + /** @var \OCA\DAV\Comments\EntityCollection */ protected $collection; + /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */ protected $userSession; public function setUp() { parent::setUp(); $this->commentsManager = $this->getMock('\OCP\Comments\ICommentsManager'); - $this->folder = $this->getMock('\OCP\Files\Folder'); $this->userManager = $this->getMock('\OCP\IUserManager'); $this->userSession = $this->getMock('\OCP\IUserSession'); $this->logger = $this->getMock('\OCP\ILogger'); @@ -43,7 +46,6 @@ class EntityCollection extends \Test\TestCase { '19', 'files', $this->commentsManager, - $this->folder, $this->userManager, $this->userSession, $this->logger diff --git a/apps/dav/tests/unit/comments/entitytypecollection.php b/apps/dav/tests/unit/comments/entitytypecollection.php index f3aa2dbd71f..96b1cad8373 100644 --- a/apps/dav/tests/unit/comments/entitytypecollection.php +++ b/apps/dav/tests/unit/comments/entitytypecollection.php @@ -25,52 +25,52 @@ use OCA\DAV\Comments\EntityCollection as EntityCollectionImplemantation; class EntityTypeCollection extends \Test\TestCase { + /** @var \OCP\Comments\ICommentsManager|\PHPUnit_Framework_MockObject_MockObject */ protected $commentsManager; - protected $folder; + /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */ protected $userManager; + /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */ protected $logger; + /** @var \OCA\DAV\Comments\EntityTypeCollection */ protected $collection; + /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */ protected $userSession; + protected $childMap = []; + public function setUp() { parent::setUp(); $this->commentsManager = $this->getMock('\OCP\Comments\ICommentsManager'); - $this->folder = $this->getMock('\OCP\Files\Folder'); $this->userManager = $this->getMock('\OCP\IUserManager'); $this->userSession = $this->getMock('\OCP\IUserSession'); $this->logger = $this->getMock('\OCP\ILogger'); + $instance = $this; + $this->collection = new \OCA\DAV\Comments\EntityTypeCollection( 'files', $this->commentsManager, - $this->folder, $this->userManager, $this->userSession, - $this->logger + $this->logger, + function ($child) use ($instance) { + return !empty($instance->childMap[$child]); + } ); } public function testChildExistsYes() { - $this->folder->expects($this->once()) - ->method('getById') - ->with('17') - ->will($this->returnValue([$this->getMock('\OCP\Files\Node')])); + $this->childMap[17] = true; $this->assertTrue($this->collection->childExists('17')); } public function testChildExistsNo() { - $this->folder->expects($this->once()) - ->method('getById') - ->will($this->returnValue([])); $this->assertFalse($this->collection->childExists('17')); } public function testGetChild() { - $this->folder->expects($this->once()) - ->method('getById') - ->with('17') - ->will($this->returnValue([$this->getMock('\OCP\Files\Node')])); + $this->childMap[17] = true; $ec = $this->collection->getChild('17'); $this->assertTrue($ec instanceof EntityCollectionImplemantation); @@ -80,11 +80,6 @@ class EntityTypeCollection extends \Test\TestCase { * @expectedException \Sabre\DAV\Exception\NotFound */ public function testGetChildException() { - $this->folder->expects($this->once()) - ->method('getById') - ->with('17') - ->will($this->returnValue([])); - $this->collection->getChild('17'); } diff --git a/apps/dav/tests/unit/comments/rootcollection.php b/apps/dav/tests/unit/comments/rootcollection.php index 369006e7159..a59482fba73 100644 --- a/apps/dav/tests/unit/comments/rootcollection.php +++ b/apps/dav/tests/unit/comments/rootcollection.php @@ -22,15 +22,24 @@ namespace OCA\DAV\Tests\Unit\Comments; use OCA\DAV\Comments\EntityTypeCollection as EntityTypeCollectionImplementation; +use OCP\Comments\CommentsEntityEvent; +use Symfony\Component\EventDispatcher\EventDispatcher; class RootCollection extends \Test\TestCase { + /** @var \OCP\Comments\ICommentsManager|\PHPUnit_Framework_MockObject_MockObject */ protected $commentsManager; + /** @var \OCP\IUserManager|\PHPUnit_Framework_MockObject_MockObject */ protected $userManager; + /** @var \OCP\ILogger|\PHPUnit_Framework_MockObject_MockObject */ protected $logger; + /** @var \OCA\DAV\Comments\RootCollection */ protected $collection; + /** @var \OCP\IUserSession|\PHPUnit_Framework_MockObject_MockObject */ protected $userSession; - protected $rootFolder; + /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + protected $dispatcher; + /** @var \OCP\IUser|\PHPUnit_Framework_MockObject_MockObject */ protected $user; public function setUp() { @@ -41,14 +50,14 @@ class RootCollection extends \Test\TestCase { $this->commentsManager = $this->getMock('\OCP\Comments\ICommentsManager'); $this->userManager = $this->getMock('\OCP\IUserManager'); $this->userSession = $this->getMock('\OCP\IUserSession'); - $this->rootFolder = $this->getMock('\OCP\Files\IRootFolder'); + $this->dispatcher = new EventDispatcher(); $this->logger = $this->getMock('\OCP\ILogger'); $this->collection = new \OCA\DAV\Comments\RootCollection( $this->commentsManager, $this->userManager, $this->userSession, - $this->rootFolder, + $this->dispatcher, $this->logger ); } @@ -62,10 +71,11 @@ class RootCollection extends \Test\TestCase { ->method('getUser') ->will($this->returnValue($this->user)); - $this->rootFolder->expects($this->once()) - ->method('getUserFolder') - ->with('alice') - ->will($this->returnValue($this->getMock('\OCP\Files\Folder'))); + $this->dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { + $event->addEntityCollection('files', function() { + return true; + }); + }); } /** diff --git a/apps/dav/tests/unit/systemtag/systemtagmappingnode.php b/apps/dav/tests/unit/systemtag/systemtagmappingnode.php index 7f2ff7d6616..f0e1c3bc567 100644 --- a/apps/dav/tests/unit/systemtag/systemtagmappingnode.php +++ b/apps/dav/tests/unit/systemtag/systemtagmappingnode.php @@ -24,6 +24,7 @@ namespace OCA\DAV\Tests\Unit\SystemTag; use Sabre\DAV\Exception\NotFound; use OC\SystemTag\SystemTag; use OCP\SystemTag\TagNotFoundException; +use OCP\SystemTag\ISystemTag; class SystemTagMappingNode extends \Test\TestCase { @@ -37,14 +38,20 @@ class SystemTagMappingNode extends \Test\TestCase { */ private $tagMapper; + /** + * @var \OCP\IUser + */ + private $user; + protected function setUp() { parent::setUp(); $this->tagManager = $this->getMock('\OCP\SystemTag\ISystemTagManager'); $this->tagMapper = $this->getMock('\OCP\SystemTag\ISystemTagObjectMapper'); + $this->user = $this->getMock('\OCP\IUser'); } - public function getMappingNode($isAdmin = true, $tag = null) { + public function getMappingNode($tag = null) { if ($tag === null) { $tag = new SystemTag(1, 'Test', true, true); } @@ -52,7 +59,7 @@ class SystemTagMappingNode extends \Test\TestCase { $tag, 123, 'files', - $isAdmin, + $this->user, $this->tagManager, $this->tagMapper ); @@ -60,28 +67,30 @@ class SystemTagMappingNode extends \Test\TestCase { public function testGetters() { $tag = new SystemTag(1, 'Test', true, false); - $node = $this->getMappingNode(true, $tag); + $node = $this->getMappingNode($tag); $this->assertEquals('1', $node->getName()); $this->assertEquals($tag, $node->getSystemTag()); $this->assertEquals(123, $node->getObjectId()); $this->assertEquals('files', $node->getObjectType()); } - public function adminFlagProvider() { - return [[true], [false]]; - } - - /** - * @dataProvider adminFlagProvider - */ - public function testDeleteTag($isAdmin) { + public function testDeleteTag() { + $node = $this->getMappingNode(); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($node->getSystemTag()) + ->will($this->returnValue(true)); + $this->tagManager->expects($this->once()) + ->method('canUserAssignTag') + ->with($node->getSystemTag()) + ->will($this->returnValue(true)); $this->tagManager->expects($this->never()) ->method('deleteTags'); $this->tagMapper->expects($this->once()) ->method('unassignTags') ->with(123, 'files', 1); - $this->getMappingNode($isAdmin)->delete(); + $node->delete(); } public function tagNodeDeleteProviderPermissionException() { @@ -102,7 +111,15 @@ class SystemTagMappingNode extends \Test\TestCase { /** * @dataProvider tagNodeDeleteProviderPermissionException */ - public function testDeleteTagExpectedException($tag, $expectedException) { + public function testDeleteTagExpectedException(ISystemTag $tag, $expectedException) { + $this->tagManager->expects($this->any()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue($tag->isUserVisible())); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue($tag->isUserAssignable())); $this->tagManager->expects($this->never()) ->method('deleteTags'); $this->tagMapper->expects($this->never()) @@ -110,7 +127,7 @@ class SystemTagMappingNode extends \Test\TestCase { $thrown = null; try { - $this->getMappingNode(false, $tag)->delete(); + $this->getMappingNode($tag)->delete(); } catch (\Exception $e) { $thrown = $e; } @@ -122,11 +139,22 @@ class SystemTagMappingNode extends \Test\TestCase { * @expectedException Sabre\DAV\Exception\NotFound */ public function testDeleteTagNotFound() { + // assuming the tag existed at the time the node was created, + // but got deleted concurrently in the database + $tag = new SystemTag(1, 'Test', true, true); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue($tag->isUserVisible())); + $this->tagManager->expects($this->once()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue($tag->isUserAssignable())); $this->tagMapper->expects($this->once()) ->method('unassignTags') ->with(123, 'files', 1) ->will($this->throwException(new TagNotFoundException())); - $this->getMappingNode()->delete(); + $this->getMappingNode($tag)->delete(); } } diff --git a/apps/dav/tests/unit/systemtag/systemtagnode.php b/apps/dav/tests/unit/systemtag/systemtagnode.php index 5184b74e5c8..d9e088a7d90 100644 --- a/apps/dav/tests/unit/systemtag/systemtagnode.php +++ b/apps/dav/tests/unit/systemtag/systemtagnode.php @@ -28,6 +28,7 @@ use Sabre\DAV\Exception\Conflict; use OC\SystemTag\SystemTag; use OCP\SystemTag\TagNotFoundException; use OCP\SystemTag\TagAlreadyExistsException; +use OCP\SystemTag\ISystemTag; class SystemTagNode extends \Test\TestCase { @@ -36,10 +37,16 @@ class SystemTagNode extends \Test\TestCase { */ private $tagManager; + /** + * @var \OCP\IUser + */ + private $user; + protected function setUp() { parent::setUp(); $this->tagManager = $this->getMock('\OCP\SystemTag\ISystemTagManager'); + $this->user = $this->getMock('\OCP\IUser'); } protected function getTagNode($isAdmin = true, $tag = null) { @@ -48,6 +55,7 @@ class SystemTagNode extends \Test\TestCase { } return new \OCA\DAV\SystemTag\SystemTagNode( $tag, + $this->user, $isAdmin, $this->tagManager ); @@ -102,6 +110,14 @@ class SystemTagNode extends \Test\TestCase { */ public function testUpdateTag($isAdmin, $originalTag, $changedArgs) { $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($originalTag) + ->will($this->returnValue($originalTag->isUserVisible() || $isAdmin)); + $this->tagManager->expects($this->once()) + ->method('canUserAssignTag') + ->with($originalTag) + ->will($this->returnValue($originalTag->isUserAssignable() || $isAdmin)); + $this->tagManager->expects($this->once()) ->method('updateTag') ->with(1, $changedArgs[0], $changedArgs[1], $changedArgs[2]); $this->getTagNode($isAdmin, $originalTag) @@ -153,6 +169,14 @@ class SystemTagNode extends \Test\TestCase { * @dataProvider tagNodeProviderPermissionException */ public function testUpdateTagPermissionException($originalTag, $changedArgs, $expectedException = null) { + $this->tagManager->expects($this->any()) + ->method('canUserSeeTag') + ->with($originalTag) + ->will($this->returnValue($originalTag->isUserVisible())); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->with($originalTag) + ->will($this->returnValue($originalTag->isUserAssignable())); $this->tagManager->expects($this->never()) ->method('updateTag'); @@ -172,32 +196,59 @@ class SystemTagNode extends \Test\TestCase { * @expectedException Sabre\DAV\Exception\Conflict */ public function testUpdateTagAlreadyExists() { + $tag = new SystemTag(1, 'tag1', true, true); + $this->tagManager->expects($this->any()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(true)); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue(true)); $this->tagManager->expects($this->once()) ->method('updateTag') - ->with(1, 'Renamed', false, true) + ->with(1, 'Renamed', true, true) ->will($this->throwException(new TagAlreadyExistsException())); - $this->getTagNode()->update('Renamed', false, true); + $this->getTagNode(false, $tag)->update('Renamed', true, true); } /** * @expectedException Sabre\DAV\Exception\NotFound */ public function testUpdateTagNotFound() { + $tag = new SystemTag(1, 'tag1', true, true); + $this->tagManager->expects($this->any()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(true)); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue(true)); $this->tagManager->expects($this->once()) ->method('updateTag') - ->with(1, 'Renamed', false, true) + ->with(1, 'Renamed', true, true) ->will($this->throwException(new TagNotFoundException())); - $this->getTagNode()->update('Renamed', false, true); + $this->getTagNode(false, $tag)->update('Renamed', true, true); } /** * @dataProvider adminFlagProvider */ public function testDeleteTag($isAdmin) { + $tag = new SystemTag(1, 'tag1', true, true); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(true)); + $this->tagManager->expects($this->once()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue(true)); $this->tagManager->expects($this->once()) ->method('deleteTags') ->with('1'); - $this->getTagNode($isAdmin)->delete(); + $this->getTagNode($isAdmin, $tag)->delete(); } public function tagNodeDeleteProviderPermissionException() { @@ -218,7 +269,15 @@ class SystemTagNode extends \Test\TestCase { /** * @dataProvider tagNodeDeleteProviderPermissionException */ - public function testDeleteTagPermissionException($tag, $expectedException) { + public function testDeleteTagPermissionException(ISystemTag $tag, $expectedException) { + $this->tagManager->expects($this->any()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue($tag->isUserVisible())); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue($tag->isUserAssignable())); $this->tagManager->expects($this->never()) ->method('deleteTags'); @@ -235,10 +294,19 @@ class SystemTagNode extends \Test\TestCase { * @expectedException Sabre\DAV\Exception\NotFound */ public function testDeleteTagNotFound() { + $tag = new SystemTag(1, 'tag1', true, true); + $this->tagManager->expects($this->any()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue($tag->isUserVisible())); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue($tag->isUserAssignable())); $this->tagManager->expects($this->once()) ->method('deleteTags') ->with('1') ->will($this->throwException(new TagNotFoundException())); - $this->getTagNode()->delete(); + $this->getTagNode(false, $tag)->delete(); } } diff --git a/apps/dav/tests/unit/systemtag/systemtagplugin.php b/apps/dav/tests/unit/systemtag/systemtagplugin.php index 4466533f1e0..da82bc8904a 100644 --- a/apps/dav/tests/unit/systemtag/systemtagplugin.php +++ b/apps/dav/tests/unit/systemtag/systemtagplugin.php @@ -27,6 +27,8 @@ use OC\SystemTag\SystemTag; use OCP\IGroupManager; use OCP\IUserSession; use OCP\SystemTag\TagAlreadyExistsException; +use OCP\IUser; +use OCP\SystemTag\ISystemTag; class SystemTagPlugin extends \Test\TestCase { @@ -34,6 +36,8 @@ class SystemTagPlugin extends \Test\TestCase { const DISPLAYNAME_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::DISPLAYNAME_PROPERTYNAME; const USERVISIBLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERVISIBLE_PROPERTYNAME; const USERASSIGNABLE_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::USERASSIGNABLE_PROPERTYNAME; + const CANASSIGN_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::CANASSIGN_PROPERTYNAME; + const GROUPS_PROPERTYNAME = \OCA\DAV\SystemTag\SystemTagPlugin::GROUPS_PROPERTYNAME; /** * @var \Sabre\DAV\Server @@ -61,6 +65,11 @@ class SystemTagPlugin extends \Test\TestCase { private $userSession; /** + * @var IUser + */ + private $user; + + /** * @var \OCA\DAV\SystemTag\SystemTagPlugin */ private $plugin; @@ -75,7 +84,16 @@ class SystemTagPlugin extends \Test\TestCase { $this->tagManager = $this->getMock('\OCP\SystemTag\ISystemTagManager'); $this->groupManager = $this->getMock('\OCP\IGroupManager'); + $this->user = $this->getMock('\OCP\IUser'); $this->userSession = $this->getMock('\OCP\IUserSession'); + $this->userSession + ->expects($this->any()) + ->method('getUser') + ->willReturn($this->user); + $this->userSession + ->expects($this->any()) + ->method('isLoggedIn') + ->willReturn(true); $this->plugin = new \OCA\DAV\SystemTag\SystemTagPlugin( $this->tagManager, @@ -85,22 +103,84 @@ class SystemTagPlugin extends \Test\TestCase { $this->plugin->initialize($this->server); } - public function testGetProperties() { - $systemTag = new SystemTag(1, 'Test', true, true); - $requestedProperties = [ - self::ID_PROPERTYNAME, - self::DISPLAYNAME_PROPERTYNAME, - self::USERVISIBLE_PROPERTYNAME, - self::USERASSIGNABLE_PROPERTYNAME - ]; - $expectedProperties = [ - 200 => [ - self::ID_PROPERTYNAME => '1', - self::DISPLAYNAME_PROPERTYNAME => 'Test', - self::USERVISIBLE_PROPERTYNAME => 'true', - self::USERASSIGNABLE_PROPERTYNAME => 'true', - ] + public function getPropertiesDataProvider() { + return [ + [ + new SystemTag(1, 'Test', true, true), + [], + [ + self::ID_PROPERTYNAME, + self::DISPLAYNAME_PROPERTYNAME, + self::USERVISIBLE_PROPERTYNAME, + self::USERASSIGNABLE_PROPERTYNAME, + self::CANASSIGN_PROPERTYNAME, + ], + [ + self::ID_PROPERTYNAME => '1', + self::DISPLAYNAME_PROPERTYNAME => 'Test', + self::USERVISIBLE_PROPERTYNAME => 'true', + self::USERASSIGNABLE_PROPERTYNAME => 'true', + self::CANASSIGN_PROPERTYNAME => 'true', + ] + ], + [ + new SystemTag(1, 'Test', true, false), + [], + [ + self::ID_PROPERTYNAME, + self::DISPLAYNAME_PROPERTYNAME, + self::USERVISIBLE_PROPERTYNAME, + self::USERASSIGNABLE_PROPERTYNAME, + self::CANASSIGN_PROPERTYNAME, + ], + [ + self::ID_PROPERTYNAME => '1', + self::DISPLAYNAME_PROPERTYNAME => 'Test', + self::USERVISIBLE_PROPERTYNAME => 'true', + self::USERASSIGNABLE_PROPERTYNAME => 'false', + self::CANASSIGN_PROPERTYNAME => 'false', + ] + ], + [ + new SystemTag(1, 'Test', true, false), + ['group1', 'group2'], + [ + self::ID_PROPERTYNAME, + self::GROUPS_PROPERTYNAME, + ], + [ + self::ID_PROPERTYNAME => '1', + self::GROUPS_PROPERTYNAME => 'group1|group2', + ] + ], + [ + new SystemTag(1, 'Test', true, true), + ['group1', 'group2'], + [ + self::ID_PROPERTYNAME, + self::GROUPS_PROPERTYNAME, + ], + [ + self::ID_PROPERTYNAME => '1', + // groups only returned when userAssignable is false + self::GROUPS_PROPERTYNAME => '', + ] + ], ]; + } + + /** + * @dataProvider getPropertiesDataProvider + */ + public function testGetProperties(ISystemTag $systemTag, $groups, $requestedProperties, $expectedProperties) { + $this->user->expects($this->any()) + ->method('getUID') + ->willReturn('admin'); + $this->groupManager + ->expects($this->any()) + ->method('isAdmin') + ->with('admin') + ->willReturn(true); $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') ->disableOriginalConstructor() @@ -109,6 +189,14 @@ class SystemTagPlugin extends \Test\TestCase { ->method('getSystemTag') ->will($this->returnValue($systemTag)); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->will($this->returnValue($systemTag->isUserAssignable())); + + $this->tagManager->expects($this->any()) + ->method('getTagGroups') + ->will($this->returnValue($groups)); + $this->tree->expects($this->any()) ->method('getNodeForPath') ->with('/systemtag/1') @@ -128,12 +216,62 @@ class SystemTagPlugin extends \Test\TestCase { $result = $propFind->getResultForMultiStatus(); $this->assertEmpty($result[404]); - unset($result[404]); - $this->assertEquals($expectedProperties, $result); + $this->assertEquals($expectedProperties, $result[200]); } - public function testUpdateProperties() { + /** + * @expectedException \Sabre\DAV\Exception\Forbidden + */ + public function testGetPropertiesForbidden() { $systemTag = new SystemTag(1, 'Test', true, false); + $requestedProperties = [ + self::ID_PROPERTYNAME, + self::GROUPS_PROPERTYNAME, + ]; + $this->user->expects($this->once()) + ->method('getUID') + ->willReturn('admin'); + $this->groupManager + ->expects($this->once()) + ->method('isAdmin') + ->with('admin') + ->willReturn(false); + + $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') + ->disableOriginalConstructor() + ->getMock(); + $node->expects($this->any()) + ->method('getSystemTag') + ->will($this->returnValue($systemTag)); + + $this->tree->expects($this->any()) + ->method('getNodeForPath') + ->with('/systemtag/1') + ->will($this->returnValue($node)); + + $propFind = new \Sabre\DAV\PropFind( + '/systemtag/1', + $requestedProperties, + 0 + ); + + $this->plugin->handleGetProperties( + $propFind, + $node + ); + } + + public function testUpdatePropertiesAdmin() { + $systemTag = new SystemTag(1, 'Test', true, false); + $this->user->expects($this->any()) + ->method('getUID') + ->willReturn('admin'); + $this->groupManager + ->expects($this->any()) + ->method('isAdmin') + ->with('admin') + ->willReturn(true); + $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') ->disableOriginalConstructor() ->getMock(); @@ -150,11 +288,16 @@ class SystemTagPlugin extends \Test\TestCase { ->method('update') ->with('Test changed', false, true); + $this->tagManager->expects($this->once()) + ->method('setTagGroups') + ->with($systemTag, ['group1', 'group2']); + // properties to set $propPatch = new \Sabre\DAV\PropPatch(array( self::DISPLAYNAME_PROPERTYNAME => 'Test changed', self::USERVISIBLE_PROPERTYNAME => 'false', self::USERASSIGNABLE_PROPERTYNAME => 'true', + self::GROUPS_PROPERTYNAME => 'group1|group2', )); $this->plugin->handleUpdateProperties( @@ -174,102 +317,89 @@ class SystemTagPlugin extends \Test\TestCase { } /** - * @expectedException \Sabre\DAV\Exception\BadRequest - * @expectedExceptionMessage Not sufficient permissions + * @expectedException \Sabre\DAV\Exception\Forbidden */ - public function testCreateNotAssignableTagAsRegularUser() { - $user = $this->getMock('\OCP\IUser'); - $user->expects($this->once()) + public function testUpdatePropertiesForbidden() { + $systemTag = new SystemTag(1, 'Test', true, false); + $this->user->expects($this->any()) ->method('getUID') ->willReturn('admin'); - $this->userSession - ->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->userSession - ->expects($this->once()) - ->method('getUser') - ->willReturn($user); $this->groupManager - ->expects($this->once()) + ->expects($this->any()) ->method('isAdmin') ->with('admin') ->willReturn(false); - $requestData = json_encode([ - 'name' => 'Test', - 'userVisible' => true, - 'userAssignable' => false, - ]); - - $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection') + $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagNode') ->disableOriginalConstructor() ->getMock(); - $this->tagManager->expects($this->never()) - ->method('createTag'); + $node->expects($this->any()) + ->method('getSystemTag') + ->will($this->returnValue($systemTag)); $this->tree->expects($this->any()) ->method('getNodeForPath') - ->with('/systemtags') + ->with('/systemtag/1') ->will($this->returnValue($node)); - $request = $this->getMockBuilder('Sabre\HTTP\RequestInterface') - ->disableOriginalConstructor() - ->getMock(); - $response = $this->getMockBuilder('Sabre\HTTP\ResponseInterface') - ->disableOriginalConstructor() - ->getMock(); + $node->expects($this->never()) + ->method('update'); - $request->expects($this->once()) - ->method('getPath') - ->will($this->returnValue('/systemtags')); + $this->tagManager->expects($this->never()) + ->method('setTagGroups'); - $request->expects($this->once()) - ->method('getBodyAsString') - ->will($this->returnValue($requestData)); + // properties to set + $propPatch = new \Sabre\DAV\PropPatch(array( + self::GROUPS_PROPERTYNAME => 'group1|group2', + )); - $request->expects($this->once()) - ->method('getHeader') - ->with('Content-Type') - ->will($this->returnValue('application/json')); + $this->plugin->handleUpdateProperties( + '/systemtag/1', + $propPatch + ); - $this->plugin->httpPost($request, $response); + $propPatch->commit(); } + public function createTagInsufficientPermissionsProvider() { + return [ + [true, false, ''], + [false, true, ''], + [true, true, 'group1|group2'], + ]; + } /** + * @dataProvider createTagInsufficientPermissionsProvider * @expectedException \Sabre\DAV\Exception\BadRequest * @expectedExceptionMessage Not sufficient permissions */ - public function testCreateInvisibleTagAsRegularUser() { - $user = $this->getMock('\OCP\IUser'); - $user->expects($this->once()) + public function testCreateNotAssignableTagAsRegularUser($userVisible, $userAssignable, $groups) { + $this->user->expects($this->once()) ->method('getUID') ->willReturn('admin'); - $this->userSession - ->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->userSession - ->expects($this->once()) - ->method('getUser') - ->willReturn($user); $this->groupManager ->expects($this->once()) ->method('isAdmin') ->with('admin') ->willReturn(false); - $requestData = json_encode([ + $requestData = [ 'name' => 'Test', - 'userVisible' => false, - 'userAssignable' => true, - ]); + 'userVisible' => $userVisible, + 'userAssignable' => $userAssignable, + ]; + if (!empty($groups)) { + $requestData['groups'] = $groups; + } + $requestData = json_encode($requestData); $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection') ->disableOriginalConstructor() ->getMock(); $this->tagManager->expects($this->never()) ->method('createTag'); + $this->tagManager->expects($this->never()) + ->method('setTagGroups'); $this->tree->expects($this->any()) ->method('getNodeForPath') @@ -352,19 +482,21 @@ class SystemTagPlugin extends \Test\TestCase { $this->plugin->httpPost($request, $response); } - public function testCreateTagInByIdCollection() { - $user = $this->getMock('\OCP\IUser'); - $user->expects($this->once()) + public function createTagProvider() { + return [ + [true, false, ''], + [false, false, ''], + [true, false, 'group1|group2'], + ]; + } + + /** + * @dataProvider createTagProvider + */ + public function testCreateTagInByIdCollection($userVisible, $userAssignable, $groups) { + $this->user->expects($this->once()) ->method('getUID') ->willReturn('admin'); - $this->userSession - ->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->userSession - ->expects($this->once()) - ->method('getUser') - ->willReturn($user); $this->groupManager ->expects($this->once()) ->method('isAdmin') @@ -373,19 +505,33 @@ class SystemTagPlugin extends \Test\TestCase { $systemTag = new SystemTag(1, 'Test', true, false); - $requestData = json_encode([ + $requestData = [ 'name' => 'Test', - 'userVisible' => true, - 'userAssignable' => false, - ]); + 'userVisible' => $userVisible, + 'userAssignable' => $userAssignable, + ]; + if (!empty($groups)) { + $requestData['groups'] = $groups; + } + $requestData = json_encode($requestData); $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsByIdCollection') ->disableOriginalConstructor() ->getMock(); $this->tagManager->expects($this->once()) ->method('createTag') - ->with('Test', true, false) + ->with('Test', $userVisible, $userAssignable) ->will($this->returnValue($systemTag)); + + if (!empty($groups)) { + $this->tagManager->expects($this->once()) + ->method('setTagGroups') + ->with($systemTag, explode('|', $groups)) + ->will($this->returnValue($systemTag)); + } else { + $this->tagManager->expects($this->never()) + ->method('setTagGroups'); + } $this->tree->expects($this->any()) ->method('getNodeForPath') @@ -431,18 +577,9 @@ class SystemTagPlugin extends \Test\TestCase { } public function testCreateTagInMappingCollection() { - $user = $this->getMock('\OCP\IUser'); - $user->expects($this->once()) + $this->user->expects($this->once()) ->method('getUID') ->willReturn('admin'); - $this->userSession - ->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->userSession - ->expects($this->once()) - ->method('getUser') - ->willReturn($user); $this->groupManager ->expects($this->once()) ->method('isAdmin') @@ -510,8 +647,6 @@ class SystemTagPlugin extends \Test\TestCase { * @expectedException \Sabre\DAV\Exception\NotFound */ public function testCreateTagToUnknownNode() { - $systemTag = new SystemTag(1, 'Test', true, false); - $node = $this->getMockBuilder('\OCA\DAV\SystemTag\SystemTagsObjectMappingCollection') ->disableOriginalConstructor() ->getMock(); @@ -545,18 +680,9 @@ class SystemTagPlugin extends \Test\TestCase { * @expectedException \Sabre\DAV\Exception\Conflict */ public function testCreateTagConflict($nodeClass) { - $user = $this->getMock('\OCP\IUser'); - $user->expects($this->once()) + $this->user->expects($this->once()) ->method('getUID') ->willReturn('admin'); - $this->userSession - ->expects($this->once()) - ->method('isLoggedIn') - ->willReturn(true); - $this->userSession - ->expects($this->once()) - ->method('getUser') - ->willReturn($user); $this->groupManager ->expects($this->once()) ->method('isAdmin') diff --git a/apps/dav/tests/unit/systemtag/systemtagsbyidcollection.php b/apps/dav/tests/unit/systemtag/systemtagsbyidcollection.php index a2bf571ab68..5aa28d1a254 100644 --- a/apps/dav/tests/unit/systemtag/systemtagsbyidcollection.php +++ b/apps/dav/tests/unit/systemtag/systemtagsbyidcollection.php @@ -32,6 +32,11 @@ class SystemTagsByIdCollection extends \Test\TestCase { */ private $tagManager; + /** + * @var \OCP\IUser + */ + private $user; + protected function setUp() { parent::setUp(); @@ -39,14 +44,14 @@ class SystemTagsByIdCollection extends \Test\TestCase { } public function getNode($isAdmin = true) { - $user = $this->getMock('\OCP\IUser'); - $user->expects($this->any()) + $this->user = $this->getMock('\OCP\IUser'); + $this->user->expects($this->any()) ->method('getUID') ->will($this->returnValue('testuser')); $userSession = $this->getMock('\OCP\IUserSession'); $userSession->expects($this->any()) ->method('getUser') - ->will($this->returnValue($user)); + ->will($this->returnValue($this->user)); $groupManager = $this->getMock('\OCP\IGroupManager'); $groupManager->expects($this->any()) ->method('isAdmin') @@ -77,35 +82,19 @@ class SystemTagsByIdCollection extends \Test\TestCase { $this->getNode()->createDirectory('789'); } - public function getChildProvider() { - return [ - [ - true, - true, - ], - [ - true, - false, - ], - [ - false, - true, - ], - ]; - } - - /** - * @dataProvider getChildProvider - */ - public function testGetChild($isAdmin, $userVisible) { - $tag = new SystemTag(123, 'Test', $userVisible, false); + public function testGetChild() { + $tag = new SystemTag(123, 'Test', true, false); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(true)); $this->tagManager->expects($this->once()) ->method('getTagsByIds') ->with(['123']) ->will($this->returnValue([$tag])); - $childNode = $this->getNode($isAdmin)->getChild('123'); + $childNode = $this->getNode()->getChild('123'); $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagNode', $childNode); $this->assertEquals('123', $childNode->getName()); @@ -198,27 +187,27 @@ class SystemTagsByIdCollection extends \Test\TestCase { public function childExistsProvider() { return [ - // admins, always visible - [true, true, true], - [true, false, true], - // non-admins, depends on flag - [false, true, true], - [false, false, false], + [true, true], + [false, false], ]; } /** * @dataProvider childExistsProvider */ - public function testChildExists($isAdmin, $userVisible, $expectedResult) { + public function testChildExists($userVisible, $expectedResult) { $tag = new SystemTag(123, 'One', $userVisible, false); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue($userVisible)); $this->tagManager->expects($this->once()) ->method('getTagsByIds') ->with(['123']) ->will($this->returnValue([$tag])); - $this->assertEquals($expectedResult, $this->getNode($isAdmin)->childExists('123')); + $this->assertEquals($expectedResult, $this->getNode()->childExists('123')); } public function testChildExistsNotFound() { diff --git a/apps/dav/tests/unit/systemtag/systemtagsobjectmappingcollection.php b/apps/dav/tests/unit/systemtag/systemtagsobjectmappingcollection.php index df97acd846b..9adc5b88c41 100644 --- a/apps/dav/tests/unit/systemtag/systemtagsobjectmappingcollection.php +++ b/apps/dav/tests/unit/systemtag/systemtagsobjectmappingcollection.php @@ -37,45 +37,50 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { */ private $tagMapper; + /** + * @var \OCP\IUser + */ + private $user; + protected function setUp() { parent::setUp(); $this->tagManager = $this->getMock('\OCP\SystemTag\ISystemTagManager'); $this->tagMapper = $this->getMock('\OCP\SystemTag\ISystemTagObjectMapper'); + + $this->user = $this->getMock('\OCP\IUser'); } - public function getNode($isAdmin = true) { + public function getNode() { return new \OCA\DAV\SystemTag\SystemTagsObjectMappingCollection ( 111, 'files', - $isAdmin, + $this->user, $this->tagManager, $this->tagMapper ); } - public function testAssignTagAsAdmin() { - $this->tagManager->expects($this->never()) - ->method('getTagsByIds'); - $this->tagMapper->expects($this->once()) - ->method('assignTags') - ->with(111, 'files', '555'); - - $this->getNode(true)->createFile('555'); - } - - public function testAssignTagAsUser() { + public function testAssignTag() { $tag = new SystemTag('1', 'Test', true, true); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(true)); + $this->tagManager->expects($this->once()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue(true)); $this->tagManager->expects($this->once()) ->method('getTagsByIds') - ->with('555') + ->with(['555']) ->will($this->returnValue([$tag])); $this->tagMapper->expects($this->once()) ->method('assignTags') ->with(111, 'files', '555'); - $this->getNode(false)->createFile('555'); + $this->getNode()->createFile('555'); } public function permissionsProvider() { @@ -90,19 +95,27 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { /** * @dataProvider permissionsProvider */ - public function testAssignTagAsUserNoPermission($userVisible, $userAssignable, $expectedException) { + public function testAssignTagNoPermission($userVisible, $userAssignable, $expectedException) { $tag = new SystemTag('1', 'Test', $userVisible, $userAssignable); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue($userVisible)); + $this->tagManager->expects($this->any()) + ->method('canUserAssignTag') + ->with($tag) + ->will($this->returnValue($userAssignable)); $this->tagManager->expects($this->once()) ->method('getTagsByIds') - ->with('555') + ->with(['555']) ->will($this->returnValue([$tag])); $this->tagMapper->expects($this->never()) ->method('assignTags'); $thrown = null; try { - $this->getNode(false)->createFile('555'); + $this->getNode()->createFile('555'); } catch (\Exception $e) { $thrown = $e; } @@ -114,9 +127,9 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { * @expectedException Sabre\DAV\Exception\PreconditionFailed */ public function testAssignTagNotFound() { - $this->tagMapper->expects($this->once()) - ->method('assignTags') - ->with(111, 'files', '555') + $this->tagManager->expects($this->once()) + ->method('getTagsByIds') + ->with(['555']) ->will($this->throwException(new TagNotFoundException())); $this->getNode()->createFile('555'); @@ -129,28 +142,12 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { $this->getNode()->createDirectory('789'); } - public function getChildProvider() { - return [ - [ - true, - true, - ], - [ - true, - false, - ], - [ - false, - true, - ], - ]; - } - - /** - * @dataProvider getChildProvider - */ - public function testGetChild($isAdmin, $userVisible) { - $tag = new SystemTag(555, 'TheTag', $userVisible, false); + public function testGetChild() { + $tag = new SystemTag(555, 'TheTag', true, false); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(true)); $this->tagMapper->expects($this->once()) ->method('haveTag') @@ -162,17 +159,21 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { ->with(['555']) ->will($this->returnValue(['555' => $tag])); - $childNode = $this->getNode($isAdmin)->getChild('555'); + $childNode = $this->getNode()->getChild('555'); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagNode', $childNode); + $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagMappingNode', $childNode); $this->assertEquals('555', $childNode->getName()); } /** * @expectedException \Sabre\DAV\Exception\NotFound */ - public function testGetChildUserNonVisible() { + public function testGetChildNonVisible() { $tag = new SystemTag(555, 'TheTag', false, false); + $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(false)); $this->tagMapper->expects($this->once()) ->method('haveTag') @@ -184,7 +185,7 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { ->with(['555']) ->will($this->returnValue(['555' => $tag])); - $this->getNode(false)->getChild('555'); + $this->getNode()->getChild('555'); } /** @@ -223,7 +224,7 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { $this->getNode()->getChild('777'); } - public function testGetChildrenAsAdmin() { + public function testGetChildren() { $tag1 = new SystemTag(555, 'TagOne', true, false); $tag2 = new SystemTag(556, 'TagTwo', true, true); $tag3 = new SystemTag(557, 'InvisibleTag', false, true); @@ -238,43 +239,13 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { ->with(['555', '556', '557']) ->will($this->returnValue(['555' => $tag1, '556' => $tag2, '557' => $tag3])); - $children = $this->getNode(true)->getChildren(); - - $this->assertCount(3, $children); - - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagMappingNode', $children[0]); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagMappingNode', $children[1]); - $this->assertInstanceOf('\OCA\DAV\SystemTag\SystemTagMappingNode', $children[2]); - - $this->assertEquals(111, $children[0]->getObjectId()); - $this->assertEquals('files', $children[0]->getObjectType()); - $this->assertEquals($tag1, $children[0]->getSystemTag()); - - $this->assertEquals(111, $children[1]->getObjectId()); - $this->assertEquals('files', $children[1]->getObjectType()); - $this->assertEquals($tag2, $children[1]->getSystemTag()); + $this->tagManager->expects($this->exactly(3)) + ->method('canUserSeeTag') + ->will($this->returnCallback(function($tag) { + return $tag->isUserVisible(); + })); - $this->assertEquals(111, $children[2]->getObjectId()); - $this->assertEquals('files', $children[2]->getObjectType()); - $this->assertEquals($tag3, $children[2]->getSystemTag()); - } - - public function testGetChildrenAsUser() { - $tag1 = new SystemTag(555, 'TagOne', true, false); - $tag2 = new SystemTag(556, 'TagTwo', true, true); - $tag3 = new SystemTag(557, 'InvisibleTag', false, true); - - $this->tagMapper->expects($this->once()) - ->method('getTagIdsForObjects') - ->with([111], 'files') - ->will($this->returnValue(['111' => ['555', '556', '557']])); - - $this->tagManager->expects($this->once()) - ->method('getTagsByIds') - ->with(['555', '556', '557']) - ->will($this->returnValue(['555' => $tag1, '556' => $tag2, '557' => $tag3])); - - $children = $this->getNode(false)->getChildren(); + $children = $this->getNode()->getChildren(); $this->assertCount(2, $children); @@ -290,16 +261,7 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { $this->assertEquals($tag2, $children[1]->getSystemTag()); } - public function testChildExistsAsAdmin() { - $this->tagMapper->expects($this->once()) - ->method('haveTag') - ->with([111], 'files', '555') - ->will($this->returnValue(true)); - - $this->assertTrue($this->getNode(true)->childExists('555')); - } - - public function testChildExistsWithVisibleTagAsUser() { + public function testChildExistsWithVisibleTag() { $tag = new SystemTag(555, 'TagOne', true, false); $this->tagMapper->expects($this->once()) @@ -308,14 +270,19 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { ->will($this->returnValue(true)); $this->tagManager->expects($this->once()) + ->method('canUserSeeTag') + ->with($tag) + ->will($this->returnValue(true)); + + $this->tagManager->expects($this->once()) ->method('getTagsByIds') - ->with('555') + ->with(['555']) ->will($this->returnValue([$tag])); - $this->assertTrue($this->getNode(false)->childExists('555')); + $this->assertTrue($this->getNode()->childExists('555')); } - public function testChildExistsWithInvisibleTagAsUser() { + public function testChildExistsWithInvisibleTag() { $tag = new SystemTag(555, 'TagOne', false, false); $this->tagMapper->expects($this->once()) @@ -325,10 +292,10 @@ class SystemTagsObjectMappingCollection extends \Test\TestCase { $this->tagManager->expects($this->once()) ->method('getTagsByIds') - ->with('555') + ->with(['555']) ->will($this->returnValue([$tag])); - $this->assertFalse($this->getNode(false)->childExists('555')); + $this->assertFalse($this->getNode()->childExists('555')); } public function testChildExistsNotFound() { diff --git a/apps/encryption/l10n/ro.js b/apps/encryption/l10n/ro.js index 88af06692ac..93a7358cfce 100644 --- a/apps/encryption/l10n/ro.js +++ b/apps/encryption/l10n/ro.js @@ -3,23 +3,48 @@ OC.L10N.register( { "Missing recovery key password" : "Lipsește parola cheii de recuperare", "Please repeat the recovery key password" : "Te rog repetă parola cheii de recuperare", - "Recovery key successfully enabled" : "Cheia de recupeare a fost activata cu succes", - "Could not enable recovery key. Please check your recovery key password!" : "Nu s-a putut activa cheia de recuperare. Verifica parola de recuperare!", - "Recovery key successfully disabled" : "Cheia de recuperare dezactivata cu succes", - "Could not disable recovery key. Please check your recovery key password!" : "Nu am putut dezactiva cheia de recuperare. Verifica parola de recuperare!", + "Repeated recovery key password does not match the provided recovery key password" : "Parolele cheii de recuperare nu se potrivesc", + "Recovery key successfully enabled" : "Cheia de recuperare a fost activată cu succes", + "Could not enable recovery key. Please check your recovery key password!" : "Nu s-a putut activa cheia de recuperare. Verifică-ți parola de recuperare!", + "Recovery key successfully disabled" : "Cheia de recuperare dezactivată cu succes", + "Could not disable recovery key. Please check your recovery key password!" : "Nu s-a putut dezactiva cheia de recuperare. Verifică-ți parola cheii de recuperare!", + "Missing parameters" : "Parametri lipsă", "Please provide the old recovery password" : "Te rog oferă parola de recuperare veche", "Please provide a new recovery password" : "Te rog oferă o nouă parolă de recuperare", "Please repeat the new recovery password" : "Te rog repetă noua parolă de recuperare", "Password successfully changed." : "Parola a fost modificată cu succes.", - "Could not change the password. Maybe the old password was not correct." : "Parola nu a putut fi schimbata. Poate ca parola veche este incorecta.", + "Could not change the password. Maybe the old password was not correct." : "Parola nu a putut fi schimbată. Poate ca parola veche este incorectă.", + "Recovery Key disabled" : "Cheia de recuperare a fost dezactivată", "Recovery Key enabled" : "Cheie de recuperare activată", "Could not enable the recovery key, please try again or contact your administrator" : "Nu poate fi activată cheia de recuperare, te rog încearcă din nou sau contactează administratorul", - "Private key password successfully updated." : "Cheia privata a fost actualizata cu succes", - "Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." : "Cheie privată nevalidă pentru aplicația Încriptare. Te rog, actualizează-ți parola cheii private folosind setările personale pentru a reaccesa fișierele tale încriptate.", - "Encryption App is enabled but your keys are not initialized, please log-out and log-in again" : "Aplicatia de criptare este activata dar tastatura nu este initializata , va rugam deconectati-va si reconectati-va", + "Could not update the private key password." : "Nu a putut fi actualizată parola cheii private.", + "The old password was not correct, please try again." : "Parola veche nu este cea corectă, încearcă din nou.", + "The current log-in password was not correct, please try again." : "Parola curentă de autentificare nu este corectă, încearcă din nou.", + "Private key password successfully updated." : "Parola cheii private a fost actualizată cu succes.", + "You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please run 'occ encryption:migrate' or contact your administrator" : "Este necesar să migrezi cheile de criptare de la vechiul algoritm (ownCloud <= 8.0) la cel nou. Rulează 'occ encryption:migrate' sau contactează-ți administratorul.", + "Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." : "Cheie privată invalidă pentru aplicația de criptare. Actualizează-ți parola cheii private folosind setările personale pentru a redobândi accesul la fișierele tale criptate.", + "Encryption App is enabled but your keys are not initialized, please log-out and log-in again" : "Aplicația de criptare este activată dar cheile nu sunt inițializate, te rugăm reautentifică-te", + "Encryption App is enabled and ready" : "Aplicația de criptare este activată", + "Bad Signature" : "Semnătură greșită", + "Missing Signature" : "Semnătură lipsă", "The share will expire on %s." : "Partajarea va expira în data de %s.", + "Cheers!" : "Noroc!", + "Enable recovery key" : "Activează cheia de recuperare", + "Disable recovery key" : "Dezactivează cheia de recuperare", + "Recovery key password" : "Parola cheii de recuperare", + "Repeat recovery key password" : "Repetă parola cheii de recuperare", + "Change recovery key password:" : "Schimbă parola cheii de recuperare:", + "Old recovery key password" : "Parola veche a cheii de recuperare", + "New recovery key password" : "Parola nouă a cheii de recuperare", + "Repeat new recovery key password" : "Repetă parola nouă a cheii de recuperare", "Change Password" : "Schimbă parola", - "ownCloud basic encryption module" : "modul de ecnriptie bazic ownCloud", + "ownCloud basic encryption module" : "modulul ownCloud de bază pentru criptare", + "Your private key password no longer matches your log-in password." : "Parola cheii tale private nu se mai potrivește cu parola pentru autentificare.", + "Old log-in password" : "Parola veche pentru autentificare", + "Current log-in password" : "Parola curentă pentru autentificare", + "Update Private Key Password" : "Actualizează parola cheii private", + "Enable password recovery:" : "Activează recuperarea parolei:", + "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" : "Activarea acestei opțiuni îți va permite să redobândești accesul la fișierele tale criptate în cazul pierderii parolei", "Enabled" : "Activat", "Disabled" : "Dezactivat" }, diff --git a/apps/encryption/l10n/ro.json b/apps/encryption/l10n/ro.json index 9251037e35f..985cb2c55ad 100644 --- a/apps/encryption/l10n/ro.json +++ b/apps/encryption/l10n/ro.json @@ -1,23 +1,48 @@ { "translations": { "Missing recovery key password" : "Lipsește parola cheii de recuperare", "Please repeat the recovery key password" : "Te rog repetă parola cheii de recuperare", - "Recovery key successfully enabled" : "Cheia de recupeare a fost activata cu succes", - "Could not enable recovery key. Please check your recovery key password!" : "Nu s-a putut activa cheia de recuperare. Verifica parola de recuperare!", - "Recovery key successfully disabled" : "Cheia de recuperare dezactivata cu succes", - "Could not disable recovery key. Please check your recovery key password!" : "Nu am putut dezactiva cheia de recuperare. Verifica parola de recuperare!", + "Repeated recovery key password does not match the provided recovery key password" : "Parolele cheii de recuperare nu se potrivesc", + "Recovery key successfully enabled" : "Cheia de recuperare a fost activată cu succes", + "Could not enable recovery key. Please check your recovery key password!" : "Nu s-a putut activa cheia de recuperare. Verifică-ți parola de recuperare!", + "Recovery key successfully disabled" : "Cheia de recuperare dezactivată cu succes", + "Could not disable recovery key. Please check your recovery key password!" : "Nu s-a putut dezactiva cheia de recuperare. Verifică-ți parola cheii de recuperare!", + "Missing parameters" : "Parametri lipsă", "Please provide the old recovery password" : "Te rog oferă parola de recuperare veche", "Please provide a new recovery password" : "Te rog oferă o nouă parolă de recuperare", "Please repeat the new recovery password" : "Te rog repetă noua parolă de recuperare", "Password successfully changed." : "Parola a fost modificată cu succes.", - "Could not change the password. Maybe the old password was not correct." : "Parola nu a putut fi schimbata. Poate ca parola veche este incorecta.", + "Could not change the password. Maybe the old password was not correct." : "Parola nu a putut fi schimbată. Poate ca parola veche este incorectă.", + "Recovery Key disabled" : "Cheia de recuperare a fost dezactivată", "Recovery Key enabled" : "Cheie de recuperare activată", "Could not enable the recovery key, please try again or contact your administrator" : "Nu poate fi activată cheia de recuperare, te rog încearcă din nou sau contactează administratorul", - "Private key password successfully updated." : "Cheia privata a fost actualizata cu succes", - "Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." : "Cheie privată nevalidă pentru aplicația Încriptare. Te rog, actualizează-ți parola cheii private folosind setările personale pentru a reaccesa fișierele tale încriptate.", - "Encryption App is enabled but your keys are not initialized, please log-out and log-in again" : "Aplicatia de criptare este activata dar tastatura nu este initializata , va rugam deconectati-va si reconectati-va", + "Could not update the private key password." : "Nu a putut fi actualizată parola cheii private.", + "The old password was not correct, please try again." : "Parola veche nu este cea corectă, încearcă din nou.", + "The current log-in password was not correct, please try again." : "Parola curentă de autentificare nu este corectă, încearcă din nou.", + "Private key password successfully updated." : "Parola cheii private a fost actualizată cu succes.", + "You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please run 'occ encryption:migrate' or contact your administrator" : "Este necesar să migrezi cheile de criptare de la vechiul algoritm (ownCloud <= 8.0) la cel nou. Rulează 'occ encryption:migrate' sau contactează-ți administratorul.", + "Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." : "Cheie privată invalidă pentru aplicația de criptare. Actualizează-ți parola cheii private folosind setările personale pentru a redobândi accesul la fișierele tale criptate.", + "Encryption App is enabled but your keys are not initialized, please log-out and log-in again" : "Aplicația de criptare este activată dar cheile nu sunt inițializate, te rugăm reautentifică-te", + "Encryption App is enabled and ready" : "Aplicația de criptare este activată", + "Bad Signature" : "Semnătură greșită", + "Missing Signature" : "Semnătură lipsă", "The share will expire on %s." : "Partajarea va expira în data de %s.", + "Cheers!" : "Noroc!", + "Enable recovery key" : "Activează cheia de recuperare", + "Disable recovery key" : "Dezactivează cheia de recuperare", + "Recovery key password" : "Parola cheii de recuperare", + "Repeat recovery key password" : "Repetă parola cheii de recuperare", + "Change recovery key password:" : "Schimbă parola cheii de recuperare:", + "Old recovery key password" : "Parola veche a cheii de recuperare", + "New recovery key password" : "Parola nouă a cheii de recuperare", + "Repeat new recovery key password" : "Repetă parola nouă a cheii de recuperare", "Change Password" : "Schimbă parola", - "ownCloud basic encryption module" : "modul de ecnriptie bazic ownCloud", + "ownCloud basic encryption module" : "modulul ownCloud de bază pentru criptare", + "Your private key password no longer matches your log-in password." : "Parola cheii tale private nu se mai potrivește cu parola pentru autentificare.", + "Old log-in password" : "Parola veche pentru autentificare", + "Current log-in password" : "Parola curentă pentru autentificare", + "Update Private Key Password" : "Actualizează parola cheii private", + "Enable password recovery:" : "Activează recuperarea parolei:", + "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" : "Activarea acestei opțiuni îți va permite să redobândești accesul la fișierele tale criptate în cazul pierderii parolei", "Enabled" : "Activat", "Disabled" : "Dezactivat" },"pluralForm" :"nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));" diff --git a/apps/federatedfilesharing/appinfo/app.php b/apps/federatedfilesharing/appinfo/app.php index 4666d343f7e..c33a887c6d6 100644 --- a/apps/federatedfilesharing/appinfo/app.php +++ b/apps/federatedfilesharing/appinfo/app.php @@ -20,4 +20,21 @@ */ $app = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing'); + +use OCA\FederatedFileSharing\Notifier; + +$l = \OC::$server->getL10N('files_sharing'); + $app->registerSettings(); + +$manager = \OC::$server->getNotificationManager(); +$manager->registerNotifier(function() { + return new Notifier( + \OC::$server->getL10NFactory() + ); +}, function() use ($l) { + return [ + 'id' => 'files_sharing', + 'name' => $l->t('Federated sharing'), + ]; +}); diff --git a/apps/federatedfilesharing/appinfo/database.xml b/apps/federatedfilesharing/appinfo/database.xml new file mode 100644 index 00000000000..1dbe8ee2ec9 --- /dev/null +++ b/apps/federatedfilesharing/appinfo/database.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> + +<!-- +Keep a mapping of the share ID stored in the local oc_share table +and the share ID stored in the remote servers oc_share table. +This is needed in order to send updates in both directions between +the servers (e.g. permissions change, unshare,...) +--> + +<database> + <name>*dbname*</name> + <create>true</create> + <overwrite>false</overwrite> + <charset>utf8</charset> + <table> + <name>*dbprefix*federated_reshares</name> + <declaration> + <field> + <name>share_id</name> + <type>integer</type> + <notnull>true</notnull> + <length>4</length> + </field> + <field> + <name>remote_id</name> + <type>integer</type> + <notnull>true</notnull> + <length>4</length> + <comments>share ID at the remote server</comments> + </field> + <index> + <name>share_id_index</name> + <unique>true</unique> + <field> + <name>share_id</name> + <sorting>ascending</sorting> + </field> + </index> + </declaration> + </table> +</database> diff --git a/apps/federatedfilesharing/appinfo/info.xml b/apps/federatedfilesharing/appinfo/info.xml index 643281bd145..5cf4039f196 100644 --- a/apps/federatedfilesharing/appinfo/info.xml +++ b/apps/federatedfilesharing/appinfo/info.xml @@ -5,7 +5,7 @@ <description>Provide federated file sharing across ownCloud servers</description> <licence>AGPL</licence> <author>Bjoern Schiessle, Roeland Jago Douma</author> - <version>0.2.0</version> + <version>0.3.0</version> <namespace>FederatedFileSharing</namespace> <category>other</category> <dependencies> diff --git a/apps/federatedfilesharing/l10n/cs_CZ.js b/apps/federatedfilesharing/l10n/cs_CZ.js index 2a5790b4584..02055fb06f3 100644 --- a/apps/federatedfilesharing/l10n/cs_CZ.js +++ b/apps/federatedfilesharing/l10n/cs_CZ.js @@ -10,7 +10,7 @@ OC.L10N.register( "Federated Cloud Sharing" : "Propojené cloudové sdílení", "Open documentation" : "Otevřít dokumentaci", "Allow users on this server to send shares to other servers" : "Povolit uživatelům z tohoto serveru zasílat sdílení na jiné servery", - "Allow users on this server to receive shares from other servers" : "Povolit uživatelům z tohoto serveru přijímat sdílení z jiných serverů", + "Allow users on this server to receive shares from other servers" : "Povolit uživatelům na tomto serveru přijímat sdílení z jiných serverů", "Federated Cloud" : "Sdružený cloud", "Your Federated Cloud ID:" : "Vaše sdružené cloud ID:", "Share it:" : "Sdílet:", diff --git a/apps/federatedfilesharing/l10n/cs_CZ.json b/apps/federatedfilesharing/l10n/cs_CZ.json index f3c057af1b0..165848afeb2 100644 --- a/apps/federatedfilesharing/l10n/cs_CZ.json +++ b/apps/federatedfilesharing/l10n/cs_CZ.json @@ -8,7 +8,7 @@ "Federated Cloud Sharing" : "Propojené cloudové sdílení", "Open documentation" : "Otevřít dokumentaci", "Allow users on this server to send shares to other servers" : "Povolit uživatelům z tohoto serveru zasílat sdílení na jiné servery", - "Allow users on this server to receive shares from other servers" : "Povolit uživatelům z tohoto serveru přijímat sdílení z jiných serverů", + "Allow users on this server to receive shares from other servers" : "Povolit uživatelům na tomto serveru přijímat sdílení z jiných serverů", "Federated Cloud" : "Sdružený cloud", "Your Federated Cloud ID:" : "Vaše sdružené cloud ID:", "Share it:" : "Sdílet:", diff --git a/apps/federatedfilesharing/lib/AppInfo/Application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index 5a213aec8e2..d1b0646ba5b 100644 --- a/apps/federatedfilesharing/lib/AppInfo/Application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php @@ -81,7 +81,8 @@ class Application extends App { \OC::$server->getL10N('federatedfilesharing'), \OC::$server->getLogger(), \OC::$server->getLazyRootFolder(), - \OC::$server->getConfig() + \OC::$server->getConfig(), + \OC::$server->getUserManager() ); } diff --git a/apps/federatedfilesharing/lib/BackgroundJob/UnShare.php b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php index b056db4eac7..109a607bff0 100644 --- a/apps/federatedfilesharing/lib/BackgroundJob/UnShare.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php @@ -32,26 +32,26 @@ use OCP\BackgroundJob\IJobList; use OCP\ILogger; /** - * Class UnShare + * Class RetryJob * - * Background job to re-send the un-share notification to the remote server in + * Background job to re-send update of federated re-shares to the remote server in * case the server was not available on the first try * * @package OCA\FederatedFileSharing\BackgroundJob */ -class UnShare extends Job { +class RetryJob extends Job { /** @var bool */ private $retainJob = true; - + /** @var Notifications */ private $notifications; - /** @var int max number of attempts to send the un-share request */ - private $maxTry = 10; + /** @var int max number of attempts to send the request */ + private $maxTry = 20; - /** @var int how much time should be between two tries (12 hours) */ - private $interval = 43200; + /** @var int how much time should be between two tries (10 minutes) */ + private $interval = 600; /** * UnShare constructor. @@ -77,7 +77,7 @@ class UnShare extends Job { \OC::$server->getJobList() ); } - + } /** @@ -99,12 +99,14 @@ class UnShare extends Job { protected function run($argument) { $remote = $argument['remote']; - $id = (int)$argument['id']; + $remoteId = $argument['remoteId']; $token = $argument['token']; + $action = $argument['action']; + $data = json_decode($argument['data'], true); $try = (int)$argument['try'] + 1; - $result = $this->notifications->sendRemoteUnShare($remote, $id, $token, $try); - + $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); + if ($result === true || $try > $this->maxTry) { $this->retainJob = false; } @@ -117,11 +119,13 @@ class UnShare extends Job { * @param array $argument */ protected function reAddJob(IJobList $jobList, array $argument) { - $jobList->add('OCA\FederatedFileSharing\BackgroundJob\UnShare', + $jobList->add('OCA\FederatedFileSharing\BackgroundJob\RetryJob', [ 'remote' => $argument['remote'], - 'id' => $argument['id'], + 'remoteId' => $argument['remoteId'], 'token' => $argument['token'], + 'data' => $argument['data'], + 'action' => $argument['action'], 'try' => (int)$argument['try'] + 1, 'lastRun' => time() ] diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index d014a6219a3..76fed01c308 100644 --- a/apps/federatedfilesharing/lib/FederatedShareProvider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php @@ -25,10 +25,10 @@ namespace OCA\FederatedFileSharing; use OC\Share20\Share; use OCP\Files\IRootFolder; -use OCP\IAppConfig; use OCP\IConfig; use OCP\IL10N; use OCP\ILogger; +use OCP\IUserManager; use OCP\Share\IShare; use OCP\Share\IShareProvider; use OC\Share20\Exception\InvalidShare; @@ -70,6 +70,12 @@ class FederatedShareProvider implements IShareProvider { /** @var IConfig */ private $config; + /** @var string */ + private $externalShareTable = 'share_external'; + + /** @var IUserManager */ + private $userManager; + /** * DefaultShareProvider constructor. * @@ -81,6 +87,7 @@ class FederatedShareProvider implements IShareProvider { * @param ILogger $logger * @param IRootFolder $rootFolder * @param IConfig $config + * @param IUserManager $userManager */ public function __construct( IDBConnection $connection, @@ -90,7 +97,8 @@ class FederatedShareProvider implements IShareProvider { IL10N $l10n, ILogger $logger, IRootFolder $rootFolder, - IConfig $config + IConfig $config, + IUserManager $userManager ) { $this->dbConnection = $connection; $this->addressHandler = $addressHandler; @@ -100,6 +108,7 @@ class FederatedShareProvider implements IShareProvider { $this->logger = $logger; $this->rootFolder = $rootFolder; $this->config = $config; + $this->userManager = $userManager; } /** @@ -124,10 +133,9 @@ class FederatedShareProvider implements IShareProvider { $shareWith = $share->getSharedWith(); $itemSource = $share->getNodeId(); $itemType = $share->getNodeType(); - $uidOwner = $share->getShareOwner(); $permissions = $share->getPermissions(); $sharedBy = $share->getSharedBy(); - + /* * Check if file is not already shared with the remote user */ @@ -151,31 +159,136 @@ class FederatedShareProvider implements IShareProvider { throw new \Exception($message_t); } - $token = $this->tokenHandler->generateToken(); + $share->setSharedWith($user . '@' . $remote); + + try { + $remoteShare = $this->getShareFromExternalShareTable($share); + } catch (ShareNotFound $e) { + $remoteShare = null; + } - $shareWith = $user . '@' . $remote; + if ($remoteShare) { + try { + $uidOwner = $remoteShare['owner'] . '@' . $remoteShare['remote']; + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, 'tmp_token_' . time()); + $share->setId($shareId); + list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId); + // remote share was create successfully if we get a valid token as return + $send = is_string($token) && $token !== ''; + } catch (\Exception $e) { + // fall back to old re-share behavior if the remote server + // doesn't support flat re-shares (was introduced with ownCloud 9.1) + $this->removeShareFromTable($share); + $shareId = $this->createFederatedShare($share); + } + if ($send) { + $this->updateSuccessfulReshare($shareId, $token); + $this->storeRemoteId($shareId, $remoteId); + } else { + $this->removeShareFromTable($share); + $message_t = $this->l->t('File is already shared with %s', [$shareWith]); + throw new \Exception($message_t); + } - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token); + } else { + $shareId = $this->createFederatedShare($share); + } + $data = $this->getRawShare($shareId); + return $this->createShareObject($data); + } + + /** + * create federated share and inform the recipient + * + * @param IShare $share + * @return int + * @throws ShareNotFound + * @throws \Exception + */ + protected function createFederatedShare(IShare $share) { + $token = $this->tokenHandler->generateToken(); + $shareId = $this->addShareToDB( + $share->getNodeId(), + $share->getNodeType(), + $share->getSharedWith(), + $share->getSharedBy(), + $share->getShareOwner(), + $share->getPermissions(), + $token + ); + $sharedByFederatedId = $share->getSharedBy(); + if ($this->userManager->userExists($sharedByFederatedId)) { + $sharedByFederatedId = $sharedByFederatedId . '@' . $this->addressHandler->generateRemoteURL(); + } $send = $this->notifications->sendRemoteShare( $token, - $shareWith, + $share->getSharedWith(), $share->getNode()->getName(), $shareId, - $share->getSharedBy() + $share->getShareOwner(), + $share->getShareOwner() . '@' . $this->addressHandler->generateRemoteURL(), + $share->getSharedBy(), + $sharedByFederatedId ); - $data = $this->getRawShare($shareId); - $share = $this->createShare($data); - if ($send === false) { - $this->delete($share); + $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(), $shareWith]); + [$share->getNode()->getName(), $share->getSharedWith()]); throw new \Exception($message_t); } - return $share; + return $shareId; + } + + /** + * @param string $shareWith + * @param IShare $share + * @param string $shareId internal share Id + * @return array + * @throws \Exception + */ + protected function askOwnerToReShare($shareWith, IShare $share, $shareId) { + + $remoteShare = $this->getShareFromExternalShareTable($share); + $token = $remoteShare['share_token']; + $remoteId = $remoteShare['remote_id']; + $remote = $remoteShare['remote']; + + list($token, $remoteId) = $this->notifications->requestReShare( + $token, + $remoteId, + $shareId, + $remote, + $shareWith, + $share->getPermissions() + ); + + return [$token, $remoteId]; + } + + /** + * get federated share from the share_external table but exclude mounted link shares + * + * @param IShare $share + * @return array + * @throws ShareNotFound + */ + protected function getShareFromExternalShareTable(IShare $share) { + $query = $this->dbConnection->getQueryBuilder(); + $query->select('*')->from($this->externalShareTable) + ->where($query->expr()->eq('user', $query->createNamedParameter($share->getShareOwner()))) + ->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget()))); + $result = $query->execute()->fetchAll(); + + if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { + return $result[0]; + } + + throw new ShareNotFound('share not found in share_external table'); } /** @@ -234,10 +347,86 @@ class FederatedShareProvider implements IShareProvider { ->set('uid_initiator', $qb->createNamedParameter($share->getSharedBy())) ->execute(); + // send the updated permission to the owner/initiator, if they are not the same + if ($share->getShareOwner() !== $share->getSharedBy()) { + $this->sendPermissionUpdate($share); + } + return $share; } /** + * send the updated permission to the owner/initiator, if they are not the same + * + * @param IShare $share + * @throws ShareNotFound + * @throws \OC\HintException + */ + protected function sendPermissionUpdate(IShare $share) { + $remoteId = $this->getRemoteId($share); + // if the local user is the owner we send the permission change to the initiator + if ($this->userManager->userExists($share->getShareOwner())) { + list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); + } else { // ... if not we send the permission change to the owner + list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner()); + } + $this->notifications->sendPermissionChange($remote, $remoteId, $share->getToken(), $share->getPermissions()); + } + + + /** + * update successful reShare with the correct token + * + * @param int $shareId + * @param string $token + */ + protected function updateSuccessfulReShare($shareId, $token) { + $query = $this->dbConnection->getQueryBuilder(); + $query->update('share') + ->where($query->expr()->eq('id', $query->createNamedParameter($shareId))) + ->set('token', $query->createNamedParameter($token)) + ->execute(); + } + + /** + * store remote ID in federated reShare table + * + * @param $shareId + * @param $remoteId + */ + public function storeRemoteId($shareId, $remoteId) { + $query = $this->dbConnection->getQueryBuilder(); + $query->insert('federated_reshares') + ->values( + [ + 'share_id' => $query->createNamedParameter($shareId), + 'remote_id' => $query->createNamedParameter($remoteId), + ] + ); + $query->execute(); + } + + /** + * get share ID on remote server for federated re-shares + * + * @param IShare $share + * @return int + * @throws ShareNotFound + */ + public function getRemoteId(IShare $share) { + $query = $this->dbConnection->getQueryBuilder(); + $query->select('remote_id')->from('federated_reshares') + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); + $data = $query->execute()->fetch(); + + if (!is_array($data) || !isset($data['remote_id'])) { + throw new ShareNotFound(); + } + + return (int)$data['remote_id']; + } + + /** * @inheritdoc */ public function move(IShare $share, $recipient) { @@ -266,7 +455,7 @@ class FederatedShareProvider implements IShareProvider { $cursor = $qb->execute(); while($data = $cursor->fetch()) { - $children[] = $this->createShare($data); + $children[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -274,18 +463,77 @@ class FederatedShareProvider implements IShareProvider { } /** - * Delete a share + * Delete a share (owner unShares the file) * * @param IShare $share */ public function delete(IShare $share) { + + list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith()); + + $isOwner = false; + + // if the local user is the owner we can send the unShare request directly... + if ($this->userManager->userExists($share->getShareOwner())) { + $this->notifications->sendRemoteUnShare($remote, $share->getId(), $share->getToken()); + $this->revokeShare($share, true); + $isOwner = true; + } else { // ... if not we need to correct ID for the unShare request + $remoteId = $this->getRemoteId($share); + $this->notifications->sendRemoteUnShare($remote, $remoteId, $share->getToken()); + $this->revokeShare($share, false); + } + + // send revoke notification to the other user, if initiator and owner are not the same user + if ($share->getShareOwner() !== $share->getSharedBy()) { + $remoteId = $this->getRemoteId($share); + if ($isOwner) { + list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); + } else { + list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner()); + } + $this->notifications->sendRevokeShare($remote, $remoteId, $share->getToken()); + } + + $this->removeShareFromTable($share); + } + + /** + * in case of a re-share we need to send the other use (initiator or owner) + * a message that the file was unshared + * + * @param IShare $share + * @param bool $isOwner the user can either be the owner or the user who re-sahred it + * @throws ShareNotFound + * @throws \OC\HintException + */ + protected function revokeShare($share, $isOwner) { + // also send a unShare request to the initiator, if this is a different user than the owner + if ($share->getShareOwner() !== $share->getSharedBy()) { + if ($isOwner) { + list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); + } else { + list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner()); + } + $remoteId = $this->getRemoteId($share); + $this->notifications->sendRevokeShare($remote, $remoteId, $share->getToken()); + } + } + + /** + * remove share from table + * + * @param IShare $share + */ + public function removeShareFromTable(IShare $share) { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))); $qb->execute(); - list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith()); - $this->notifications->sendRemoteUnShare($remote, $share->getId(), $share->getToken()); + $qb->delete('federated_reshares') + ->where($qb->expr()->eq('share_id', $qb->createNamedParameter($share->getId()))); + $qb->execute(); } /** @@ -348,7 +596,7 @@ class FederatedShareProvider implements IShareProvider { $cursor = $qb->execute(); $shares = []; while($data = $cursor->fetch()) { - $shares[] = $this->createShare($data); + $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -375,7 +623,7 @@ class FederatedShareProvider implements IShareProvider { } try { - $share = $this->createShare($data); + $share = $this->createShareObject($data); } catch (InvalidShare $e) { throw new ShareNotFound(); } @@ -400,7 +648,7 @@ class FederatedShareProvider implements IShareProvider { $shares = []; while($data = $cursor->fetch()) { - $shares[] = $this->createShare($data); + $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -439,7 +687,7 @@ class FederatedShareProvider implements IShareProvider { $cursor = $qb->execute(); while($data = $cursor->fetch()) { - $shares[] = $this->createShare($data); + $shares[] = $this->createShareObject($data); } $cursor->closeCursor(); @@ -470,7 +718,7 @@ class FederatedShareProvider implements IShareProvider { } try { - $share = $this->createShare($data); + $share = $this->createShareObject($data); } catch (InvalidShare $e) { throw new ShareNotFound(); } @@ -512,9 +760,9 @@ class FederatedShareProvider implements IShareProvider { * @throws InvalidShare * @throws ShareNotFound */ - private function createShare($data) { + private function createShareObject($data) { - $share = new Share($this->rootFolder); + $share = new Share($this->rootFolder, $this->userManager); $share->setId((int)$data['id']) ->setShareType((int)$data['share_type']) ->setPermissions((int)$data['permissions']) diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 9cdc7760361..bf9e0fc9634 100644 --- a/apps/federatedfilesharing/lib/Notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php @@ -23,6 +23,7 @@ namespace OCA\FederatedFileSharing; +use OCP\AppFramework\Http; use OCP\BackgroundJob\IJobList; use OCP\Http\Client\IClientService; @@ -67,9 +68,14 @@ class Notifications { * @param string $name * @param int $remote_id * @param string $owner + * @param string $ownerFederatedId + * @param string $sharedBy + * @param string $sharedByFederatedId * @return bool + * @throws \OC\HintException + * @throws \OC\ServerNotAvailableException */ - public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner) { + public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId) { list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith); @@ -83,6 +89,9 @@ class Notifications { 'name' => $name, 'remoteId' => $remote_id, 'owner' => $owner, + 'ownerFederatedId' => $ownerFederatedId, + 'sharedBy' => $sharedBy, + 'sharedByFederatedId' => $sharedByFederatedId, 'remote' => $local, ); @@ -101,34 +110,142 @@ class Notifications { } /** + * ask owner to re-share the file with the given user + * + * @param string $token + * @param int $id remote Id + * @param int $shareId internal share Id + * @param string $remote remote address of the owner + * @param string $shareWith + * @param int $permission + * @return bool + * @throws \OC\HintException + * @throws \OC\ServerNotAvailableException + */ + public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission) { + + $fields = array( + 'shareWith' => $shareWith, + 'token' => $token, + 'permission' => $permission, + 'remoteId' => $shareId + ); + + $url = $this->addressHandler->removeProtocolFromUrl($remote); + $result = $this->tryHttpPostToShareEndpoint(rtrim($url, '/'), '/' . $id . '/reshare', $fields); + $status = json_decode($result['result'], true); + + $httpRequestSuccessful = $result['success']; + $ocsCallSuccessful = $status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200; + $validToken = isset($status['ocs']['data']['token']) && is_string($status['ocs']['data']['token']); + $validRemoteId = isset($status['ocs']['data']['remoteId']); + + if ($httpRequestSuccessful && $ocsCallSuccessful && $validToken && $validRemoteId) { + return [ + $status['ocs']['data']['token'], + (int)$status['ocs']['data']['remoteId'] + ]; + } + + return false; + } + + /** * send server-to-server unshare to remote server * * @param string $remote url * @param int $id share id * @param string $token - * @param int $try how often did we already tried to send the un-share request * @return bool */ - public function sendRemoteUnShare($remote, $id, $token, $try = 0) { - $url = rtrim($remote, '/'); - $fields = array('token' => $token, 'format' => 'json'); - $url = $this->addressHandler->removeProtocolFromUrl($url); - $result = $this->tryHttpPostToShareEndpoint($url, '/'.$id.'/unshare', $fields); + public function sendRemoteUnShare($remote, $id, $token) { + $this->sendUpdateToRemote($remote, $id, $token, 'unshare'); + } + + /** + * send server-to-server unshare to remote server + * + * @param string $remote url + * @param int $id share id + * @param string $token + * @return bool + */ + public function sendRevokeShare($remote, $id, $token) { + $this->sendUpdateToRemote($remote, $id, $token, 'revoke'); + } + + /** + * send notification to remote server if the permissions was changed + * + * @param string $remote + * @param int $remoteId + * @param string $token + * @param int $permissions + * @return bool + */ + public function sendPermissionChange($remote, $remoteId, $token, $permissions) { + $this->sendUpdateToRemote($remote, $remoteId, $token, 'permissions', ['permissions' => $permissions]); + } + + /** + * forward accept reShare to remote server + * + * @param string $remote + * @param int $remoteId + * @param string $token + */ + public function sendAcceptShare($remote, $remoteId, $token) { + $this->sendUpdateToRemote($remote, $remoteId, $token, 'accept'); + } + + /** + * forward decline reShare to remote server + * + * @param string $remote + * @param int $remoteId + * @param string $token + */ + public function sendDeclineShare($remote, $remoteId, $token) { + $this->sendUpdateToRemote($remote, $remoteId, $token, 'decline'); + } + + /** + * inform remote server whether server-to-server share was accepted/declined + * + * @param string $remote + * @param string $token + * @param int $remoteId Share id on the remote host + * @param string $action possible actions: accept, decline, unshare, revoke, permissions + * @param array $data + * @param int $try + * @return boolean + */ + public function sendUpdateToRemote($remote, $remoteId, $token, $action, $data = [], $try = 0) { + + $fields = array('token' => $token); + foreach ($data as $key => $value) { + $fields[$key] = $value; + } + + $url = $this->addressHandler->removeProtocolFromUrl($remote); + $result = $this->tryHttpPostToShareEndpoint(rtrim($url, '/'), '/' . $remoteId . '/' . $action, $fields); $status = json_decode($result['result'], true); - if ($result['success'] && - ($status['ocs']['meta']['statuscode'] === 100 || + if ($result['success'] && + ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200 ) ) { return true; } elseif ($try === 0) { // only add new job on first try - $this->jobList->add('OCA\FederatedFileSharing\BackgroundJob\UnShare', + $this->jobList->add('OCA\FederatedFileSharing\BackgroundJob\RetryJob', [ 'remote' => $remote, - 'id' => $id, + 'remoteId' => $remoteId, 'token' => $token, + 'action' => $action, + 'data' => json_encode($data), 'try' => $try, 'lastRun' => $this->getTimestamp() ] @@ -138,6 +255,7 @@ class Notifications { return false; } + /** * return current timestamp * @@ -154,6 +272,7 @@ class Notifications { * @param string $urlSuffix * @param array $fields post parameters * @return array + * @throws \Exception */ protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields) { $client = $this->httpClientService->newClient(); @@ -174,6 +293,12 @@ class Notifications { $result['success'] = true; break; } catch (\Exception $e) { + // if flat re-sharing is not supported by the remote server + // we re-throw the exception and fall back to the old behaviour. + // (flat re-shares has been introduced in ownCloud 9.1) + if ($e->getCode() === Http::STATUS_INTERNAL_SERVER_ERROR) { + throw $e; + } $try++; $protocol = 'http://'; } diff --git a/apps/federatedfilesharing/lib/RequestHandler.php b/apps/federatedfilesharing/lib/RequestHandler.php new file mode 100644 index 00000000000..01ab96822d8 --- /dev/null +++ b/apps/federatedfilesharing/lib/RequestHandler.php @@ -0,0 +1,580 @@ +<?php +/** + * @author Arthur Schiwon <blizzz@owncloud.com> + * @author Björn Schießle <schiessle@owncloud.com> + * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * + * @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 <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\FederatedFileSharing; + +use OCA\Files_Sharing\Activity; +use OCP\AppFramework\Http; +use OCP\Constants; +use OCP\Files\NotFoundException; +use OCP\IDBConnection; +use OCP\IRequest; +use OCP\IUserManager; +use OCP\Share; + +/** + * Class RequestHandler + * + * handles OCS Request to the federated share API + * + * @package OCA\FederatedFileSharing\API + */ +class RequestHandler { + + /** @var FederatedShareProvider */ + private $federatedShareProvider; + + /** @var IDBConnection */ + private $connection; + + /** @var Share\IManager */ + private $shareManager; + + /** @var IRequest */ + private $request; + + /** @var Notifications */ + private $notifications; + + /** @var AddressHandler */ + private $addressHandler; + + /** @var IUserManager */ + private $userManager; + + /** @var string */ + private $shareTable = 'share'; + + /** + * Server2Server constructor. + * + * @param FederatedShareProvider $federatedShareProvider + * @param IDBConnection $connection + * @param Share\IManager $shareManager + * @param IRequest $request + * @param Notifications $notifications + * @param AddressHandler $addressHandler + * @param IUserManager $userManager + */ + public function __construct(FederatedShareProvider $federatedShareProvider, + IDBConnection $connection, + Share\IManager $shareManager, + IRequest $request, + Notifications $notifications, + AddressHandler $addressHandler, + IUserManager $userManager + ) { + $this->federatedShareProvider = $federatedShareProvider; + $this->connection = $connection; + $this->shareManager = $shareManager; + $this->request = $request; + $this->notifications = $notifications; + $this->addressHandler = $addressHandler; + $this->userManager = $userManager; + } + + /** + * create a new share + * + * @param array $params + * @return \OC_OCS_Result + */ + public function createShare($params) { + + if (!$this->isS2SEnabled(true)) { + return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); + } + + $remote = isset($_POST['remote']) ? $_POST['remote'] : null; + $token = isset($_POST['token']) ? $_POST['token'] : null; + $name = isset($_POST['name']) ? $_POST['name'] : null; + $owner = isset($_POST['owner']) ? $_POST['owner'] : null; + $sharedBy = isset($_POST['sharedBy']) ? $_POST['sharedBy'] : null; + $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; + $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; + $sharedByFederatedId = isset($_POST['sharedByFederatedId']) ? $_POST['sharedByFederatedId'] : null; + $ownerFederatedId = isset($_POST['ownerFederatedId']) ? $_POST['ownerFederatedId'] : null; + + if ($remote && $token && $name && $owner && $remoteId && $shareWith) { + + if(!\OCP\Util::isValidFileName($name)) { + return new \OC_OCS_Result(null, 400, 'The mountpoint name contains invalid characters.'); + } + + // FIXME this should be a method in the user management instead + \OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG); + \OCP\Util::emitHook( + '\OCA\Files_Sharing\API\Server2Server', + 'preLoginNameUsedAsUserName', + array('uid' => &$shareWith) + ); + \OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG); + + if (!\OCP\User::userExists($shareWith)) { + return new \OC_OCS_Result(null, 400, 'User does not exists'); + } + + \OC_Util::setupFS($shareWith); + + $discoveryManager = new DiscoveryManager( + \OC::$server->getMemCacheFactory(), + \OC::$server->getHTTPClientService() + ); + $externalManager = new \OCA\Files_Sharing\External\Manager( + \OC::$server->getDatabaseConnection(), + \OC\Files\Filesystem::getMountManager(), + \OC\Files\Filesystem::getLoader(), + \OC::$server->getHTTPHelper(), + \OC::$server->getNotificationManager(), + $discoveryManager, + $shareWith + ); + + try { + $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId); + $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); + + if ($ownerFederatedId === null) { + $ownerFederatedId = $owner . '@' . $this->cleanupRemote($remote); + } + // if the owner of the share and the initiator are the same user + // we also complete the federated share ID for the initiator + if ($sharedByFederatedId === null && $owner === $sharedBy) { + $sharedByFederatedId = $ownerFederatedId; + } + + \OC::$server->getActivityManager()->publishActivity( + Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($ownerFederatedId, trim($name, '/')), '', array(), + '', '', $shareWith, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_LOW); + + $urlGenerator = \OC::$server->getURLGenerator(); + + $notificationManager = \OC::$server->getNotificationManager(); + $notification = $notificationManager->createNotification(); + $notification->setApp('files_sharing') + ->setUser($shareWith) + ->setDateTime(new \DateTime()) + ->setObject('remote_share', $shareId) + ->setSubject('remote_share', [$ownerFederatedId, $sharedByFederatedId, trim($name, '/')]); + + $declineAction = $notification->createAction(); + $declineAction->setLabel('decline') + ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); + $notification->addAction($declineAction); + + $acceptAction = $notification->createAction(); + $acceptAction->setLabel('accept') + ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); + $notification->addAction($acceptAction); + + $notificationManager->notify($notification); + + return new \OC_OCS_Result(); + } catch (\Exception $e) { + \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR); + return new \OC_OCS_Result(null, 500, 'internal server error, was not able to add share from ' . $remote); + } + } + + return new \OC_OCS_Result(null, 400, 'server can not add remote share, missing parameter'); + } + + /** + * create re-share on behalf of another user + * + * @param $params + * @return \OC_OCS_Result + */ + public function reShare($params) { + + $id = isset($params['id']) ? (int)$params['id'] : null; + $token = $this->request->getParam('token', null); + $shareWith = $this->request->getParam('shareWith', null); + $permission = (int)$this->request->getParam('permission', null); + $remoteId = (int)$this->request->getParam('remoteId', null); + + if ($id === null || + $token === null || + $shareWith === null || + $permission === null || + $remoteId === null + ) { + return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST); + } + + try { + $share = $this->federatedShareProvider->getShareById($id); + } catch (Share\Exceptions\ShareNotFound $e) { + return new \OC_OCS_Result(null, Http::STATUS_NOT_FOUND); + } + + // don't allow to share a file back to the owner + list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith); + $owner = $share->getShareOwner(); + $currentServer = $this->addressHandler->generateRemoteURL(); + if ($this->addressHandler->compareAddresses($user, $remote,$owner , $currentServer)) { + return new \OC_OCS_Result(null, Http::STATUS_FORBIDDEN); + } + + if ($this->verifyShare($share, $token)) { + + // check if re-sharing is allowed + if ($share->getPermissions() | ~Constants::PERMISSION_SHARE) { + $share->setPermissions($share->getPermissions() & $permission); + // the recipient of the initial share is now the initiator for the re-share + $share->setSharedBy($share->getSharedWith()); + $share->setSharedWith($shareWith); + try { + $result = $this->federatedShareProvider->create($share); + $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $remoteId); + return new \OC_OCS_Result(['token' => $result->getToken(), 'remoteId' => $result->getId()]); + } catch (\Exception $e) { + return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST); + } + } else { + return new \OC_OCS_Result(null, Http::STATUS_FORBIDDEN); + } + } + return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST); + + } + + /** + * accept server-to-server share + * + * @param array $params + * @return \OC_OCS_Result + */ + public function acceptShare($params) { + + if (!$this->isS2SEnabled()) { + return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); + } + + $id = $params['id']; + $token = isset($_POST['token']) ? $_POST['token'] : null; + + try { + $share = $this->federatedShareProvider->getShareById($id); + } catch (Share\Exceptions\ShareNotFound $e) { + return new \OC_OCS_Result(); + } + + if ($this->verifyShare($share, $token)) { + $this->executeAcceptShare($share); + if ($share->getShareOwner() !== $share->getSharedBy()) { + list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); + $remoteId = $this->federatedShareProvider->getRemoteId($share); + $this->notifications->sendAcceptShare($remote, $remoteId, $share->getToken()); + } + } + + return new \OC_OCS_Result(); + } + + protected function executeAcceptShare(Share\IShare $share) { + list($file, $link) = $this->getFile($this->getCorrectUid($share), $share->getNode()->getId()); + + $event = \OC::$server->getActivityManager()->generateEvent(); + $event->setApp(Activity::FILES_SHARING_APP) + ->setType(Activity::TYPE_REMOTE_SHARE) + ->setAffectedUser($this->getCorrectUid($share)) + ->setSubject(Activity::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share->getSharedWith(), basename($file)]) + ->setObject('files', $share->getNode()->getId(), $file) + ->setLink($link); + \OC::$server->getActivityManager()->publish($event); + } + + /** + * decline server-to-server share + * + * @param array $params + * @return \OC_OCS_Result + */ + public function declineShare($params) { + + if (!$this->isS2SEnabled()) { + return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); + } + + $id = (int)$params['id']; + $token = isset($_POST['token']) ? $_POST['token'] : null; + + try { + $share = $this->federatedShareProvider->getShareById($id); + } catch (Share\Exceptions\ShareNotFound $e) { + return new \OC_OCS_Result(); + } + + if($this->verifyShare($share, $token)) { + if ($share->getShareOwner() !== $share->getSharedBy()) { + list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); + $remoteId = $this->federatedShareProvider->getRemoteId($share); + $this->notifications->sendDeclineShare($remote, $remoteId, $share->getToken()); + } + $this->executeDeclineShare($share); + } + + return new \OC_OCS_Result(); + } + + /** + * delete declined share and create a activity + * + * @param Share\IShare $share + */ + protected function executeDeclineShare(Share\IShare $share) { + $this->federatedShareProvider->removeShareFromTable($share); + list($file, $link) = $this->getFile($this->getCorrectUid($share), $share->getNode()->getId()); + + $event = \OC::$server->getActivityManager()->generateEvent(); + $event->setApp(Activity::FILES_SHARING_APP) + ->setType(Activity::TYPE_REMOTE_SHARE) + ->setAffectedUser($this->getCorrectUid($share)) + ->setSubject(Activity::SUBJECT_REMOTE_SHARE_DECLINED, [$share->getSharedWith(), basename($file)]) + ->setObject('files', $share->getNode()->getId(), $file) + ->setLink($link); + \OC::$server->getActivityManager()->publish($event); + + } + + /** + * check if we are the initiator or the owner of a re-share and return the correct UID + * + * @param Share\IShare $share + * @return string + */ + protected function getCorrectUid(Share\IShare $share) { + if($this->userManager->userExists($share->getShareOwner())) { + return $share->getShareOwner(); + } + + return $share->getSharedBy(); + } + + /** + * remove server-to-server share if it was unshared by the owner + * + * @param array $params + * @return \OC_OCS_Result + */ + public function unshare($params) { + + if (!$this->isS2SEnabled()) { + return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); + } + + $id = $params['id']; + $token = isset($_POST['token']) ? $_POST['token'] : null; + + $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); + $query->execute(array($id, $token)); + $share = $query->fetchRow(); + + if ($token && $id && !empty($share)) { + + $remote = $this->cleanupRemote($share['remote']); + + $owner = $share['owner'] . '@' . $remote; + $mountpoint = $share['mountpoint']; + $user = $share['user']; + + $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); + $query->execute(array($id, $token)); + + if ($share['accepted']) { + $path = trim($mountpoint, '/'); + } else { + $path = trim($share['name'], '/'); + } + + $notificationManager = \OC::$server->getNotificationManager(); + $notification = $notificationManager->createNotification(); + $notification->setApp('files_sharing') + ->setUser($share['user']) + ->setObject('remote_share', (int) $share['id']); + $notificationManager->markProcessed($notification); + + \OC::$server->getActivityManager()->publishActivity( + Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_UNSHARED, array($owner, $path), '', array(), + '', '', $user, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_MEDIUM); + } + + return new \OC_OCS_Result(); + } + + private function cleanupRemote($remote) { + $remote = substr($remote, strpos($remote, '://') + 3); + + return rtrim($remote, '/'); + } + + + /** + * federated share was revoked, either by the owner or the re-sharer + * + * @param $params + * @return \OC_OCS_Result + */ + public function revoke($params) { + $id = (int)$params['id']; + $token = $this->request->getParam('token'); + + $share = $this->federatedShareProvider->getShareById($id); + + if ($this->verifyShare($share, $token)) { + $this->federatedShareProvider->removeShareFromTable($share); + return new \OC_OCS_Result(); + } + + return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST); + + } + + /** + * get share + * + * @param int $id + * @param string $token + * @return array|bool + */ + protected function getShare($id, $token) { + $query = $this->connection->getQueryBuilder(); + $query->select('*')->from($this->shareTable) + ->where($query->expr()->eq('token', $query->createNamedParameter($token))) + ->andWhere($query->expr()->eq('share_type', $query->createNamedParameter(FederatedShareProvider::SHARE_TYPE_REMOTE))) + ->andWhere($query->expr()->eq('id', $query->createNamedParameter($id))); + + $result = $query->execute()->fetchAll(); + + if (!empty($result) && isset($result[0])) { + return $result[0]; + } + + return false; + } + + /** + * get file + * + * @param string $user + * @param int $fileSource + * @return array with internal path of the file and a absolute link to it + */ + private function getFile($user, $fileSource) { + \OC_Util::setupFS($user); + + try { + $file = \OC\Files\Filesystem::getPath($fileSource); + } catch (NotFoundException $e) { + $file = null; + } + $args = \OC\Files\Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file); + $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args); + + return array($file, $link); + + } + + /** + * check if server-to-server sharing is enabled + * + * @param bool $incoming + * @return bool + */ + private function isS2SEnabled($incoming = false) { + + $result = \OCP\App::isEnabled('files_sharing'); + + if ($incoming) { + $result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled(); + } else { + $result = $result && $this->federatedShareProvider->isOutgoingServer2serverShareEnabled(); + } + + return $result; + } + + /** + * check if we got the right share + * + * @param Share\IShare $share + * @param string $token + * @return bool + */ + protected function verifyShare(Share\IShare $share, $token) { + if ( + $share->getShareType() === FederatedShareProvider::SHARE_TYPE_REMOTE && + $share->getToken() === $token + ) { + return true; + } + + return false; + } + + /** + * update share information to keep federated re-shares in sync + * + * @param array $params + * @return \OC_OCS_Result + */ + public function updatePermissions($params) { + $id = (int)$params['id']; + $token = $this->request->getParam('token', null); + $permissions = $this->request->getParam('permissions', null); + + try { + $share = $this->federatedShareProvider->getShareById($id); + } catch (Share\Exceptions\ShareNotFound $e) { + return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST); + } + + $validPermission = ctype_digit($permissions); + $validToken = $this->verifyShare($share, $token); + if ($validPermission && $validToken) { + $this->updatePermissionsInDatabase($share, (int)$permissions); + } else { + return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST); + } + + return new \OC_OCS_Result(); + } + + /** + * update permissions in database + * + * @param IShare $share + * @param int $permissions + */ + protected function updatePermissionsInDatabase(IShare $share, $permissions) { + $query = $this->connection->getQueryBuilder(); + $query->update('share') + ->where($query->expr()->eq('id', $query->createNamedParameter($share->getId()))) + ->set('permissions', $query->createNamedParameter($permissions)) + ->execute(); + } + +} diff --git a/apps/files_sharing/lib/notifier.php b/apps/federatedfilesharing/lib/notifier.php index 27e4e2565f2..1c8d92c7eca 100644 --- a/apps/files_sharing/lib/notifier.php +++ b/apps/federatedfilesharing/lib/notifier.php @@ -19,7 +19,7 @@ * */ -namespace OCA\Files_Sharing; +namespace OCA\FederatedFileSharing; use OCP\Notification\INotification; @@ -54,9 +54,15 @@ class Notifier implements INotifier { // Deal with known subjects case 'remote_share': $params = $notification->getSubjectParameters(); - $notification->setParsedSubject( - (string) $l->t('You received "/%2$s" as a remote share from %1$s', $params) - ); + if ($params[0] !== $params[1] && $params[1] !== null) { + $notification->setParsedSubject( + (string) $l->t('You received "/%3$s" as a remote share from %1$s (on behalf of %2$s)', $params) + ); + } else { + $notification->setParsedSubject( + (string)$l->t('You received "/%3$s" as a remote share from %1$s', $params) + ); + } // Deal with the actions for a known subject foreach ($notification->getActions() as $action) { diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index 9f7d8c49b4d..bb1c2c5a25a 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -27,9 +27,8 @@ namespace OCA\FederatedFileSharing\Tests; use OCA\FederatedFileSharing\AddressHandler; use OCP\IL10N; use OCP\IURLGenerator; -use Test\TestCase; -class AddressHandlerTest extends TestCase { +class AddressHandlerTest extends \Test\TestCase { /** @var AddressHandler */ private $addressHandler; diff --git a/apps/federatedfilesharing/tests/DiscoveryManagerTest.php b/apps/federatedfilesharing/tests/DiscoveryManagerTest.php index 9ae62b1ae4d..5af6b394dd2 100644 --- a/apps/federatedfilesharing/tests/DiscoveryManagerTest.php +++ b/apps/federatedfilesharing/tests/DiscoveryManagerTest.php @@ -26,9 +26,8 @@ use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; use OCP\ICache; use OCP\ICacheFactory; -use Test\TestCase; -class DiscoveryManagerTest extends TestCase { +class DiscoveryManagerTest extends \Test\TestCase { /** @var ICache */ private $cache; /** @var IClient */ diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 1fbae90a46f..9b3edf0398d 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -30,8 +30,8 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; +use OCP\IUserManager; use OCP\Share\IManager; -use Test\TestCase; /** * Class FederatedShareProviderTest @@ -39,7 +39,7 @@ use Test\TestCase; * @package OCA\FederatedFileSharing\Tests * @group DB */ -class FederatedShareProviderTest extends TestCase { +class FederatedShareProviderTest extends \Test\TestCase { /** @var IDBConnection */ protected $connection; @@ -57,6 +57,8 @@ class FederatedShareProviderTest extends TestCase { protected $rootFolder; /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ protected $config; + /** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject */ + protected $userManager; /** @var IManager */ protected $shareManager; @@ -82,7 +84,11 @@ class FederatedShareProviderTest extends TestCase { $this->logger = $this->getMock('OCP\ILogger'); $this->rootFolder = $this->getMock('OCP\Files\IRootFolder'); $this->config = $this->getMock('OCP\IConfig'); - $this->addressHandler = new AddressHandler(\OC::$server->getURLGenerator(), $this->l); + $this->userManager = $this->getMock('OCP\IUserManager'); + //$this->addressHandler = new AddressHandler(\OC::$server->getURLGenerator(), $this->l); + $this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler')->disableOriginalConstructor()->getMock(); + + $this->userManager->expects($this->any())->method('userExists')->willReturn(true); $this->provider = new FederatedShareProvider( $this->connection, @@ -92,7 +98,8 @@ class FederatedShareProviderTest extends TestCase { $this->l, $this->logger, $this->rootFolder, - $this->config + $this->config, + $this->userManager ); $this->shareManager = \OC::$server->getShareManager(); @@ -119,6 +126,11 @@ class FederatedShareProviderTest extends TestCase { $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( @@ -126,7 +138,10 @@ class FederatedShareProviderTest extends TestCase { $this->equalTo('user@server.com'), $this->equalTo('myFile'), $this->anything(), - 'sharedBy' + 'shareOwner', + 'shareOwner@http://localhost/', + 'sharedBy', + 'sharedBy@http://localhost/' )->willReturn(true); $this->rootFolder->expects($this->never())->method($this->anything()); @@ -182,6 +197,11 @@ class FederatedShareProviderTest extends TestCase { $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( @@ -189,7 +209,10 @@ class FederatedShareProviderTest extends TestCase { $this->equalTo('user@server.com'), $this->equalTo('myFile'), $this->anything(), - 'sharedBy' + 'shareOwner', + 'shareOwner@http://localhost/', + 'sharedBy', + 'sharedBy@http://localhost/' )->willReturn(false); $this->rootFolder->expects($this->once()) @@ -226,7 +249,10 @@ class FederatedShareProviderTest extends TestCase { $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); - $shareWith = 'sharedBy@' . $this->addressHandler->generateRemoteURL(); + $this->addressHandler->expects($this->any())->method('compareAddresses') + ->willReturn(true); + + $shareWith = 'sharedBy@localhost'; $share->setSharedWith($shareWith) ->setSharedBy('sharedBy') @@ -262,6 +288,10 @@ class FederatedShareProviderTest extends TestCase { $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); + + $this->addressHandler->expects($this->any())->method('splitUserRemote') + ->willReturn(['user', 'server.com']); + $share->setSharedWith('user@server.com') ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') @@ -270,6 +300,9 @@ class FederatedShareProviderTest extends TestCase { $this->tokenHandler->method('generateToken')->willReturn('token'); + $this->addressHandler->expects($this->any())->method('generateRemoteURL') + ->willReturn('http://localhost/'); + $this->notifications->expects($this->once()) ->method('sendRemoteShare') ->with( @@ -277,7 +310,10 @@ class FederatedShareProviderTest extends TestCase { $this->equalTo('user@server.com'), $this->equalTo('myFile'), $this->anything(), - 'sharedBy' + 'shareOwner', + 'shareOwner@http://localhost/', + 'sharedBy', + 'sharedBy@http://localhost/' )->willReturn(true); $this->rootFolder->expects($this->never())->method($this->anything()); @@ -291,20 +327,46 @@ class FederatedShareProviderTest extends TestCase { } } - public function testUpdate() { + /** + * @dataProvider datatTestUpdate + * + */ + public function testUpdate($owner, $sharedBy) { + + $this->provider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider') + ->setConstructorArgs( + [ + $this->connection, + $this->addressHandler, + $this->notifications, + $this->tokenHandler, + $this->l, + $this->logger, + $this->rootFolder, + $this->config, + $this->userManager + ] + )->setMethods(['sendPermissionUpdate'])->getMock(); + $share = $this->shareManager->newShare(); $node = $this->getMock('\OCP\Files\File'); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); + + $this->addressHandler->expects($this->any())->method('splitUserRemote') + ->willReturn(['user', 'server.com']); + $share->setSharedWith('user@server.com') - ->setSharedBy('sharedBy') - ->setShareOwner('shareOwner') + ->setSharedBy($sharedBy) + ->setShareOwner($owner) ->setPermissions(19) ->setNode($node); $this->tokenHandler->method('generateToken')->willReturn('token'); + $this->addressHandler->expects($this->any())->method('generateRemoteURL') + ->willReturn('http://localhost/'); $this->notifications->expects($this->once()) ->method('sendRemoteShare') @@ -313,9 +375,18 @@ class FederatedShareProviderTest extends TestCase { $this->equalTo('user@server.com'), $this->equalTo('myFile'), $this->anything(), - 'sharedBy' + $owner, + $owner . '@http://localhost/', + $sharedBy, + $sharedBy . '@http://localhost/' )->willReturn(true); + if($owner === $sharedBy) { + $this->provider->expects($this->never())->method('sendPermissionUpdate'); + } else { + $this->provider->expects($this->once())->method('sendPermissionUpdate'); + } + $this->rootFolder->expects($this->never())->method($this->anything()); $share = $this->provider->create($share); @@ -328,11 +399,24 @@ class FederatedShareProviderTest extends TestCase { $this->assertEquals(1, $share->getPermissions()); } + public function datatTestUpdate() { + return [ + ['sharedBy', 'shareOwner'], + ['shareOwner', 'shareOwner'] + ]; + } + public function testGetSharedBy() { $node = $this->getMock('\OCP\Files\File'); $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); + $this->addressHandler->expects($this->at(0))->method('splitUserRemote') + ->willReturn(['user', 'server.com']); + + $this->addressHandler->expects($this->at(1))->method('splitUserRemote') + ->willReturn(['user2', 'server.com']); + $this->tokenHandler->method('generateToken')->willReturn('token'); $this->notifications ->method('sendRemoteShare') @@ -439,6 +523,14 @@ class FederatedShareProviderTest extends TestCase { $node->method('getId')->willReturn(42); $node->method('getName')->willReturn('myFile'); + $this->addressHandler->expects($this->any())->method('splitUserRemote') + ->willReturnCallback(function ($uid) { + if ($uid === 'user@server.com') { + return ['user', 'server.com']; + } + return ['user2', 'server.com']; + }); + $this->tokenHandler->method('generateToken')->willReturn('token'); $this->notifications ->method('sendRemoteShare') diff --git a/apps/federatedfilesharing/tests/NotificationsTest.php b/apps/federatedfilesharing/tests/NotificationsTest.php index bde69a82bad..50a62e9829e 100644 --- a/apps/federatedfilesharing/tests/NotificationsTest.php +++ b/apps/federatedfilesharing/tests/NotificationsTest.php @@ -28,9 +28,8 @@ use OCA\FederatedFileSharing\DiscoveryManager; use OCA\FederatedFileSharing\Notifications; use OCP\BackgroundJob\IJobList; use OCP\Http\Client\IClientService; -use Test\TestCase; -class NotificationsTest extends TestCase { +class NotificationsTest extends \Test\TestCase { /** @var AddressHandler | \PHPUnit_Framework_MockObject_MockObject */ private $addressHandler; @@ -85,14 +84,15 @@ class NotificationsTest extends TestCase { return $instance; } + /** - * @dataProvider dataTestSendRemoteUnShare + * @dataProvider dataTestSendUpdateToRemote * * @param int $try * @param array $httpRequestResult * @param bool $expected */ - public function testSendRemoteUnShare($try, $httpRequestResult, $expected) { + public function testSendUpdateToRemote($try, $httpRequestResult, $expected) { $remote = 'remote'; $id = 42; $timestamp = 63576; @@ -102,20 +102,22 @@ class NotificationsTest extends TestCase { $instance->expects($this->any())->method('getTimestamp')->willReturn($timestamp); $instance->expects($this->once())->method('tryHttpPostToShareEndpoint') - ->with($remote, '/'.$id.'/unshare', ['token' => $token, 'format' => 'json']) + ->with($remote, '/'.$id.'/unshare', ['token' => $token, 'data1Key' => 'data1Value']) ->willReturn($httpRequestResult); $this->addressHandler->expects($this->once())->method('removeProtocolFromUrl') ->with($remote)->willReturn($remote); - + // only add background job on first try if ($try === 0 && $expected === false) { $this->jobList->expects($this->once())->method('add') ->with( - 'OCA\FederatedFileSharing\BackgroundJob\UnShare', + 'OCA\FederatedFileSharing\BackgroundJob\RetryJob', [ 'remote' => $remote, - 'id' => $id, + 'remoteId' => $id, + 'action' => 'unshare', + 'data' => json_encode(['data1Key' => 'data1Value']), 'token' => $token, 'try' => $try, 'lastRun' => $timestamp @@ -124,14 +126,15 @@ class NotificationsTest extends TestCase { } else { $this->jobList->expects($this->never())->method('add'); } - + $this->assertSame($expected, - $instance->sendRemoteUnShare($remote, $id, $token, $try) + $instance->sendUpdateToRemote($remote, $id, $token, 'unshare', ['data1Key' => 'data1Value'], $try) ); - + } - - public function dataTestSendRemoteUnshare() { + + + public function dataTestSendUpdateToRemote() { return [ // test if background job is added correctly [0, ['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 200]]])], true], diff --git a/apps/files_sharing/tests/server2server.php b/apps/federatedfilesharing/tests/RequestHandlerTest.php index 1d047916ca9..14da756a0ef 100644 --- a/apps/files_sharing/tests/server2server.php +++ b/apps/federatedfilesharing/tests/RequestHandlerTest.php @@ -23,14 +23,22 @@ * */ -use OCA\Files_Sharing\Tests\TestCase; +namespace OCA\FederatedFileSharing\Tests; + +use OC\Files\Filesystem; +use OCA\FederatedFileSharing\DiscoveryManager; +use OCA\FederatedFileSharing\FederatedShareProvider; +use OCA\FederatedFileSharing\RequestHandler; +use OCP\IUserManager; +use OCP\Share\IShare; /** - * Class Test_Files_Sharing_Api + * Class RequestHandlerTest * + * @package OCA\FederatedFileSharing\Tests * @group DB */ -class Test_Files_Sharing_S2S_OCS_API extends TestCase { +class RequestHandlerTest extends TestCase { const TEST_FOLDER_NAME = '/folder_share_api_test'; @@ -40,18 +48,30 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase { private $connection; /** - * @var \OCA\Files_Sharing\API\Server2Server + * @var RequestHandler */ private $s2s; /** @var \OCA\FederatedFileSharing\FederatedShareProvider | PHPUnit_Framework_MockObject_MockObject */ private $federatedShareProvider; + /** @var \OCA\FederatedFileSharing\Notifications | PHPUnit_Framework_MockObject_MockObject */ + private $notifications; + + /** @var \OCA\FederatedFileSharing\AddressHandler | PHPUnit_Framework_MockObject_MockObject */ + private $addressHandler; + + /** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject */ + private $userManager; + + /** @var IShare | \PHPUnit_Framework_MockObject_MockObject */ + private $share; + protected function setUp() { parent::setUp(); self::loginHelper(self::TEST_FILES_SHARING_API_USER1); - \OCP\Share::registerBackend('test', 'Test_Share_Backend'); + \OCP\Share::registerBackend('test', 'Test\Share\Backend'); $config = $this->getMockBuilder('\OCP\IConfig') ->disableOriginalConstructor()->getMock(); @@ -60,16 +80,33 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase { ->setConstructorArgs([$config, $clientService]) ->getMock(); $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true)); + $this->share = $this->getMock('\OCP\Share\IShare'); $this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider') ->disableOriginalConstructor()->getMock(); $this->federatedShareProvider->expects($this->any()) ->method('isOutgoingServer2serverShareEnabled')->willReturn(true); $this->federatedShareProvider->expects($this->any()) ->method('isIncomingServer2serverShareEnabled')->willReturn(true); + $this->federatedShareProvider->expects($this->any())->method('getShareById') + ->willReturn($this->share); + $this->notifications = $this->getMockBuilder('OCA\FederatedFileSharing\Notifications') + ->disableOriginalConstructor()->getMock(); + $this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler') + ->disableOriginalConstructor()->getMock(); + $this->userManager = $this->getMock('OCP\IUserManager'); + $this->registerHttpHelper($httpHelperMock); - $this->s2s = new \OCA\Files_Sharing\API\Server2Server($this->federatedShareProvider); + $this->s2s = new RequestHandler( + $this->federatedShareProvider, + \OC::$server->getDatabaseConnection(), + \OC::$server->getShareManager(), + \OC::$server->getRequest(), + $this->notifications, + $this->addressHandler, + $this->userManager + ); $this->connection = \OC::$server->getDatabaseConnection(); } @@ -78,6 +115,9 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase { $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external`'); $query->execute(); + $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`'); + $query->execute(); + $this->restoreHttpHelper(); parent::tearDown(); @@ -135,28 +175,34 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase { function testDeclineShare() { - $dummy = \OCP\DB::prepare(' - INSERT INTO `*PREFIX*share` - (`share_type`, `uid_owner`, `item_type`, `item_source`, `item_target`, `file_source`, `file_target`, `permissions`, `stime`, `token`, `share_with`) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - '); - $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token', 'foo@bar')); - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); - $result = $verify->execute(); - $data = $result->fetchAll(); - $this->assertSame(1, count($data)); + $this->s2s = $this->getMockBuilder('\OCA\FederatedFileSharing\RequestHandler') + ->setConstructorArgs( + [ + $this->federatedShareProvider, + \OC::$server->getDatabaseConnection(), + \OC::$server->getShareManager(), + \OC::$server->getRequest(), + $this->notifications, + $this->addressHandler, + $this->userManager + ] + )->setMethods(['executeDeclineShare', 'verifyShare'])->getMock(); + + $this->s2s->expects($this->once())->method('executeDeclineShare'); + + $this->s2s->expects($this->any())->method('verifyShare')->willReturn(true); $_POST['token'] = 'token'; - $this->s2s->declineShare(array('id' => $data[0]['id'])); - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); - $result = $verify->execute(); - $data = $result->fetchAll(); - $this->assertEmpty($data); + $this->s2s->declineShare(array('id' => 42)); + } - function testDeclineShareMultiple() { + function XtestDeclineShareMultiple() { + + $this->share->expects($this->any())->method('verifyShare')->willReturn(true); + $dummy = \OCP\DB::prepare(' INSERT INTO `*PREFIX*share` (`share_type`, `uid_owner`, `item_type`, `item_source`, `item_target`, `file_source`, `file_target`, `permissions`, `stime`, `token`, `share_with`) @@ -194,14 +240,14 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase { function testDeleteUser($toDelete, $expected, $remainingUsers) { $this->createDummyS2SShares(); - $discoveryManager = new \OCA\FederatedFileSharing\DiscoveryManager( + $discoveryManager = new DiscoveryManager( \OC::$server->getMemCacheFactory(), \OC::$server->getHTTPClientService() ); - $manager = new OCA\Files_Sharing\External\Manager( + $manager = new \OCA\Files_Sharing\External\Manager( \OC::$server->getDatabaseConnection(), - \OC\Files\Filesystem::getMountManager(), - \OC\Files\Filesystem::getLoader(), + Filesystem::getMountManager(), + Filesystem::getLoader(), \OC::$server->getHTTPHelper(), \OC::$server->getNotificationManager(), $discoveryManager, @@ -260,4 +306,76 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase { $this->assertSame(10, count($dummyEntries)); } + /** + * @dataProvider dataTestGetShare + * + * @param bool $found + * @param bool $correctId + * @param bool $correctToken + */ + public function testGetShare($found, $correctId, $correctToken) { + + $connection = \OC::$server->getDatabaseConnection(); + $query = $connection->getQueryBuilder(); + $stime = time(); + $query->insert('share') + ->values( + [ + 'share_type' => $query->createNamedParameter(FederatedShareProvider::SHARE_TYPE_REMOTE), + 'uid_owner' => $query->createNamedParameter(self::TEST_FILES_SHARING_API_USER1), + 'uid_initiator' => $query->createNamedParameter(self::TEST_FILES_SHARING_API_USER2), + 'item_type' => $query->createNamedParameter('test'), + 'item_source' => $query->createNamedParameter('1'), + 'item_target' => $query->createNamedParameter('/1'), + 'file_source' => $query->createNamedParameter('1'), + 'file_target' => $query->createNamedParameter('/test.txt'), + 'permissions' => $query->createNamedParameter('1'), + 'stime' => $query->createNamedParameter($stime), + 'token' => $query->createNamedParameter('token'), + 'share_with' => $query->createNamedParameter('foo@bar'), + ] + )->execute(); + $id = $query->getLastInsertId(); + + $expected = [ + 'share_type' => (string)FederatedShareProvider::SHARE_TYPE_REMOTE, + 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, + 'item_type' => 'test', + 'item_source' => '1', + 'item_target' => '/1', + 'file_source' => '1', + 'file_target' => '/test.txt', + 'permissions' => '1', + 'stime' => (string)$stime, + 'token' => 'token', + 'share_with' => 'foo@bar', + 'id' => (string)$id, + 'uid_initiator' => self::TEST_FILES_SHARING_API_USER2, + 'parent' => null, + 'accepted' => '0', + 'expiration' => null, + 'mail_send' => '0' + ]; + + $searchToken = $correctToken ? 'token' : 'wrongToken'; + $searchId = $correctId ? $id : -1; + + $result = $this->invokePrivate($this->s2s, 'getShare', [$searchId, $searchToken]); + + if ($found) { + $this->assertEquals($expected, $result); + } else { + $this->assertSame(false, $result); + } + } + + public function dataTestGetShare() { + return [ + [true, true, true], + [false, false, true], + [false, true, false], + [false, false, false], + ]; + } + } diff --git a/apps/federatedfilesharing/tests/TestCase.php b/apps/federatedfilesharing/tests/TestCase.php new file mode 100644 index 00000000000..64c6d045598 --- /dev/null +++ b/apps/federatedfilesharing/tests/TestCase.php @@ -0,0 +1,132 @@ +<?php +/** + * @author Björn Schießle <schiessle@owncloud.com> + * @author Joas Schilling <nickvergessen@owncloud.com> + * @author Jörn Friedrich Dreyer <jfd@butonic.de> + * @author Lukas Reschke <lukas@owncloud.com> + * @author Morris Jobke <hey@morrisjobke.de> + * @author Robin Appelman <icewind@owncloud.com> + * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roeland Jago Douma <rullzer@owncloud.com> + * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Vincent Petry <pvince81@owncloud.com> + * + * @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 <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\FederatedFileSharing\Tests; + +use OC\Files\Filesystem; +use OCA\Files\Share; + +/** + * Class Test_Files_Sharing_Base + * + * @group DB + * + * Base class for sharing tests. + */ +abstract class TestCase extends \Test\TestCase { + + const TEST_FILES_SHARING_API_USER1 = "test-share-user1"; + const TEST_FILES_SHARING_API_USER2 = "test-share-user2"; + + public static function setUpBeforeClass() { + parent::setUpBeforeClass(); + + // reset backend + \OC_User::clearBackends(); + \OC_Group::clearBackends(); + + // create users + $backend = new \Test\Util\User\Dummy(); + \OC_User::useBackend($backend); + $backend->createUser(self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER1); + $backend->createUser(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER2); + } + + protected function setUp() { + parent::setUp(); + + //login as user1 + self::loginHelper(self::TEST_FILES_SHARING_API_USER1); + } + + public static function tearDownAfterClass() { + // cleanup users + $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER1); + if ($user !== null) { + $user->delete(); + } + $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER2); + if ($user !== null) { + $user->delete(); + } + + \OC_Util::tearDownFS(); + \OC_User::setUserId(''); + Filesystem::tearDown(); + + // reset backend + \OC_User::clearBackends(); + \OC_User::useBackend('database'); + \OC_Group::clearBackends(); + \OC_Group::useBackend(new \OC_Group_Database()); + + parent::tearDownAfterClass(); + } + + /** + * @param string $user + * @param bool $create + * @param bool $password + */ + protected static function loginHelper($user, $create = false, $password = false) { + + if ($password === false) { + $password = $user; + } + + if ($create) { + \OC::$server->getUserManager()->createUser($user, $password); + \OC_Group::createGroup('group'); + \OC_Group::addToGroup($user, 'group'); + } + + self::resetStorage(); + + \OC_Util::tearDownFS(); + \OC::$server->getUserSession()->setUser(null); + \OC\Files\Filesystem::tearDown(); + \OC::$server->getUserSession()->login($user, $password); + \OC::$server->getUserFolder($user); + + \OC_Util::setupFS($user); + } + + /** + * reset init status for the share storage + */ + protected static function resetStorage() { + $storage = new \ReflectionClass('\OC\Files\Storage\Shared'); + $isInitialized = $storage->getProperty('initialized'); + $isInitialized->setAccessible(true); + $isInitialized->setValue($storage, false); + $isInitialized->setAccessible(false); + } + +} diff --git a/apps/federatedfilesharing/tests/TokenHandlerTest.php b/apps/federatedfilesharing/tests/TokenHandlerTest.php index 490c0d95d7b..004a3a61933 100644 --- a/apps/federatedfilesharing/tests/TokenHandlerTest.php +++ b/apps/federatedfilesharing/tests/TokenHandlerTest.php @@ -26,9 +26,8 @@ namespace OCA\FederatedFileSharing\Tests; use OCA\FederatedFileSharing\TokenHandler; use OCP\Security\ISecureRandom; -use Test\TestCase; -class TokenHandlerTest extends TestCase { +class TokenHandlerTest extends \Test\TestCase { /** @var TokenHandler */ private $tokenHandler; diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 3b70e283749..8542bd50476 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -385,6 +385,7 @@ var dragOptions={ cursorAt: { left: 24, top: 18 }, helper: createDragShadow, cursor: 'move', + start: function(event, ui){ var $selectedFiles = $('td.filename input:checkbox:checked'); if (!$selectedFiles.length) { @@ -398,6 +399,26 @@ var dragOptions={ $selectedFiles = $(this); } $selectedFiles.closest('tr').fadeTo(250, 1).removeClass('dragging'); + }, + drag: function(event, ui) { + var scrollingArea = FileList.$container; + var currentScrollTop = $(scrollingArea).scrollTop(); + var scrollArea = Math.min(Math.floor($(window).innerHeight() / 2), 100); + + var bottom = $(window).innerHeight() - scrollArea; + var top = $(window).scrollTop() + scrollArea; + if (event.pageY < top) { + $('html, body').animate({ + + scrollTop: $(scrollingArea).scrollTop(currentScrollTop - 10) + }, 400); + + } else if (event.pageY > bottom) { + $('html, body').animate({ + scrollTop: $(scrollingArea).scrollTop(currentScrollTop + 10) + }, 400); + } + } }; // sane browsers support using the distance option diff --git a/apps/files/l10n/cs_CZ.js b/apps/files/l10n/cs_CZ.js index cf3190c6ca2..3299e21d293 100644 --- a/apps/files/l10n/cs_CZ.js +++ b/apps/files/l10n/cs_CZ.js @@ -15,7 +15,7 @@ OC.L10N.register( "Missing a temporary folder" : "Chybí adresář pro dočasné soubory", "Failed to write to disk" : "Zápis na disk selhal", "Not enough storage available" : "Nedostatek dostupného úložného prostoru", - "The target folder has been moved or deleted." : "Cílová složka byla přesunuta nebo smazána.", + "The target folder has been moved or deleted." : "Cílový adresář byl přesunuta nebo smazán.", "Upload failed. Could not find uploaded file" : "Nahrávání selhalo. Nepodařilo se nalézt nahraný soubor.", "Upload failed. Could not get file info." : "Nahrávání selhalo. Nepodařilo se získat informace o souboru.", "Invalid directory." : "Neplatný adresář", @@ -32,6 +32,15 @@ OC.L10N.register( "Could not get result from server." : "Nepodařilo se získat výsledek ze serveru.", "Uploading..." : "Odesílám...", "..." : "...", + "{hours}:{minutes}:{seconds} hour{plural_s} left" : "zbývá {hours}:{minutes}:{seconds} hour{plural_s}", + "{hours}:{minutes}h" : "{hours}:{minutes}h", + "{minutes}:{seconds} minute{plural_s} left" : "zbývá {minutes}:{seconds} minute{plural_s}", + "{minutes}:{seconds}m" : "{minutes}:{seconds}m", + "{seconds} second{plural_s} left" : "{seconds} sekund{plural_s} zbývá", + "{seconds}s" : "{seconds}s", + "Any moment now..." : "Každou chvíli...", + "Soon..." : "Brzy...", + "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} z {totalSize} ({bitrate})", "File upload is in progress. Leaving the page now will cancel the upload." : "Probíhá odesílání souboru. Opuštění stránky způsobí zrušení nahrávání.", "Actions" : "Činnosti", "Download" : "Stáhnout", @@ -60,7 +69,7 @@ OC.L10N.register( "Name" : "Název", "Size" : "Velikost", "Modified" : "Upraveno", - "_%n folder_::_%n folders_" : ["%n složka","%n složky","%n složek"], + "_%n folder_::_%n folders_" : ["%n adresář","%n adresáře","%n adresářů"], "_%n file_::_%n files_" : ["%n soubor","%n soubory","%n souborů"], "{dirs} and {files}" : "{dirs} a {files}", "You don’t have permission to upload or create files here" : "Nemáte oprávnění sem nahrávat nebo vytvářet soubory", @@ -78,16 +87,16 @@ OC.L10N.register( "Favorited" : "Přidáno k oblíbeným", "Favorite" : "Oblíbené", "Local link" : "Místní odkaz", - "Folder" : "Složka", - "New folder" : "Nová složka", + "Folder" : "Adresář", + "New folder" : "Nový adresář", "{newname} already exists" : "{newname} již existuje", "Upload" : "Odeslat", "An error occurred while trying to update the tags" : "Při pokusu o úpravu tagů nastala chyba", - "A new file or folder has been <strong>created</strong>" : "Byl <strong>vytvořen</strong> nový soubor nebo složka", - "A file or folder has been <strong>changed</strong>" : "Soubor nebo složka byla <strong>změněna</strong>", + "A new file or folder has been <strong>created</strong>" : "Byl <strong>vytvořen</strong> nový soubor nebo adresář", + "A file or folder has been <strong>changed</strong>" : "Soubor nebo adresář byl <strong>změněn</strong>", "Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>" : "Limit oznámení o tvorbě a změnách vašich <strong>oblíbených souborů</strong> <em>(Pouze streamovat)</em>", - "A file or folder has been <strong>deleted</strong>" : "Soubor nebo složka byla <strong>smazána</strong>", - "A file or folder has been <strong>restored</strong>" : "Soubor nebo složka byla <strong>obnovena</strong>", + "A file or folder has been <strong>deleted</strong>" : "Soubor nebo adresář byl <strong>smazán</strong>", + "A file or folder has been <strong>restored</strong>" : "Soubor nebo adresář byla <strong>obnoven</strong>", "You created %1$s" : "Vytvořili jste %1$s", "%2$s created %1$s" : "%2$s vytvořil(a) %1$s", "%1$s was created in a public folder" : "%1$s byl vytvořen ve veřejném adresáři", @@ -113,7 +122,7 @@ OC.L10N.register( "Use this address to <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">access your Files via WebDAV</a>" : "Použijte tuto adresu pro <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">přístup ke svým Souborům přes WebDAV</a>", "No files in here" : "Žádné soubory", "Upload some content or sync with your devices!" : "Nahrajte nějaký obsah nebo synchronizujte se svými přístroji!", - "No entries found in this folder" : "V této složce nebylo nic nalezeno", + "No entries found in this folder" : "V tomto adresáři nebylo nic nalezeno", "Select all" : "Vybrat vše", "Upload too large" : "Odesílaný soubor je příliš velký", "The files you are trying to upload exceed the maximum size for file uploads on this server." : "Soubory, které se snažíte odeslat, překračují limit velikosti odesílání na tomto serveru.", diff --git a/apps/files/l10n/cs_CZ.json b/apps/files/l10n/cs_CZ.json index e8890dc8c12..5e138e22596 100644 --- a/apps/files/l10n/cs_CZ.json +++ b/apps/files/l10n/cs_CZ.json @@ -13,7 +13,7 @@ "Missing a temporary folder" : "Chybí adresář pro dočasné soubory", "Failed to write to disk" : "Zápis na disk selhal", "Not enough storage available" : "Nedostatek dostupného úložného prostoru", - "The target folder has been moved or deleted." : "Cílová složka byla přesunuta nebo smazána.", + "The target folder has been moved or deleted." : "Cílový adresář byl přesunuta nebo smazán.", "Upload failed. Could not find uploaded file" : "Nahrávání selhalo. Nepodařilo se nalézt nahraný soubor.", "Upload failed. Could not get file info." : "Nahrávání selhalo. Nepodařilo se získat informace o souboru.", "Invalid directory." : "Neplatný adresář", @@ -30,6 +30,15 @@ "Could not get result from server." : "Nepodařilo se získat výsledek ze serveru.", "Uploading..." : "Odesílám...", "..." : "...", + "{hours}:{minutes}:{seconds} hour{plural_s} left" : "zbývá {hours}:{minutes}:{seconds} hour{plural_s}", + "{hours}:{minutes}h" : "{hours}:{minutes}h", + "{minutes}:{seconds} minute{plural_s} left" : "zbývá {minutes}:{seconds} minute{plural_s}", + "{minutes}:{seconds}m" : "{minutes}:{seconds}m", + "{seconds} second{plural_s} left" : "{seconds} sekund{plural_s} zbývá", + "{seconds}s" : "{seconds}s", + "Any moment now..." : "Každou chvíli...", + "Soon..." : "Brzy...", + "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} z {totalSize} ({bitrate})", "File upload is in progress. Leaving the page now will cancel the upload." : "Probíhá odesílání souboru. Opuštění stránky způsobí zrušení nahrávání.", "Actions" : "Činnosti", "Download" : "Stáhnout", @@ -58,7 +67,7 @@ "Name" : "Název", "Size" : "Velikost", "Modified" : "Upraveno", - "_%n folder_::_%n folders_" : ["%n složka","%n složky","%n složek"], + "_%n folder_::_%n folders_" : ["%n adresář","%n adresáře","%n adresářů"], "_%n file_::_%n files_" : ["%n soubor","%n soubory","%n souborů"], "{dirs} and {files}" : "{dirs} a {files}", "You don’t have permission to upload or create files here" : "Nemáte oprávnění sem nahrávat nebo vytvářet soubory", @@ -76,16 +85,16 @@ "Favorited" : "Přidáno k oblíbeným", "Favorite" : "Oblíbené", "Local link" : "Místní odkaz", - "Folder" : "Složka", - "New folder" : "Nová složka", + "Folder" : "Adresář", + "New folder" : "Nový adresář", "{newname} already exists" : "{newname} již existuje", "Upload" : "Odeslat", "An error occurred while trying to update the tags" : "Při pokusu o úpravu tagů nastala chyba", - "A new file or folder has been <strong>created</strong>" : "Byl <strong>vytvořen</strong> nový soubor nebo složka", - "A file or folder has been <strong>changed</strong>" : "Soubor nebo složka byla <strong>změněna</strong>", + "A new file or folder has been <strong>created</strong>" : "Byl <strong>vytvořen</strong> nový soubor nebo adresář", + "A file or folder has been <strong>changed</strong>" : "Soubor nebo adresář byl <strong>změněn</strong>", "Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>" : "Limit oznámení o tvorbě a změnách vašich <strong>oblíbených souborů</strong> <em>(Pouze streamovat)</em>", - "A file or folder has been <strong>deleted</strong>" : "Soubor nebo složka byla <strong>smazána</strong>", - "A file or folder has been <strong>restored</strong>" : "Soubor nebo složka byla <strong>obnovena</strong>", + "A file or folder has been <strong>deleted</strong>" : "Soubor nebo adresář byl <strong>smazán</strong>", + "A file or folder has been <strong>restored</strong>" : "Soubor nebo adresář byla <strong>obnoven</strong>", "You created %1$s" : "Vytvořili jste %1$s", "%2$s created %1$s" : "%2$s vytvořil(a) %1$s", "%1$s was created in a public folder" : "%1$s byl vytvořen ve veřejném adresáři", @@ -111,7 +120,7 @@ "Use this address to <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">access your Files via WebDAV</a>" : "Použijte tuto adresu pro <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">přístup ke svým Souborům přes WebDAV</a>", "No files in here" : "Žádné soubory", "Upload some content or sync with your devices!" : "Nahrajte nějaký obsah nebo synchronizujte se svými přístroji!", - "No entries found in this folder" : "V této složce nebylo nic nalezeno", + "No entries found in this folder" : "V tomto adresáři nebylo nic nalezeno", "Select all" : "Vybrat vše", "Upload too large" : "Odesílaný soubor je příliš velký", "The files you are trying to upload exceed the maximum size for file uploads on this server." : "Soubory, které se snažíte odeslat, překračují limit velikosti odesílání na tomto serveru.", diff --git a/apps/files/l10n/es.js b/apps/files/l10n/es.js index 433945d7c60..ca13a127ad7 100644 --- a/apps/files/l10n/es.js +++ b/apps/files/l10n/es.js @@ -32,10 +32,15 @@ OC.L10N.register( "Could not get result from server." : "No se pudo obtener respuesta del servidor.", "Uploading..." : "Subiendo...", "..." : "...", + "{hours}:{minutes}:{seconds} hour{plural_s} left" : "{hours}:{minutes}:{seconds} hora{plural_s} pendiente", "{hours}:{minutes}h" : "{hours}:{minutes}h", + "{minutes}:{seconds} minute{plural_s} left" : "{minutes}:{seconds} minuto{plural_s} pendiente", + "{minutes}:{seconds}m" : "{minutes}:{seconds}m", + "{seconds} second{plural_s} left" : "{seconds} segundo{plural_s} pendiente", "{seconds}s" : "{seconds}s", "Any moment now..." : "En cualquier momento...", "Soon..." : "Dentro de poco...", + "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} de {totalSize} ({bitrate})", "File upload is in progress. Leaving the page now will cancel the upload." : "La subida del archivo está en proceso. Si sale de la página ahora, la subida será cancelada.", "Actions" : "Acciones", "Download" : "Descargar", diff --git a/apps/files/l10n/es.json b/apps/files/l10n/es.json index 57a6905a497..fd70a4da0e6 100644 --- a/apps/files/l10n/es.json +++ b/apps/files/l10n/es.json @@ -30,10 +30,15 @@ "Could not get result from server." : "No se pudo obtener respuesta del servidor.", "Uploading..." : "Subiendo...", "..." : "...", + "{hours}:{minutes}:{seconds} hour{plural_s} left" : "{hours}:{minutes}:{seconds} hora{plural_s} pendiente", "{hours}:{minutes}h" : "{hours}:{minutes}h", + "{minutes}:{seconds} minute{plural_s} left" : "{minutes}:{seconds} minuto{plural_s} pendiente", + "{minutes}:{seconds}m" : "{minutes}:{seconds}m", + "{seconds} second{plural_s} left" : "{seconds} segundo{plural_s} pendiente", "{seconds}s" : "{seconds}s", "Any moment now..." : "En cualquier momento...", "Soon..." : "Dentro de poco...", + "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} de {totalSize} ({bitrate})", "File upload is in progress. Leaving the page now will cancel the upload." : "La subida del archivo está en proceso. Si sale de la página ahora, la subida será cancelada.", "Actions" : "Acciones", "Download" : "Descargar", diff --git a/apps/files/l10n/ja.js b/apps/files/l10n/ja.js index ff3b14dc2b4..e093a46c8aa 100644 --- a/apps/files/l10n/ja.js +++ b/apps/files/l10n/ja.js @@ -77,6 +77,7 @@ OC.L10N.register( "_%n byte_::_%n bytes_" : ["%n バイト"], "Favorited" : "お気に入り済", "Favorite" : "お気に入り", + "Local link" : "ローカルリンク", "Folder" : "フォルダー", "New folder" : "新しいフォルダー", "{newname} already exists" : "{newname} はすでに存在します", diff --git a/apps/files/l10n/ja.json b/apps/files/l10n/ja.json index 2719e9d50a5..0995d3b1e81 100644 --- a/apps/files/l10n/ja.json +++ b/apps/files/l10n/ja.json @@ -75,6 +75,7 @@ "_%n byte_::_%n bytes_" : ["%n バイト"], "Favorited" : "お気に入り済", "Favorite" : "お気に入り", + "Local link" : "ローカルリンク", "Folder" : "フォルダー", "New folder" : "新しいフォルダー", "{newname} already exists" : "{newname} はすでに存在します", diff --git a/apps/files/lib/Command/Scan.php b/apps/files/lib/Command/Scan.php index 1ae04c585bb..cf4f8f1745d 100644 --- a/apps/files/lib/Command/Scan.php +++ b/apps/files/lib/Command/Scan.php @@ -86,6 +86,11 @@ class Scan extends Base { null, InputOption::VALUE_NONE, 'will rescan all files of all known users' + )->addOption( + 'unscanned', + null, + InputOption::VALUE_NONE, + 'only scan files which are marked as not fully scanned' ); } @@ -98,7 +103,7 @@ class Scan extends Base { } } - protected function scanFiles($user, $path, $verbose, OutputInterface $output) { + protected function scanFiles($user, $path, $verbose, OutputInterface $output, $backgroundScan = false) { $scanner = new \OC\Files\Utils\Scanner($user, \OC::$server->getDatabaseConnection(), \OC::$server->getLogger()); # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception # printout and count @@ -143,7 +148,11 @@ class Scan extends Base { }); try { - $scanner->scan($path); + if ($backgroundScan) { + $scanner->backgroundScan($path); + }else { + $scanner->scan($path); + } } catch (ForbiddenException $e) { $output->writeln("<error>Home storage for user $user not writable</error>"); $output->writeln("Make sure you're running the scan command only as the user the web server runs as"); @@ -210,7 +219,7 @@ class Scan extends Base { if ($verbose) {$output->writeln(""); } $output->writeln("Starting scan for user $user_count out of $users_total ($user)"); # full: printout data if $verbose was set - $this->scanFiles($user, $path, $verbose, $output); + $this->scanFiles($user, $path, $verbose, $output, $input->getOption('unscanned')); } else { $output->writeln("<error>Unknown user $user_count $user</error>"); } diff --git a/apps/files_external/appinfo/application.php b/apps/files_external/appinfo/application.php index cdc58aed7e8..5d490c6091f 100644 --- a/apps/files_external/appinfo/application.php +++ b/apps/files_external/appinfo/application.php @@ -30,20 +30,26 @@ use \OCP\AppFramework\App; use OCP\AppFramework\IAppContainer; use \OCP\IContainer; use \OCA\Files_External\Service\BackendService; +use \OCA\Files_External\Lib\Config\IBackendProvider; +use \OCA\Files_External\Lib\Config\IAuthMechanismProvider; /** * @package OCA\Files_External\Appinfo */ -class Application extends App { +class Application extends App implements IBackendProvider, IAuthMechanismProvider { + public function __construct(array $urlParams = array()) { parent::__construct('files_external', $urlParams); - $this->getContainer()->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { + $container = $this->getContainer(); + + $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { return $c->getServer()->query('UserMountCache'); }); - $this->loadBackends(); - $this->loadAuthMechanisms(); + $backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); + $backendService->registerBackendProvider($this); + $backendService->registerAuthMechanismProvider($this); // app developers: do NOT depend on this! it will disappear with oC 9.0! \OC::$server->getEventDispatcher()->dispatch( @@ -63,13 +69,12 @@ class Application extends App { } /** - * Load storage backends provided by this app + * @{inheritdoc} */ - protected function loadBackends() { + public function getBackends() { $container = $this->getContainer(); - $service = $container->query('OCA\\Files_External\\Service\\BackendService'); - $service->registerBackends([ + $backends = [ $container->query('OCA\Files_External\Lib\Backend\Local'), $container->query('OCA\Files_External\Lib\Backend\FTP'), $container->query('OCA\Files_External\Lib\Backend\DAV'), @@ -80,24 +85,25 @@ class Application extends App { $container->query('OCA\Files_External\Lib\Backend\Google'), $container->query('OCA\Files_External\Lib\Backend\Swift'), $container->query('OCA\Files_External\Lib\Backend\SFTP_Key'), - ]); + ]; if (!\OC_Util::runningOnWindows()) { - $service->registerBackends([ + $backends += [ $container->query('OCA\Files_External\Lib\Backend\SMB'), $container->query('OCA\Files_External\Lib\Backend\SMB_OC'), - ]); + ]; } + + return $backends; } /** - * Load authentication mechanisms provided by this app + * @{inheritdoc} */ - protected function loadAuthMechanisms() { + public function getAuthMechanisms() { $container = $this->getContainer(); - $service = $container->query('OCA\\Files_External\\Service\\BackendService'); - $service->registerAuthMechanisms([ + return [ // AuthMechanism::SCHEME_NULL mechanism $container->query('OCA\Files_External\Lib\Auth\NullMechanism'), @@ -123,7 +129,7 @@ class Application extends App { // Specialized mechanisms $container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'), - ]); + ]; } } diff --git a/apps/files_external/l10n/cs_CZ.js b/apps/files_external/l10n/cs_CZ.js index c2d99356eb6..fdbddce7e53 100644 --- a/apps/files_external/l10n/cs_CZ.js +++ b/apps/files_external/l10n/cs_CZ.js @@ -19,6 +19,8 @@ OC.L10N.register( "Insufficient data: %s" : "Nedostatečná data: %s", "%s" : "%s", "Storage with id \"%i\" is not user editable" : "Úložiště s id \"%i\" uživatelé nemohou upravovat", + "Dropbox App Configuration" : "Nastavení aplikace Dropbox", + "Google Drive App Configuration" : "Nastavení aplikace Disk Google", "Personal" : "Osobní", "System" : "Systém", "Grant access" : "Povolit přístup", @@ -111,7 +113,7 @@ OC.L10N.register( "Never" : "Nikdy", "Once every direct access" : "Jednou pro každý přímý přístup", "External Storage" : "Externí úložiště", - "Folder name" : "Název složky", + "Folder name" : "Název adresáře", "Authentication" : "Ověření", "Configuration" : "Nastavení", "Available for" : "Dostupné pro", diff --git a/apps/files_external/l10n/cs_CZ.json b/apps/files_external/l10n/cs_CZ.json index 71704dccae8..b485584ea6d 100644 --- a/apps/files_external/l10n/cs_CZ.json +++ b/apps/files_external/l10n/cs_CZ.json @@ -17,6 +17,8 @@ "Insufficient data: %s" : "Nedostatečná data: %s", "%s" : "%s", "Storage with id \"%i\" is not user editable" : "Úložiště s id \"%i\" uživatelé nemohou upravovat", + "Dropbox App Configuration" : "Nastavení aplikace Dropbox", + "Google Drive App Configuration" : "Nastavení aplikace Disk Google", "Personal" : "Osobní", "System" : "Systém", "Grant access" : "Povolit přístup", @@ -109,7 +111,7 @@ "Never" : "Nikdy", "Once every direct access" : "Jednou pro každý přímý přístup", "External Storage" : "Externí úložiště", - "Folder name" : "Název složky", + "Folder name" : "Název adresáře", "Authentication" : "Ověření", "Configuration" : "Nastavení", "Available for" : "Dostupné pro", diff --git a/apps/files_external/l10n/sl.js b/apps/files_external/l10n/sl.js index 5b58901b372..544ebf6f1ea 100644 --- a/apps/files_external/l10n/sl.js +++ b/apps/files_external/l10n/sl.js @@ -19,6 +19,7 @@ OC.L10N.register( "Insufficient data: %s" : "Nepopolni podatki: %s", "%s" : "%s", "Storage with id \"%i\" is not user editable" : "Shramba z ID \"%i\" ni uporabniško uredljiva.", + "Dropbox App Configuration" : "Nastavitve programa Dropbox", "Google Drive App Configuration" : "Nastavitve programa Google Drive", "Personal" : "Osebno", "System" : "Sistem", diff --git a/apps/files_external/l10n/sl.json b/apps/files_external/l10n/sl.json index 2bf8565b7e2..864817b4b17 100644 --- a/apps/files_external/l10n/sl.json +++ b/apps/files_external/l10n/sl.json @@ -17,6 +17,7 @@ "Insufficient data: %s" : "Nepopolni podatki: %s", "%s" : "%s", "Storage with id \"%i\" is not user editable" : "Shramba z ID \"%i\" ni uporabniško uredljiva.", + "Dropbox App Configuration" : "Nastavitve programa Dropbox", "Google Drive App Configuration" : "Nastavitve programa Google Drive", "Personal" : "Osebno", "System" : "Sistem", diff --git a/apps/files_external/lib/config/iauthmechanismprovider.php b/apps/files_external/lib/config/iauthmechanismprovider.php new file mode 100644 index 00000000000..035b8e891f5 --- /dev/null +++ b/apps/files_external/lib/config/iauthmechanismprovider.php @@ -0,0 +1,38 @@ +<?php +/** + * @author Robin McCorkell <robin@mccorkell.me.uk> + * + * @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 <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\Files_External\Lib\Config; + +use \OCA\Files_External\Lib\Auth\AuthMechanism; + +/** + * Provider of external storage auth mechanisms + * @since 9.1.0 + */ +interface IAuthMechanismProvider { + + /** + * @since 9.1.0 + * @return AuthMechanism[] + */ + public function getAuthMechanisms(); + +} diff --git a/apps/files_external/lib/config/ibackendprovider.php b/apps/files_external/lib/config/ibackendprovider.php new file mode 100644 index 00000000000..2335e7133a6 --- /dev/null +++ b/apps/files_external/lib/config/ibackendprovider.php @@ -0,0 +1,38 @@ +<?php +/** + * @author Robin McCorkell <robin@mccorkell.me.uk> + * + * @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 <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\Files_External\Lib\Config; + +use \OCA\Files_External\Lib\Backend\Backend; + +/** + * Provider of external storage backends + * @since 9.1.0 + */ +interface IBackendProvider { + + /** + * @since 9.1.0 + * @return Backend[] + */ + public function getBackends(); + +} diff --git a/apps/files_external/service/backendservice.php b/apps/files_external/service/backendservice.php index 9b23a441c7c..c3dc4da0177 100644 --- a/apps/files_external/service/backendservice.php +++ b/apps/files_external/service/backendservice.php @@ -26,6 +26,8 @@ use \OCP\IConfig; use \OCA\Files_External\Lib\Backend\Backend; use \OCA\Files_External\Lib\Auth\AuthMechanism; +use \OCA\Files_External\Lib\Config\IBackendProvider; +use \OCA\Files_External\Lib\Config\IAuthMechanismProvider; /** * Service class to manage backend definitions @@ -55,9 +57,15 @@ class BackendService { /** @var Backend[] */ private $backends = []; + /** @var IBackendProvider[] */ + private $backendProviders = []; + /** @var AuthMechanism[] */ private $authMechanisms = []; + /** @var IAuthMechanismProvider[] */ + private $authMechanismProviders = []; + /** * @param IConfig $config */ @@ -81,8 +89,43 @@ class BackendService { } /** + * Register a backend provider + * + * @since 9.1.0 + * @param IBackendProvider $provider + */ + public function registerBackendProvider(IBackendProvider $provider) { + $this->backendProviders[] = $provider; + } + + private function loadBackendProviders() { + foreach ($this->backendProviders as $provider) { + $this->registerBackends($provider->getBackends()); + } + $this->backendProviders = []; + } + + /** + * Register an auth mechanism provider + * + * @since 9.1.0 + * @param IAuthMechanismProvider $provider + */ + public function registerAuthMechanismProvider(IAuthMechanismProvider $provider) { + $this->authMechanismProviders[] = $provider; + } + + private function loadAuthMechanismProviders() { + foreach ($this->authMechanismProviders as $provider) { + $this->registerAuthMechanisms($provider->getAuthMechanisms()); + } + $this->authMechanismProviders = []; + } + + /** * Register a backend * + * @deprecated 9.1.0 use registerBackendProvider() * @param Backend $backend */ public function registerBackend(Backend $backend) { @@ -95,6 +138,7 @@ class BackendService { } /** + * @deprecated 9.1.0 use registerBackendProvider() * @param Backend[] $backends */ public function registerBackends(array $backends) { @@ -105,6 +149,7 @@ class BackendService { /** * Register an authentication mechanism * + * @deprecated 9.1.0 use registerAuthMechanismProvider() * @param AuthMechanism $authMech */ public function registerAuthMechanism(AuthMechanism $authMech) { @@ -117,6 +162,7 @@ class BackendService { } /** + * @deprecated 9.1.0 use registerAuthMechanismProvider() * @param AuthMechanism[] $mechanisms */ public function registerAuthMechanisms(array $mechanisms) { @@ -131,6 +177,7 @@ class BackendService { * @return Backend[] */ public function getBackends() { + $this->loadBackendProviders(); // only return real identifiers, no aliases $backends = []; foreach ($this->backends as $backend) { @@ -155,6 +202,7 @@ class BackendService { * @return Backend|null */ public function getBackend($identifier) { + $this->loadBackendProviders(); if (isset($this->backends[$identifier])) { return $this->backends[$identifier]; } @@ -167,6 +215,7 @@ class BackendService { * @return AuthMechanism[] */ public function getAuthMechanisms() { + $this->loadAuthMechanismProviders(); // only return real identifiers, no aliases $mechanisms = []; foreach ($this->authMechanisms as $mechanism) { @@ -192,6 +241,7 @@ class BackendService { * @return AuthMechanism|null */ public function getAuthMechanism($identifier) { + $this->loadAuthMechanismProviders(); if (isset($this->authMechanisms[$identifier])) { return $this->authMechanisms[$identifier]; } diff --git a/apps/files_external/tests/service/backendservicetest.php b/apps/files_external/tests/service/backendservicetest.php index 8621c98b9b7..ba9a1f533f2 100644 --- a/apps/files_external/tests/service/backendservicetest.php +++ b/apps/files_external/tests/service/backendservicetest.php @@ -49,6 +49,20 @@ class BackendServiceTest extends \Test\TestCase { return $backend; } + /** + * @param string $class + * + * @return \OCA\Files_External\Lib\Auth\AuthMechanism + */ + protected function getAuthMechanismMock($class) { + $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism') + ->disableOriginalConstructor() + ->getMock(); + $backend->method('getIdentifier')->will($this->returnValue('identifier:'.$class)); + $backend->method('getIdentifierAliases')->will($this->returnValue(['identifier:'.$class])); + return $backend; + } + public function testRegisterBackend() { $service = new BackendService($this->config, $this->l10n); @@ -76,6 +90,68 @@ class BackendServiceTest extends \Test\TestCase { $this->assertArrayNotHasKey('identifier_alias', $backends); } + public function testBackendProvider() { + $service = new BackendService($this->config, $this->l10n); + + $backend1 = $this->getBackendMock('\Foo\Bar'); + $backend2 = $this->getBackendMock('\Bar\Foo'); + + $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider'); + $providerMock->expects($this->once()) + ->method('getBackends') + ->willReturn([$backend1, $backend2]); + $service->registerBackendProvider($providerMock); + + $this->assertEquals($backend1, $service->getBackend('identifier:\Foo\Bar')); + $this->assertEquals($backend2, $service->getBackend('identifier:\Bar\Foo')); + + $this->assertCount(2, $service->getBackends()); + } + + public function testAuthMechanismProvider() { + $service = new BackendService($this->config, $this->l10n); + + $backend1 = $this->getAuthMechanismMock('\Foo\Bar'); + $backend2 = $this->getAuthMechanismMock('\Bar\Foo'); + + $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IAuthMechanismProvider'); + $providerMock->expects($this->once()) + ->method('getAuthMechanisms') + ->willReturn([$backend1, $backend2]); + $service->registerAuthMechanismProvider($providerMock); + + $this->assertEquals($backend1, $service->getAuthMechanism('identifier:\Foo\Bar')); + $this->assertEquals($backend2, $service->getAuthMechanism('identifier:\Bar\Foo')); + + $this->assertCount(2, $service->getAuthMechanisms()); + } + + public function testMultipleBackendProviders() { + $service = new BackendService($this->config, $this->l10n); + + $backend1a = $this->getBackendMock('\Foo\Bar'); + $backend1b = $this->getBackendMock('\Bar\Foo'); + + $backend2 = $this->getBackendMock('\Dead\Beef'); + + $provider1Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider'); + $provider1Mock->expects($this->once()) + ->method('getBackends') + ->willReturn([$backend1a, $backend1b]); + $service->registerBackendProvider($provider1Mock); + $provider2Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider'); + $provider2Mock->expects($this->once()) + ->method('getBackends') + ->willReturn([$backend2]); + $service->registerBackendProvider($provider2Mock); + + $this->assertEquals($backend1a, $service->getBackend('identifier:\Foo\Bar')); + $this->assertEquals($backend1b, $service->getBackend('identifier:\Bar\Foo')); + $this->assertEquals($backend2, $service->getBackend('identifier:\Dead\Beef')); + + $this->assertCount(3, $service->getBackends()); + } + public function testUserMountingBackends() { $this->config->expects($this->exactly(2)) ->method('getAppValue') diff --git a/apps/files_sharing/api/server2server.php b/apps/files_sharing/api/server2server.php deleted file mode 100644 index 034ec5105e4..00000000000 --- a/apps/files_sharing/api/server2server.php +++ /dev/null @@ -1,325 +0,0 @@ -<?php -/** - * @author Arthur Schiwon <blizzz@owncloud.com> - * @author Björn Schießle <schiessle@owncloud.com> - * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> - * - * @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 <http://www.gnu.org/licenses/> - * - */ - -namespace OCA\Files_Sharing\API; - -use OCA\FederatedFileSharing\DiscoveryManager; -use OCA\FederatedFileSharing\FederatedShareProvider; -use OCA\Files_Sharing\Activity; -use OCP\Files\NotFoundException; - -class Server2Server { - - /** @var FederatedShareProvider */ - private $federatedShareProvider; - - - /** - * Server2Server constructor. - * - * @param FederatedShareProvider $federatedShareProvider - */ - public function __construct(FederatedShareProvider $federatedShareProvider) { - $this->federatedShareProvider = $federatedShareProvider; - } - - /** - * create a new share - * - * @param array $params - * @return \OC_OCS_Result - */ - public function createShare($params) { - - if (!$this->isS2SEnabled(true)) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $remote = isset($_POST['remote']) ? $_POST['remote'] : null; - $token = isset($_POST['token']) ? $_POST['token'] : null; - $name = isset($_POST['name']) ? $_POST['name'] : null; - $owner = isset($_POST['owner']) ? $_POST['owner'] : null; - $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; - - if ($remote && $token && $name && $owner && $remoteId && $shareWith) { - - if(!\OCP\Util::isValidFileName($name)) { - return new \OC_OCS_Result(null, 400, 'The mountpoint name contains invalid characters.'); - } - - // FIXME this should be a method in the user management instead - \OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG); - \OCP\Util::emitHook( - '\OCA\Files_Sharing\API\Server2Server', - 'preLoginNameUsedAsUserName', - array('uid' => &$shareWith) - ); - \OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG); - - if (!\OCP\User::userExists($shareWith)) { - return new \OC_OCS_Result(null, 400, 'User does not exists'); - } - - \OC_Util::setupFS($shareWith); - - $discoveryManager = new DiscoveryManager( - \OC::$server->getMemCacheFactory(), - \OC::$server->getHTTPClientService() - ); - $externalManager = new \OCA\Files_Sharing\External\Manager( - \OC::$server->getDatabaseConnection(), - \OC\Files\Filesystem::getMountManager(), - \OC\Files\Filesystem::getLoader(), - \OC::$server->getHTTPHelper(), - \OC::$server->getNotificationManager(), - $discoveryManager, - $shareWith - ); - - try { - $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId); - $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); - - $user = $owner . '@' . $this->cleanupRemote($remote); - - \OC::$server->getActivityManager()->publishActivity( - Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user, trim($name, '/')), '', array(), - '', '', $shareWith, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_LOW); - - $urlGenerator = \OC::$server->getURLGenerator(); - - $notificationManager = \OC::$server->getNotificationManager(); - $notification = $notificationManager->createNotification(); - $notification->setApp('files_sharing') - ->setUser($shareWith) - ->setDateTime(new \DateTime()) - ->setObject('remote_share', $shareId) - ->setSubject('remote_share', [$user, trim($name, '/')]); - - $declineAction = $notification->createAction(); - $declineAction->setLabel('decline') - ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); - $notification->addAction($declineAction); - - $acceptAction = $notification->createAction(); - $acceptAction->setLabel('accept') - ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); - $notification->addAction($acceptAction); - - $notificationManager->notify($notification); - - return new \OC_OCS_Result(); - } catch (\Exception $e) { - \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR); - return new \OC_OCS_Result(null, 500, 'internal server error, was not able to add share from ' . $remote); - } - } - - return new \OC_OCS_Result(null, 400, 'server can not add remote share, missing parameter'); - } - - /** - * accept server-to-server share - * - * @param array $params - * @return \OC_OCS_Result - */ - public function acceptShare($params) { - - if (!$this->isS2SEnabled()) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $id = $params['id']; - $token = isset($_POST['token']) ? $_POST['token'] : null; - $share = self::getShare($id, $token); - - if ($share) { - list($file, $link) = self::getFile($share['uid_owner'], $share['file_source']); - - $event = \OC::$server->getActivityManager()->generateEvent(); - $event->setApp(Activity::FILES_SHARING_APP) - ->setType(Activity::TYPE_REMOTE_SHARE) - ->setAffectedUser($share['uid_owner']) - ->setSubject(Activity::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share['share_with'], basename($file)]) - ->setObject('files', $share['file_source'], $file) - ->setLink($link); - \OC::$server->getActivityManager()->publish($event); - } - - return new \OC_OCS_Result(); - } - - /** - * decline server-to-server share - * - * @param array $params - * @return \OC_OCS_Result - */ - public function declineShare($params) { - - if (!$this->isS2SEnabled()) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $id = $params['id']; - $token = isset($_POST['token']) ? $_POST['token'] : null; - - $share = $this->getShare($id, $token); - - if ($share) { - // userId must be set to the user who unshares - \OCP\Share::unshare($share['item_type'], $share['item_source'], $share['share_type'], $share['share_with'], $share['uid_owner']); - - list($file, $link) = $this->getFile($share['uid_owner'], $share['file_source']); - - $event = \OC::$server->getActivityManager()->generateEvent(); - $event->setApp(Activity::FILES_SHARING_APP) - ->setType(Activity::TYPE_REMOTE_SHARE) - ->setAffectedUser($share['uid_owner']) - ->setSubject(Activity::SUBJECT_REMOTE_SHARE_DECLINED, [$share['share_with'], basename($file)]) - ->setObject('files', $share['file_source'], $file) - ->setLink($link); - \OC::$server->getActivityManager()->publish($event); - } - - return new \OC_OCS_Result(); - } - - /** - * remove server-to-server share if it was unshared by the owner - * - * @param array $params - * @return \OC_OCS_Result - */ - public function unshare($params) { - - if (!$this->isS2SEnabled()) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $id = $params['id']; - $token = isset($_POST['token']) ? $_POST['token'] : null; - - $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); - $query->execute(array($id, $token)); - $share = $query->fetchRow(); - - if ($token && $id && !empty($share)) { - - $remote = $this->cleanupRemote($share['remote']); - - $owner = $share['owner'] . '@' . $remote; - $mountpoint = $share['mountpoint']; - $user = $share['user']; - - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); - $query->execute(array($id, $token)); - - if ($share['accepted']) { - $path = trim($mountpoint, '/'); - } else { - $path = trim($share['name'], '/'); - } - - $notificationManager = \OC::$server->getNotificationManager(); - $notification = $notificationManager->createNotification(); - $notification->setApp('files_sharing') - ->setUser($share['user']) - ->setObject('remote_share', (int) $share['id']); - $notificationManager->markProcessed($notification); - - \OC::$server->getActivityManager()->publishActivity( - Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_UNSHARED, array($owner, $path), '', array(), - '', '', $user, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_MEDIUM); - } - - return new \OC_OCS_Result(); - } - - private function cleanupRemote($remote) { - $remote = substr($remote, strpos($remote, '://') + 3); - - return rtrim($remote, '/'); - } - - /** - * get share - * - * @param int $id - * @param string $token - * @return array - */ - private function getShare($id, $token) { - $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `id` = ? AND `token` = ? AND `share_type` = ?'); - $query->execute(array($id, $token, \OCP\Share::SHARE_TYPE_REMOTE)); - $share = $query->fetchRow(); - - return $share; - } - - /** - * get file - * - * @param string $user - * @param int $fileSource - * @return array with internal path of the file and a absolute link to it - */ - private function getFile($user, $fileSource) { - \OC_Util::setupFS($user); - - try { - $file = \OC\Files\Filesystem::getPath($fileSource); - } catch (NotFoundException $e) { - $file = null; - } - $args = \OC\Files\Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file); - $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args); - - return array($file, $link); - - } - - /** - * check if server-to-server sharing is enabled - * - * @param bool $incoming - * @return bool - */ - private function isS2SEnabled($incoming = false) { - - $result = \OCP\App::isEnabled('files_sharing'); - - if ($incoming) { - $result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled(); - } else { - $result = $result && $this->federatedShareProvider->isOutgoingServer2serverShareEnabled(); - } - - return $result; - } - -} diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php index af762845326..28166b943b8 100644 --- a/apps/files_sharing/api/share20ocs.php +++ b/apps/files_sharing/api/share20ocs.php @@ -99,7 +99,15 @@ class Share20OCS { */ protected function formatShare(\OCP\Share\IShare $share) { $sharedBy = $this->userManager->get($share->getSharedBy()); - $shareOwner = $this->userManager->get($share->getShareOwner()); + // for federated shares the owner can be a remote user, in this + // case we use the initiator + if ($this->userManager->userExists($share->getShareOwner())) { + $shareOwner = $this->userManager->get($share->getShareOwner()); + $localUser = $share->getShareOwner(); + } else { + $shareOwner = $this->userManager->get($share->getSharedBy()); + $localUser = $share->getSharedBy(); + } $result = [ 'id' => $share->getId(), 'share_type' => $share->getShareType(), @@ -115,7 +123,7 @@ class Share20OCS { ]; $node = $share->getNode(); - $result['path'] = $this->rootFolder->getUserFolder($share->getShareOwner())->getRelativePath($node->getPath()); + $result['path'] = $this->rootFolder->getUserFolder($localUser)->getRelativePath($node->getPath()); if ($node instanceOf \OCP\Files\Folder) { $result['item_type'] = 'folder'; } else { diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index da573d11ec5..32eee9b6c9c 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -103,15 +103,3 @@ if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') { } } } - -$manager = \OC::$server->getNotificationManager(); -$manager->registerNotifier(function() { - return new \OCA\Files_Sharing\Notifier( - \OC::$server->getL10NFactory() - ); -}, function() use ($l) { - return [ - 'id' => 'files_sharing', - 'name' => $l->t('Federated sharing'), - ]; -}); diff --git a/apps/files_sharing/l10n/cs_CZ.js b/apps/files_sharing/l10n/cs_CZ.js index f6e937a723d..aba62f0811b 100644 --- a/apps/files_sharing/l10n/cs_CZ.js +++ b/apps/files_sharing/l10n/cs_CZ.js @@ -9,16 +9,16 @@ OC.L10N.register( "Storage not valid" : "Úložiště není platné", "Couldn't add remote share" : "Nelze přidat vzdálené úložiště", "Share API is disabled" : "Sdílení API je zakázané", - "Wrong share ID, share doesn't exist" : "Špatné sdílení ID, sdílení neexistuje", + "Wrong share ID, share doesn't exist" : "Špatné ID sdílení, sdílení neexistuje", "Could not delete share" : "Nelze smazat sdílení", - "Please specify a file or folder path" : "Prosím zadejte cestu složky nebo souboru", - "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/složka neexistuje", + "Please specify a file or folder path" : "Prosím zadejte cestu adresáře nebo souboru", + "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/adresář neexistuje", "Please specify a valid user" : "Prosím zadejte platného uživatele", "Group sharing is disabled by the administrator" : "Skupinové sdílení bylo zakázáno administrátorem", "Please specify a valid group" : "Prosím zadejte platnou skupinu", "Public link sharing is disabled by the administrator" : "Veřejný odkaz sdílení je zakázán administrátorem", "Public upload disabled by the administrator" : "Veřejné nahrávání zakázáno administrátorem", - "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze pro sdílení veřejných složek", + "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze do veřejně sdílených adresářů", "Invalid date, date format must be YYYY-MM-DD" : "Neplatné datum, formát data musí být YYY-MM-DD", "Sharing %s failed because the back end does not allow shares from type %s" : "Sdílení %s selhalo, podpůrná vrstva nepodporuje typ sdílení %s", "Unknown share type" : "Neznámý typ sdílení", @@ -47,8 +47,8 @@ OC.L10N.register( "Invalid ownCloud url" : "Neplatná ownCloud url", "Shared by" : "Sdílí", "Sharing" : "Sdílení", - "A file or folder has been <strong>shared</strong>" : "Soubor nebo složka byla <strong>nasdílena</strong>", - "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo složka byla nasdílena z <strong>jiného serveru</strong>", + "A file or folder has been <strong>shared</strong>" : "Soubor nebo adresář byl <strong>nasdílen</strong>", + "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo adresář byl nasdílen z <strong>jiného serveru</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Byl <strong>stažen</strong> veřejně sdílený soubor nebo adresář", "You received a new remote share %2$s from %1$s" : "Obdrželi jste nové vzdálené sdílení %2$s od uživatele %1$s", "You received a new remote share from %s" : "Obdrželi jste nové vzdálené sdílení z %s", diff --git a/apps/files_sharing/l10n/cs_CZ.json b/apps/files_sharing/l10n/cs_CZ.json index 45c81e4e4e0..74877e2f2fa 100644 --- a/apps/files_sharing/l10n/cs_CZ.json +++ b/apps/files_sharing/l10n/cs_CZ.json @@ -7,16 +7,16 @@ "Storage not valid" : "Úložiště není platné", "Couldn't add remote share" : "Nelze přidat vzdálené úložiště", "Share API is disabled" : "Sdílení API je zakázané", - "Wrong share ID, share doesn't exist" : "Špatné sdílení ID, sdílení neexistuje", + "Wrong share ID, share doesn't exist" : "Špatné ID sdílení, sdílení neexistuje", "Could not delete share" : "Nelze smazat sdílení", - "Please specify a file or folder path" : "Prosím zadejte cestu složky nebo souboru", - "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/složka neexistuje", + "Please specify a file or folder path" : "Prosím zadejte cestu adresáře nebo souboru", + "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/adresář neexistuje", "Please specify a valid user" : "Prosím zadejte platného uživatele", "Group sharing is disabled by the administrator" : "Skupinové sdílení bylo zakázáno administrátorem", "Please specify a valid group" : "Prosím zadejte platnou skupinu", "Public link sharing is disabled by the administrator" : "Veřejný odkaz sdílení je zakázán administrátorem", "Public upload disabled by the administrator" : "Veřejné nahrávání zakázáno administrátorem", - "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze pro sdílení veřejných složek", + "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze do veřejně sdílených adresářů", "Invalid date, date format must be YYYY-MM-DD" : "Neplatné datum, formát data musí být YYY-MM-DD", "Sharing %s failed because the back end does not allow shares from type %s" : "Sdílení %s selhalo, podpůrná vrstva nepodporuje typ sdílení %s", "Unknown share type" : "Neznámý typ sdílení", @@ -45,8 +45,8 @@ "Invalid ownCloud url" : "Neplatná ownCloud url", "Shared by" : "Sdílí", "Sharing" : "Sdílení", - "A file or folder has been <strong>shared</strong>" : "Soubor nebo složka byla <strong>nasdílena</strong>", - "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo složka byla nasdílena z <strong>jiného serveru</strong>", + "A file or folder has been <strong>shared</strong>" : "Soubor nebo adresář byl <strong>nasdílen</strong>", + "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo adresář byl nasdílen z <strong>jiného serveru</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Byl <strong>stažen</strong> veřejně sdílený soubor nebo adresář", "You received a new remote share %2$s from %1$s" : "Obdrželi jste nové vzdálené sdílení %2$s od uživatele %1$s", "You received a new remote share from %s" : "Obdrželi jste nové vzdálené sdílení z %s", diff --git a/apps/files_sharing/l10n/es.js b/apps/files_sharing/l10n/es.js index 503529b7a5b..961cf47b2f1 100644 --- a/apps/files_sharing/l10n/es.js +++ b/apps/files_sharing/l10n/es.js @@ -17,10 +17,15 @@ OC.L10N.register( "Group sharing is disabled by the administrator" : "Compartir en grupo está deshabilitado por el administrador", "Please specify a valid group" : "Por favor, especifica un grupo válido", "Public link sharing is disabled by the administrator" : "Compartir enlaces de forma pública está deshabilitado por el administrador", + "Public upload disabled by the administrator" : "La subida pública está deshabilitado por el administrador", + "Public upload is only possible for publicly shared folders" : "La subida publica solo es posible poara las carpetas publicas compartidas", "Invalid date, date format must be YYYY-MM-DD" : "Fecha inválida, el formato de las fechas debe ser YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "Compartir %s ha fallado porque el repositorio no admite compartidos del tipo %s", "Unknown share type" : "Tipo desconocido de recurso compartido", "Not a directory" : "No es un directorio", + "Could not lock path" : "No se ha podido bloquear la ruta", "Can't change permissions for public share links" : "No se pueden cambiar los permisos para los enlaces de recursos compartidos públicos", + "Wrong or no update parameter given" : "No se ha suministrado un parametro correcto", "Cannot increase permissions" : "No es posible aumentar permisos", "Shared with you" : "Compartido contigo", "Shared with others" : "Compartido con otros", diff --git a/apps/files_sharing/l10n/es.json b/apps/files_sharing/l10n/es.json index ca2f1aa196f..1acacc064e7 100644 --- a/apps/files_sharing/l10n/es.json +++ b/apps/files_sharing/l10n/es.json @@ -15,10 +15,15 @@ "Group sharing is disabled by the administrator" : "Compartir en grupo está deshabilitado por el administrador", "Please specify a valid group" : "Por favor, especifica un grupo válido", "Public link sharing is disabled by the administrator" : "Compartir enlaces de forma pública está deshabilitado por el administrador", + "Public upload disabled by the administrator" : "La subida pública está deshabilitado por el administrador", + "Public upload is only possible for publicly shared folders" : "La subida publica solo es posible poara las carpetas publicas compartidas", "Invalid date, date format must be YYYY-MM-DD" : "Fecha inválida, el formato de las fechas debe ser YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "Compartir %s ha fallado porque el repositorio no admite compartidos del tipo %s", "Unknown share type" : "Tipo desconocido de recurso compartido", "Not a directory" : "No es un directorio", + "Could not lock path" : "No se ha podido bloquear la ruta", "Can't change permissions for public share links" : "No se pueden cambiar los permisos para los enlaces de recursos compartidos públicos", + "Wrong or no update parameter given" : "No se ha suministrado un parametro correcto", "Cannot increase permissions" : "No es posible aumentar permisos", "Shared with you" : "Compartido contigo", "Shared with others" : "Compartido con otros", diff --git a/apps/files_sharing/l10n/sl.js b/apps/files_sharing/l10n/sl.js index c181742df7a..0b55cb1240b 100644 --- a/apps/files_sharing/l10n/sl.js +++ b/apps/files_sharing/l10n/sl.js @@ -60,6 +60,7 @@ OC.L10N.register( "You removed the share of %2$s for %1$s" : "Odstranili ste mapo v souporabi %2$s za %1$s", "You shared %1$s with group %2$s" : "Omogočili ste souporabo %1$s s skupino %2$s", "You shared %1$s via link" : "Omogočili ste souporabo %1$s preko povezave", + "Your public link for %1$s expired" : "Javna povezava za %1$s je časovno potekla!", "%2$s shared %1$s with you" : "Uporabnik %2$s je omogočil souporabo %1$s", "Downloaded via public link" : "Prejeto preko javne povezave", "Shared with %2$s" : "V souporabi z %2$s", diff --git a/apps/files_sharing/l10n/sl.json b/apps/files_sharing/l10n/sl.json index aab8c565335..947a9d609e5 100644 --- a/apps/files_sharing/l10n/sl.json +++ b/apps/files_sharing/l10n/sl.json @@ -58,6 +58,7 @@ "You removed the share of %2$s for %1$s" : "Odstranili ste mapo v souporabi %2$s za %1$s", "You shared %1$s with group %2$s" : "Omogočili ste souporabo %1$s s skupino %2$s", "You shared %1$s via link" : "Omogočili ste souporabo %1$s preko povezave", + "Your public link for %1$s expired" : "Javna povezava za %1$s je časovno potekla!", "%2$s shared %1$s with you" : "Uporabnik %2$s je omogočil souporabo %1$s", "Downloaded via public link" : "Prejeto preko javne povezave", "Shared with %2$s" : "V souporabi z %2$s", diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php index 7dc9f66f114..5b7a13f1eb1 100644 --- a/apps/files_sharing/lib/external/manager.php +++ b/apps/files_sharing/lib/external/manager.php @@ -325,6 +325,10 @@ class Manager { } public function removeShare($mountPoint) { + + $mountPointObj = $this->mountManager->find($mountPoint); + $id = $mountPointObj->getStorage()->getCache()->getId(); + $mountPoint = $this->stripPath($mountPoint); $hash = md5($mountPoint); @@ -338,13 +342,43 @@ class Manager { $share = $getShare->fetch(); $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); } + $getShare->closeCursor(); $query = $this->connection->prepare(' DELETE FROM `*PREFIX*share_external` WHERE `mountpoint_hash` = ? AND `user` = ? '); - return (bool)$query->execute(array($hash, $this->uid)); + $result = (bool)$query->execute(array($hash, $this->uid)); + + if($result) { + $this->removeReShares($id); + } + + return $result; + } + + /** + * remove re-shares from share table and mapping in the federated_reshares table + * + * @param $mountPointId + */ + protected function removeReShares($mountPointId) { + $selectQuery = $this->connection->getQueryBuilder(); + $query = $this->connection->getQueryBuilder(); + $selectQuery->select('id')->from('share') + ->where($selectQuery->expr()->eq('file_source', $query->createNamedParameter($mountPointId))); + $select = $selectQuery->getSQL(); + + + $query->delete('federated_reshares') + ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); + $query->execute(); + + $deleteReShares = $this->connection->getQueryBuilder(); + $deleteReShares->delete('share') + ->where($deleteReShares->expr()->eq('file_source', $deleteReShares->createNamedParameter($mountPointId))); + $deleteReShares->execute(); } /** diff --git a/apps/files_sharing/tests/api/share20ocstest.php b/apps/files_sharing/tests/api/share20ocstest.php index ffb74da2af7..96ce34f963c 100644 --- a/apps/files_sharing/tests/api/share20ocstest.php +++ b/apps/files_sharing/tests/api/share20ocstest.php @@ -82,6 +82,8 @@ class Share20OCSTest extends \Test\TestCase { $this->currentUser = $this->getMock('OCP\IUser'); $this->currentUser->method('getUID')->willReturn('currentUser'); + $this->userManager->expects($this->any())->method('userExists')->willReturn(true); + $this->l = $this->getMock('\OCP\IL10N'); $this->l->method('t') ->will($this->returnCallback(function($text, $parameters = []) { diff --git a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php index 353520bd604..c9aea60d255 100644 --- a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php +++ b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php @@ -154,7 +154,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase { public function testKeepNonFileShares() { $this->loginAsUser($this->user1); - \OCP\Share::registerBackend('test', 'Test_Share_Backend'); + \OCP\Share::registerBackend('test', 'Test\Share\Backend'); $this->assertTrue( \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), diff --git a/apps/files_trashbin/l10n/cs_CZ.js b/apps/files_trashbin/l10n/cs_CZ.js index 22c33690420..712076402f4 100644 --- a/apps/files_trashbin/l10n/cs_CZ.js +++ b/apps/files_trashbin/l10n/cs_CZ.js @@ -13,7 +13,7 @@ OC.L10N.register( "restored" : "obnoveno", "No deleted files" : "Žádné smazané soubory", "You will be able to recover deleted files from here" : "Odtud budete moci obnovovat odstraněné soubory", - "No entries found in this folder" : "V této složce nebylo nic nalezeno", + "No entries found in this folder" : "V tomto adresáři nebylo nic nalezeno", "Select all" : "Vybrat vše", "Name" : "Název", "Deleted" : "Smazáno" diff --git a/apps/files_trashbin/l10n/cs_CZ.json b/apps/files_trashbin/l10n/cs_CZ.json index a4a13942fd1..06c3b2ce096 100644 --- a/apps/files_trashbin/l10n/cs_CZ.json +++ b/apps/files_trashbin/l10n/cs_CZ.json @@ -11,7 +11,7 @@ "restored" : "obnoveno", "No deleted files" : "Žádné smazané soubory", "You will be able to recover deleted files from here" : "Odtud budete moci obnovovat odstraněné soubory", - "No entries found in this folder" : "V této složce nebylo nic nalezeno", + "No entries found in this folder" : "V tomto adresáři nebylo nic nalezeno", "Select all" : "Vybrat vše", "Name" : "Název", "Deleted" : "Smazáno" diff --git a/apps/systemtags/js/systemtagsinfoview.js b/apps/systemtags/js/systemtagsinfoview.js index 2f01ca7db34..a7320a3956f 100644 --- a/apps/systemtags/js/systemtagsinfoview.js +++ b/apps/systemtags/js/systemtagsinfoview.js @@ -12,7 +12,7 @@ function modelToSelection(model) { var data = model.toJSON(); - if (!OC.isUserAdmin() && !data.userAssignable) { + if (!OC.isUserAdmin() && !data.canAssign) { data.locked = true; } return data; diff --git a/apps/systemtags/l10n/bg_BG.js b/apps/systemtags/l10n/bg_BG.js index 6971d20a8c0..eeddbd55d1a 100644 --- a/apps/systemtags/l10n/bg_BG.js +++ b/apps/systemtags/l10n/bg_BG.js @@ -2,6 +2,7 @@ OC.L10N.register( "systemtags", { "Tags" : "Етикети", + "Tagged files" : "Отбелязани файлове", "No files in here" : "Тук няма файлове", "No entries found in this folder" : "Няма намерени записи в тази папка", "Name" : "Име", diff --git a/apps/systemtags/l10n/bg_BG.json b/apps/systemtags/l10n/bg_BG.json index 4e9f849ce9a..b6f33731e60 100644 --- a/apps/systemtags/l10n/bg_BG.json +++ b/apps/systemtags/l10n/bg_BG.json @@ -1,5 +1,6 @@ { "translations": { "Tags" : "Етикети", + "Tagged files" : "Отбелязани файлове", "No files in here" : "Тук няма файлове", "No entries found in this folder" : "Няма намерени записи в тази папка", "Name" : "Име", diff --git a/apps/systemtags/l10n/cs_CZ.js b/apps/systemtags/l10n/cs_CZ.js index 763335f74b2..2af8db9f183 100644 --- a/apps/systemtags/l10n/cs_CZ.js +++ b/apps/systemtags/l10n/cs_CZ.js @@ -21,10 +21,10 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s přiřadil systémový tag %3$s na %2$s", "You unassigned system tag %3$s from %2$s" : "Odebrali jste systémový tag %3$s z %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s odebral systémový tag %3$s ze %2$s", - "%s (not-assignable)" : "%s (nepřiřaditelný)", + "%s (restricted)" : "%s (omezeno)", "%s (invisible)" : "%s (neviditelný)", "No files in here" : "Žádné soubory", - "No entries found in this folder" : "V této složce nebylo nic nalezeno", + "No entries found in this folder" : "V tomto adresáři nebylo nic nalezeno", "Name" : "Název", "Size" : "Velikost", "Modified" : "Upraveno" diff --git a/apps/systemtags/l10n/cs_CZ.json b/apps/systemtags/l10n/cs_CZ.json index f5ba8bee780..c2c6536daa5 100644 --- a/apps/systemtags/l10n/cs_CZ.json +++ b/apps/systemtags/l10n/cs_CZ.json @@ -19,10 +19,10 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s přiřadil systémový tag %3$s na %2$s", "You unassigned system tag %3$s from %2$s" : "Odebrali jste systémový tag %3$s z %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s odebral systémový tag %3$s ze %2$s", - "%s (not-assignable)" : "%s (nepřiřaditelný)", + "%s (restricted)" : "%s (omezeno)", "%s (invisible)" : "%s (neviditelný)", "No files in here" : "Žádné soubory", - "No entries found in this folder" : "V této složce nebylo nic nalezeno", + "No entries found in this folder" : "V tomto adresáři nebylo nic nalezeno", "Name" : "Název", "Size" : "Velikost", "Modified" : "Upraveno" diff --git a/apps/systemtags/l10n/de.js b/apps/systemtags/l10n/de.js index a711863c905..d87807c0eed 100644 --- a/apps/systemtags/l10n/de.js +++ b/apps/systemtags/l10n/de.js @@ -21,7 +21,7 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s hat System-Tag %3$s an %2$s angebracht", "You unassigned system tag %3$s from %2$s" : "Du hast den System-Tag %3$s von %2$s entfernt", "%1$s unassigned system tag %3$s from %2$s" : "%1$s hat den System-Tag %3$s von %2$s entfernt", - "%s (not-assignable)" : "%s (nicht anbringbar)", + "%s (restricted)" : "%s (eingeschränkt)", "%s (invisible)" : "%s (unsichtbar)", "No files in here" : "Keine Dateien vorhanden", "No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden", diff --git a/apps/systemtags/l10n/de.json b/apps/systemtags/l10n/de.json index ea38da7a0b7..ec5f81576c9 100644 --- a/apps/systemtags/l10n/de.json +++ b/apps/systemtags/l10n/de.json @@ -19,7 +19,7 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s hat System-Tag %3$s an %2$s angebracht", "You unassigned system tag %3$s from %2$s" : "Du hast den System-Tag %3$s von %2$s entfernt", "%1$s unassigned system tag %3$s from %2$s" : "%1$s hat den System-Tag %3$s von %2$s entfernt", - "%s (not-assignable)" : "%s (nicht anbringbar)", + "%s (restricted)" : "%s (eingeschränkt)", "%s (invisible)" : "%s (unsichtbar)", "No files in here" : "Keine Dateien vorhanden", "No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden", diff --git a/apps/systemtags/l10n/de_DE.js b/apps/systemtags/l10n/de_DE.js index 28bbf48b1a7..9a5566f7572 100644 --- a/apps/systemtags/l10n/de_DE.js +++ b/apps/systemtags/l10n/de_DE.js @@ -21,7 +21,7 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s hat System-Tag %3$s an %2$s angebracht", "You unassigned system tag %3$s from %2$s" : "Sie haben den System-Tag %3$s von %2$s entfernt", "%1$s unassigned system tag %3$s from %2$s" : "%1$s hat den System-Tag %3$s von %2$s entfernt", - "%s (not-assignable)" : "%s (nicht anbringbar)", + "%s (restricted)" : "%s (eingeschränkt)", "%s (invisible)" : "%s (unsichtbar)", "No files in here" : "Keine Dateien vorhanden", "No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden", diff --git a/apps/systemtags/l10n/de_DE.json b/apps/systemtags/l10n/de_DE.json index dacab53df53..77a5bbf0354 100644 --- a/apps/systemtags/l10n/de_DE.json +++ b/apps/systemtags/l10n/de_DE.json @@ -19,7 +19,7 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s hat System-Tag %3$s an %2$s angebracht", "You unassigned system tag %3$s from %2$s" : "Sie haben den System-Tag %3$s von %2$s entfernt", "%1$s unassigned system tag %3$s from %2$s" : "%1$s hat den System-Tag %3$s von %2$s entfernt", - "%s (not-assignable)" : "%s (nicht anbringbar)", + "%s (restricted)" : "%s (eingeschränkt)", "%s (invisible)" : "%s (unsichtbar)", "No files in here" : "Keine Dateien vorhanden", "No entries found in this folder" : "Keine Einträge in diesem Ordner gefunden", diff --git a/apps/systemtags/l10n/en_GB.js b/apps/systemtags/l10n/en_GB.js index 69ac64e5d0b..c5b5b5c0415 100644 --- a/apps/systemtags/l10n/en_GB.js +++ b/apps/systemtags/l10n/en_GB.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s assigned system tag %3$s to %2$s", "You unassigned system tag %3$s from %2$s" : "You unassigned system tag %3$s from %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s unassigned system tag %3$s from %2$s", - "%s (not-assignable)" : "%s (not-assignable)", "%s (invisible)" : "%s (invisible)", "No files in here" : "No files in here", "No entries found in this folder" : "No entries found in this folder", diff --git a/apps/systemtags/l10n/en_GB.json b/apps/systemtags/l10n/en_GB.json index b8700a848bf..daac670bce4 100644 --- a/apps/systemtags/l10n/en_GB.json +++ b/apps/systemtags/l10n/en_GB.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s assigned system tag %3$s to %2$s", "You unassigned system tag %3$s from %2$s" : "You unassigned system tag %3$s from %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s unassigned system tag %3$s from %2$s", - "%s (not-assignable)" : "%s (not-assignable)", "%s (invisible)" : "%s (invisible)", "No files in here" : "No files in here", "No entries found in this folder" : "No entries found in this folder", diff --git a/apps/systemtags/l10n/eo.js b/apps/systemtags/l10n/eo.js index c54bab71d92..6d92e4c48f9 100644 --- a/apps/systemtags/l10n/eo.js +++ b/apps/systemtags/l10n/eo.js @@ -14,7 +14,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s ĝisdatigis sistemetikedon %3$s al %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s atribuis sistemetikedon %3$s al %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s malatribuis sistemetikedon %3$s el %2$s", - "%s (not-assignable)" : "%s (neatribuebla)", "%s (invisible)" : "%s (nevidebla)", "No files in here" : "Neniu dosiero estas ĉi tie", "No entries found in this folder" : "Neniu enigo troviĝis en ĉi tiu dosierujo", diff --git a/apps/systemtags/l10n/eo.json b/apps/systemtags/l10n/eo.json index 5adb00df52b..e4457bb1dc3 100644 --- a/apps/systemtags/l10n/eo.json +++ b/apps/systemtags/l10n/eo.json @@ -12,7 +12,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s ĝisdatigis sistemetikedon %3$s al %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s atribuis sistemetikedon %3$s al %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s malatribuis sistemetikedon %3$s el %2$s", - "%s (not-assignable)" : "%s (neatribuebla)", "%s (invisible)" : "%s (nevidebla)", "No files in here" : "Neniu dosiero estas ĉi tie", "No entries found in this folder" : "Neniu enigo troviĝis en ĉi tiu dosierujo", diff --git a/apps/systemtags/l10n/es.js b/apps/systemtags/l10n/es.js index 95183d5c827..d9701e07a42 100644 --- a/apps/systemtags/l10n/es.js +++ b/apps/systemtags/l10n/es.js @@ -21,7 +21,7 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s asignó la etiqueta de sistema %3$s a %2$s", "You unassigned system tag %3$s from %2$s" : "Desasignaste la etiqueta del sistema a %3$s de %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s eliminó la asignación de etiqueta de sistema %3$s de %2$s", - "%s (not-assignable)" : "%s (no asignable)", + "%s (restricted)" : "%s (restringido)", "%s (invisible)" : "%s (invisible)", "No files in here" : "Aquí no hay archivos", "No entries found in this folder" : "No hay entradas en esta carpeta", diff --git a/apps/systemtags/l10n/es.json b/apps/systemtags/l10n/es.json index 4bc5a63dd83..c310a231202 100644 --- a/apps/systemtags/l10n/es.json +++ b/apps/systemtags/l10n/es.json @@ -19,7 +19,7 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s asignó la etiqueta de sistema %3$s a %2$s", "You unassigned system tag %3$s from %2$s" : "Desasignaste la etiqueta del sistema a %3$s de %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s eliminó la asignación de etiqueta de sistema %3$s de %2$s", - "%s (not-assignable)" : "%s (no asignable)", + "%s (restricted)" : "%s (restringido)", "%s (invisible)" : "%s (invisible)", "No files in here" : "Aquí no hay archivos", "No entries found in this folder" : "No hay entradas en esta carpeta", diff --git a/apps/systemtags/l10n/et_EE.js b/apps/systemtags/l10n/et_EE.js index 0bc585a4284..9852a8adaf1 100644 --- a/apps/systemtags/l10n/et_EE.js +++ b/apps/systemtags/l10n/et_EE.js @@ -4,7 +4,6 @@ OC.L10N.register( "Tags" : "Sildid", "Tagged files" : "Sildistatud failid", "Select tags to filter by" : "Vali sildid, mille järgi filtreerida", - "%s (not-assignable)" : "%s (pole määratav)", "%s (invisible)" : "%s (nähtamatu)", "No files in here" : "Siin ei ole faile", "No entries found in this folder" : "Selles kaustast ei leitud kirjeid", diff --git a/apps/systemtags/l10n/et_EE.json b/apps/systemtags/l10n/et_EE.json index 51a1da71faf..94d6ec71d47 100644 --- a/apps/systemtags/l10n/et_EE.json +++ b/apps/systemtags/l10n/et_EE.json @@ -2,7 +2,6 @@ "Tags" : "Sildid", "Tagged files" : "Sildistatud failid", "Select tags to filter by" : "Vali sildid, mille järgi filtreerida", - "%s (not-assignable)" : "%s (pole määratav)", "%s (invisible)" : "%s (nähtamatu)", "No files in here" : "Siin ei ole faile", "No entries found in this folder" : "Selles kaustast ei leitud kirjeid", diff --git a/apps/systemtags/l10n/fr.js b/apps/systemtags/l10n/fr.js index 7ee906c5eda..eb16e88a2ec 100644 --- a/apps/systemtags/l10n/fr.js +++ b/apps/systemtags/l10n/fr.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s a attribué l'étiquette système %3$s à %2$s", "You unassigned system tag %3$s from %2$s" : "Vous avez retiré l'étiquette système %3$s de %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s a retiré l'étiquette système %3$s à %2$s", - "%s (not-assignable)" : "%s (non assignable)", "%s (invisible)" : "%s (invisible)", "No files in here" : "Aucun fichier", "No entries found in this folder" : "Aucune entrée trouvée dans ce dossier", diff --git a/apps/systemtags/l10n/fr.json b/apps/systemtags/l10n/fr.json index 2591bd356b0..a4f4770b06b 100644 --- a/apps/systemtags/l10n/fr.json +++ b/apps/systemtags/l10n/fr.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s a attribué l'étiquette système %3$s à %2$s", "You unassigned system tag %3$s from %2$s" : "Vous avez retiré l'étiquette système %3$s de %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s a retiré l'étiquette système %3$s à %2$s", - "%s (not-assignable)" : "%s (non assignable)", "%s (invisible)" : "%s (invisible)", "No files in here" : "Aucun fichier", "No entries found in this folder" : "Aucune entrée trouvée dans ce dossier", diff --git a/apps/systemtags/l10n/he.js b/apps/systemtags/l10n/he.js index 13a5a6040d0..4de8c3535cc 100644 --- a/apps/systemtags/l10n/he.js +++ b/apps/systemtags/l10n/he.js @@ -14,7 +14,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s עדכן/עדכנה תגית מערכת %3$s ל- %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s שייך/שייכה תגית מערכת %3$s ל- %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s הסיר/ה שיוך תגית מערכת %3$s מ- %2$s", - "%s (not-assignable)" : "%s (לא ניתן לשיוך)", "%s (invisible)" : "%s (נסתר)", "No files in here" : "אין כאן קבצים", "No entries found in this folder" : "לא נמצאו כניסות לתיקייה זו", diff --git a/apps/systemtags/l10n/he.json b/apps/systemtags/l10n/he.json index 3aa1e7a87fd..75cf6e1b05b 100644 --- a/apps/systemtags/l10n/he.json +++ b/apps/systemtags/l10n/he.json @@ -12,7 +12,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s עדכן/עדכנה תגית מערכת %3$s ל- %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s שייך/שייכה תגית מערכת %3$s ל- %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s הסיר/ה שיוך תגית מערכת %3$s מ- %2$s", - "%s (not-assignable)" : "%s (לא ניתן לשיוך)", "%s (invisible)" : "%s (נסתר)", "No files in here" : "אין כאן קבצים", "No entries found in this folder" : "לא נמצאו כניסות לתיקייה זו", diff --git a/apps/systemtags/l10n/hu_HU.js b/apps/systemtags/l10n/hu_HU.js index 173b8ead188..13d1705ff1c 100644 --- a/apps/systemtags/l10n/hu_HU.js +++ b/apps/systemtags/l10n/hu_HU.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s hozzárendelte ezt a rendszer címkét: %3$s neki: %2$s", "You unassigned system tag %3$s from %2$s" : "%3$s rendszer címke hozzárendelést elvette tőle: %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s elvette ezt a rendszer címkét %3$s tőle: %2$s", - "%s (not-assignable)" : "%s (nem hozzárendelhető)", "%s (invisible)" : "%s (láthatatlan)", "No files in here" : "Itt nincsenek fájlok", "No entries found in this folder" : "Nincsenek bejegyzések ebben a könyvtárban", diff --git a/apps/systemtags/l10n/hu_HU.json b/apps/systemtags/l10n/hu_HU.json index 6e26da1767b..6408b3a5314 100644 --- a/apps/systemtags/l10n/hu_HU.json +++ b/apps/systemtags/l10n/hu_HU.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s hozzárendelte ezt a rendszer címkét: %3$s neki: %2$s", "You unassigned system tag %3$s from %2$s" : "%3$s rendszer címke hozzárendelést elvette tőle: %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s elvette ezt a rendszer címkét %3$s tőle: %2$s", - "%s (not-assignable)" : "%s (nem hozzárendelhető)", "%s (invisible)" : "%s (láthatatlan)", "No files in here" : "Itt nincsenek fájlok", "No entries found in this folder" : "Nincsenek bejegyzések ebben a könyvtárban", diff --git a/apps/systemtags/l10n/is.js b/apps/systemtags/l10n/is.js index bbabce076c4..079fb251f82 100644 --- a/apps/systemtags/l10n/is.js +++ b/apps/systemtags/l10n/is.js @@ -14,7 +14,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s uppfærði kerfismerki %3$s í %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s úthlutaði kerfismerki %3$s á %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s tók kerfismerki %3$s af %2$s", - "%s (not-assignable)" : "%s (ekki úthlutanlegt)", "%s (invisible)" : "%s (ósýnilegt)", "No files in here" : "Engar skrár hér", "No entries found in this folder" : "Engar skrár fundust í þessari möppu", diff --git a/apps/systemtags/l10n/is.json b/apps/systemtags/l10n/is.json index 5a370136580..c51cc851932 100644 --- a/apps/systemtags/l10n/is.json +++ b/apps/systemtags/l10n/is.json @@ -12,7 +12,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s uppfærði kerfismerki %3$s í %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s úthlutaði kerfismerki %3$s á %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s tók kerfismerki %3$s af %2$s", - "%s (not-assignable)" : "%s (ekki úthlutanlegt)", "%s (invisible)" : "%s (ósýnilegt)", "No files in here" : "Engar skrár hér", "No entries found in this folder" : "Engar skrár fundust í þessari möppu", diff --git a/apps/systemtags/l10n/it.js b/apps/systemtags/l10n/it.js index d4dab4e9ee8..4a2dfc93a79 100644 --- a/apps/systemtags/l10n/it.js +++ b/apps/systemtags/l10n/it.js @@ -21,7 +21,7 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s ha assegnato il tag di sistema %3$s a %2$s", "You unassigned system tag %3$s from %2$s" : "Hai rimosso il tag di sistema %3$s da %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s ha rimosso il tag di sistema %3$s da %2$s", - "%s (not-assignable)" : "%s (non assegnabile)", + "%s (restricted)" : "%s (limitato)", "%s (invisible)" : "%s (invisibile)", "No files in here" : "Qui non c'è alcun file", "No entries found in this folder" : "Nessuna voce trovata in questa cartella", diff --git a/apps/systemtags/l10n/it.json b/apps/systemtags/l10n/it.json index 896df988962..78c96549406 100644 --- a/apps/systemtags/l10n/it.json +++ b/apps/systemtags/l10n/it.json @@ -19,7 +19,7 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s ha assegnato il tag di sistema %3$s a %2$s", "You unassigned system tag %3$s from %2$s" : "Hai rimosso il tag di sistema %3$s da %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s ha rimosso il tag di sistema %3$s da %2$s", - "%s (not-assignable)" : "%s (non assegnabile)", + "%s (restricted)" : "%s (limitato)", "%s (invisible)" : "%s (invisibile)", "No files in here" : "Qui non c'è alcun file", "No entries found in this folder" : "Nessuna voce trovata in questa cartella", diff --git a/apps/systemtags/l10n/ja.js b/apps/systemtags/l10n/ja.js index 125e2a434cb..7460665f018 100644 --- a/apps/systemtags/l10n/ja.js +++ b/apps/systemtags/l10n/ja.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s は、%2$s に タグ %3$s を追加", "You unassigned system tag %3$s from %2$s" : "%2$s から タグ %3$s を解除", "%1$s unassigned system tag %3$s from %2$s" : "%1$s は%2$s から タグ %3$s を解除", - "%s (not-assignable)" : "%s (追加できない)", "%s (invisible)" : "%s (不可視)", "No files in here" : "ファイルがありません", "No entries found in this folder" : "このフォルダーにはエントリーがありません", diff --git a/apps/systemtags/l10n/ja.json b/apps/systemtags/l10n/ja.json index 0b4aff337ca..6c16af20328 100644 --- a/apps/systemtags/l10n/ja.json +++ b/apps/systemtags/l10n/ja.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s は、%2$s に タグ %3$s を追加", "You unassigned system tag %3$s from %2$s" : "%2$s から タグ %3$s を解除", "%1$s unassigned system tag %3$s from %2$s" : "%1$s は%2$s から タグ %3$s を解除", - "%s (not-assignable)" : "%s (追加できない)", "%s (invisible)" : "%s (不可視)", "No files in here" : "ファイルがありません", "No entries found in this folder" : "このフォルダーにはエントリーがありません", diff --git a/apps/systemtags/l10n/nb_NO.js b/apps/systemtags/l10n/nb_NO.js index aeecadc80fe..06ac7b1d52c 100644 --- a/apps/systemtags/l10n/nb_NO.js +++ b/apps/systemtags/l10n/nb_NO.js @@ -14,7 +14,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s oppdaterte system-merkelapp %3$s til %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s festet system-merkelapp %3$s på %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s fjernet system-merkelapp %3$s fra %2$s", - "%s (not-assignable)" : "%s (ikke-brukbar)", "%s (invisible)" : "%s (usynlig)", "No files in here" : "Ingen filer her", "No entries found in this folder" : "Ingen oppføringer funnet i denne mappen", diff --git a/apps/systemtags/l10n/nb_NO.json b/apps/systemtags/l10n/nb_NO.json index 8431ea65616..35fd6643a9f 100644 --- a/apps/systemtags/l10n/nb_NO.json +++ b/apps/systemtags/l10n/nb_NO.json @@ -12,7 +12,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s oppdaterte system-merkelapp %3$s til %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s festet system-merkelapp %3$s på %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s fjernet system-merkelapp %3$s fra %2$s", - "%s (not-assignable)" : "%s (ikke-brukbar)", "%s (invisible)" : "%s (usynlig)", "No files in here" : "Ingen filer her", "No entries found in this folder" : "Ingen oppføringer funnet i denne mappen", diff --git a/apps/systemtags/l10n/nl.js b/apps/systemtags/l10n/nl.js index f8c98435abc..3b4aa7eb56d 100644 --- a/apps/systemtags/l10n/nl.js +++ b/apps/systemtags/l10n/nl.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s wees systeem tag %3$s aan %2$s toe", "You unassigned system tag %3$s from %2$s" : "Je maakte toewijzing systeem tag %3$s van %2$s ongedaan", "%1$s unassigned system tag %3$s from %2$s" : "%1$s verwijderde systeem tag %3$s van %2$s", - "%s (not-assignable)" : "%s (niet toewijsbaar)", "%s (invisible)" : "%s (onzichtbaar)", "No files in here" : "Hier geen bestanden", "No entries found in this folder" : "Niets gevonden in deze map", diff --git a/apps/systemtags/l10n/nl.json b/apps/systemtags/l10n/nl.json index 0803a5a19f0..f941ce3a4a6 100644 --- a/apps/systemtags/l10n/nl.json +++ b/apps/systemtags/l10n/nl.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s wees systeem tag %3$s aan %2$s toe", "You unassigned system tag %3$s from %2$s" : "Je maakte toewijzing systeem tag %3$s van %2$s ongedaan", "%1$s unassigned system tag %3$s from %2$s" : "%1$s verwijderde systeem tag %3$s van %2$s", - "%s (not-assignable)" : "%s (niet toewijsbaar)", "%s (invisible)" : "%s (onzichtbaar)", "No files in here" : "Hier geen bestanden", "No entries found in this folder" : "Niets gevonden in deze map", diff --git a/apps/systemtags/l10n/pl.js b/apps/systemtags/l10n/pl.js index 1b665ee4f36..fc3616bff26 100644 --- a/apps/systemtags/l10n/pl.js +++ b/apps/systemtags/l10n/pl.js @@ -12,7 +12,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s zaktualizowany system etykiet%3$s do %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s przypisywalny system etykiet%3$s do %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s nieprzypisany system etykiet %3$s z %2$s", - "%s (not-assignable)" : "%s (nieprzypisalny)", "%s (invisible)" : "%s (niewidoczny)", "No files in here" : "Brak plików", "No entries found in this folder" : "Brak wpisów w tym folderze", diff --git a/apps/systemtags/l10n/pl.json b/apps/systemtags/l10n/pl.json index 781d4539f5a..543aa3be58c 100644 --- a/apps/systemtags/l10n/pl.json +++ b/apps/systemtags/l10n/pl.json @@ -10,7 +10,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s zaktualizowany system etykiet%3$s do %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s przypisywalny system etykiet%3$s do %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s nieprzypisany system etykiet %3$s z %2$s", - "%s (not-assignable)" : "%s (nieprzypisalny)", "%s (invisible)" : "%s (niewidoczny)", "No files in here" : "Brak plików", "No entries found in this folder" : "Brak wpisów w tym folderze", diff --git a/apps/systemtags/l10n/pt_BR.js b/apps/systemtags/l10n/pt_BR.js index a66e437a17a..4032720d406 100644 --- a/apps/systemtags/l10n/pt_BR.js +++ b/apps/systemtags/l10n/pt_BR.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s etiqueta de sistema atribuída %3$s para %2$s", "You unassigned system tag %3$s from %2$s" : "Você eliminou a atribuição da etiqueta do sistema %3$s de %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s etiqueta de sistema não atribuída %3$s de %2$s", - "%s (not-assignable)" : "%s (intransferível)", "%s (invisible)" : "%s (invisivel)", "No files in here" : "Nenhum arquivo aqui", "No entries found in this folder" : "Nenhuma entrada foi encontrada nesta pasta", diff --git a/apps/systemtags/l10n/pt_BR.json b/apps/systemtags/l10n/pt_BR.json index 270216ef0ac..564eddead9d 100644 --- a/apps/systemtags/l10n/pt_BR.json +++ b/apps/systemtags/l10n/pt_BR.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s etiqueta de sistema atribuída %3$s para %2$s", "You unassigned system tag %3$s from %2$s" : "Você eliminou a atribuição da etiqueta do sistema %3$s de %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s etiqueta de sistema não atribuída %3$s de %2$s", - "%s (not-assignable)" : "%s (intransferível)", "%s (invisible)" : "%s (invisivel)", "No files in here" : "Nenhum arquivo aqui", "No entries found in this folder" : "Nenhuma entrada foi encontrada nesta pasta", diff --git a/apps/systemtags/l10n/pt_PT.js b/apps/systemtags/l10n/pt_PT.js index da277cef515..60d38d6b298 100644 --- a/apps/systemtags/l10n/pt_PT.js +++ b/apps/systemtags/l10n/pt_PT.js @@ -14,7 +14,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s atualizou a etiqueta %3$s para %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s atribuiu a etiqueta %3$s a %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s retirou a etiqueta %3$s a %2$s", - "%s (not-assignable)" : "%s (não atribuível)", "%s (invisible)" : "%s (invisível)", "No files in here" : "Nenhuns ficheiros aqui", "No entries found in this folder" : "Não foram encontradas entradas nesta pasta", diff --git a/apps/systemtags/l10n/pt_PT.json b/apps/systemtags/l10n/pt_PT.json index 90f7064bc26..8d5db102870 100644 --- a/apps/systemtags/l10n/pt_PT.json +++ b/apps/systemtags/l10n/pt_PT.json @@ -12,7 +12,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s atualizou a etiqueta %3$s para %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s atribuiu a etiqueta %3$s a %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s retirou a etiqueta %3$s a %2$s", - "%s (not-assignable)" : "%s (não atribuível)", "%s (invisible)" : "%s (invisível)", "No files in here" : "Nenhuns ficheiros aqui", "No entries found in this folder" : "Não foram encontradas entradas nesta pasta", diff --git a/apps/systemtags/l10n/ro.js b/apps/systemtags/l10n/ro.js index 42bdbfef600..ebc68938d8c 100644 --- a/apps/systemtags/l10n/ro.js +++ b/apps/systemtags/l10n/ro.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s a atribuit eticheta de sistem %3$s la %2$s", "You unassigned system tag %3$s from %2$s" : "Ai înlăturat eticheta de sistem %3$s de la %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s a înlăturat eticheta de sistem %3$s de la %2$s", - "%s (not-assignable)" : "%s (nu este atribuibil)", "%s (invisible)" : "%s (invizibil)", "No files in here" : "Niciun fișier aici", "No entries found in this folder" : "Niciun element găsit în acest director", diff --git a/apps/systemtags/l10n/ro.json b/apps/systemtags/l10n/ro.json index cf5f378c44e..b5d8951e21c 100644 --- a/apps/systemtags/l10n/ro.json +++ b/apps/systemtags/l10n/ro.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s a atribuit eticheta de sistem %3$s la %2$s", "You unassigned system tag %3$s from %2$s" : "Ai înlăturat eticheta de sistem %3$s de la %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s a înlăturat eticheta de sistem %3$s de la %2$s", - "%s (not-assignable)" : "%s (nu este atribuibil)", "%s (invisible)" : "%s (invizibil)", "No files in here" : "Niciun fișier aici", "No entries found in this folder" : "Niciun element găsit în acest director", diff --git a/apps/systemtags/l10n/ru.js b/apps/systemtags/l10n/ru.js index 23080dbf5eb..8e7e6ae24c6 100644 --- a/apps/systemtags/l10n/ru.js +++ b/apps/systemtags/l10n/ru.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s назначил системную метку %3$s для %2$s", "You unassigned system tag %3$s from %2$s" : "Вы назначили системный тег %3$s из %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s отсоединил системную метку %3$s для %2$s", - "%s (not-assignable)" : "%s (неназначаемые)", "%s (invisible)" : "%s (невидимые)", "No files in here" : "Здесь нет файлов", "No entries found in this folder" : "Нет элементов в этом каталоге", diff --git a/apps/systemtags/l10n/ru.json b/apps/systemtags/l10n/ru.json index e7e42366aaf..2f583c4216d 100644 --- a/apps/systemtags/l10n/ru.json +++ b/apps/systemtags/l10n/ru.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s назначил системную метку %3$s для %2$s", "You unassigned system tag %3$s from %2$s" : "Вы назначили системный тег %3$s из %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s отсоединил системную метку %3$s для %2$s", - "%s (not-assignable)" : "%s (неназначаемые)", "%s (invisible)" : "%s (невидимые)", "No files in here" : "Здесь нет файлов", "No entries found in this folder" : "Нет элементов в этом каталоге", diff --git a/apps/systemtags/l10n/sl.js b/apps/systemtags/l10n/sl.js index cd67abe627c..727f03b8eb0 100644 --- a/apps/systemtags/l10n/sl.js +++ b/apps/systemtags/l10n/sl.js @@ -21,7 +21,7 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "Uporabnik %1$s je dodelil sistemsko oznako %3$s za %2$s", "You unassigned system tag %3$s from %2$s" : "Odstranili ste sistemsko oznako %3$s od %2$s", "%1$s unassigned system tag %3$s from %2$s" : "Uporabnik %1$s je prevzel sistemsko oznako %3$s od %2$s", - "%s (not-assignable)" : "%s (nedodeljivo)", + "%s (restricted)" : "%s (omejeno)", "%s (invisible)" : "%s (nevidno)", "No files in here" : "V mapi ni datotek", "No entries found in this folder" : "V tej mapi ni najdenih predmetov.", diff --git a/apps/systemtags/l10n/sl.json b/apps/systemtags/l10n/sl.json index e90a925ee36..6ec3bf25957 100644 --- a/apps/systemtags/l10n/sl.json +++ b/apps/systemtags/l10n/sl.json @@ -19,7 +19,7 @@ "%1$s assigned system tag %3$s to %2$s" : "Uporabnik %1$s je dodelil sistemsko oznako %3$s za %2$s", "You unassigned system tag %3$s from %2$s" : "Odstranili ste sistemsko oznako %3$s od %2$s", "%1$s unassigned system tag %3$s from %2$s" : "Uporabnik %1$s je prevzel sistemsko oznako %3$s od %2$s", - "%s (not-assignable)" : "%s (nedodeljivo)", + "%s (restricted)" : "%s (omejeno)", "%s (invisible)" : "%s (nevidno)", "No files in here" : "V mapi ni datotek", "No entries found in this folder" : "V tej mapi ni najdenih predmetov.", diff --git a/apps/systemtags/l10n/sq.js b/apps/systemtags/l10n/sq.js index f7773feed9e..573c444a83e 100644 --- a/apps/systemtags/l10n/sq.js +++ b/apps/systemtags/l10n/sq.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s caktoi etiketën e sistemit %3$s si %2$s", "You unassigned system tag %3$s from %2$s" : "I hoqët %2$s etiketën e sistemit %3$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s hoqi prej %2$s etiketën e sistemit %3$s", - "%s (not-assignable)" : "%s (e pacaktushme)", "%s (invisible)" : "%s (e padukshme)", "No files in here" : "S’ka kartela këtu", "No entries found in this folder" : "S’u gjetën zëra në këtë dosje", diff --git a/apps/systemtags/l10n/sq.json b/apps/systemtags/l10n/sq.json index 122b4e96ca3..82095e22c63 100644 --- a/apps/systemtags/l10n/sq.json +++ b/apps/systemtags/l10n/sq.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s caktoi etiketën e sistemit %3$s si %2$s", "You unassigned system tag %3$s from %2$s" : "I hoqët %2$s etiketën e sistemit %3$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s hoqi prej %2$s etiketën e sistemit %3$s", - "%s (not-assignable)" : "%s (e pacaktushme)", "%s (invisible)" : "%s (e padukshme)", "No files in here" : "S’ka kartela këtu", "No entries found in this folder" : "S’u gjetën zëra në këtë dosje", diff --git a/apps/systemtags/l10n/sr.js b/apps/systemtags/l10n/sr.js index d4a5abdf3ed..623fdf3bfa4 100644 --- a/apps/systemtags/l10n/sr.js +++ b/apps/systemtags/l10n/sr.js @@ -9,7 +9,6 @@ OC.L10N.register( "%1$s deleted system tag %2$s" : "%1$s обриса системску ознаку %2$s", "%1$s updated system tag %3$s to %2$s" : "%1$s ажурира системску ознаку %3$s на %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s додели системску ознаку %3$s на %2$s", - "%s (not-assignable)" : "%s (недодељива)", "%s (invisible)" : "%s (невидљива)", "No files in here" : "Овде нема фајлова", "No entries found in this folder" : "Нема ничега у овој фасцикли", diff --git a/apps/systemtags/l10n/sr.json b/apps/systemtags/l10n/sr.json index d4a5bd1cd9a..2ea8c679e9e 100644 --- a/apps/systemtags/l10n/sr.json +++ b/apps/systemtags/l10n/sr.json @@ -7,7 +7,6 @@ "%1$s deleted system tag %2$s" : "%1$s обриса системску ознаку %2$s", "%1$s updated system tag %3$s to %2$s" : "%1$s ажурира системску ознаку %3$s на %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s додели системску ознаку %3$s на %2$s", - "%s (not-assignable)" : "%s (недодељива)", "%s (invisible)" : "%s (невидљива)", "No files in here" : "Овде нема фајлова", "No entries found in this folder" : "Нема ничега у овој фасцикли", diff --git a/apps/systemtags/l10n/th_TH.js b/apps/systemtags/l10n/th_TH.js index b0712f32051..065d22ad448 100644 --- a/apps/systemtags/l10n/th_TH.js +++ b/apps/systemtags/l10n/th_TH.js @@ -21,7 +21,6 @@ OC.L10N.register( "%1$s assigned system tag %3$s to %2$s" : "%1$s ได้ถูกกำหนดแท็กระบบ %3$s เป็น %2$s", "You unassigned system tag %3$s from %2$s" : "คุณยังไม่ได้ได้กำหนดแท็กระบบจาก %3$s เป็น %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s ไม่ได้ถูกกำหนดแท็กระบบ %3$s เป็น %2$s", - "%s (not-assignable)" : "%s (ไม่สามารถกำหนดได้)", "%s (invisible)" : "%s (มองไม่เห็น)", "No files in here" : "ไม่มีไฟล์ที่นี่", "No entries found in this folder" : "ไม่พบรายการในโฟลเดอร์นี้", diff --git a/apps/systemtags/l10n/th_TH.json b/apps/systemtags/l10n/th_TH.json index ddefa10e6f6..ca5f7e35611 100644 --- a/apps/systemtags/l10n/th_TH.json +++ b/apps/systemtags/l10n/th_TH.json @@ -19,7 +19,6 @@ "%1$s assigned system tag %3$s to %2$s" : "%1$s ได้ถูกกำหนดแท็กระบบ %3$s เป็น %2$s", "You unassigned system tag %3$s from %2$s" : "คุณยังไม่ได้ได้กำหนดแท็กระบบจาก %3$s เป็น %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s ไม่ได้ถูกกำหนดแท็กระบบ %3$s เป็น %2$s", - "%s (not-assignable)" : "%s (ไม่สามารถกำหนดได้)", "%s (invisible)" : "%s (มองไม่เห็น)", "No files in here" : "ไม่มีไฟล์ที่นี่", "No entries found in this folder" : "ไม่พบรายการในโฟลเดอร์นี้", diff --git a/apps/systemtags/l10n/tr.js b/apps/systemtags/l10n/tr.js index a2f91dc69d4..eeb72403018 100644 --- a/apps/systemtags/l10n/tr.js +++ b/apps/systemtags/l10n/tr.js @@ -14,7 +14,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s, %3$s sistem etiketini %2$s olarak güncelledi", "%1$s assigned system tag %3$s to %2$s" : "%1$s, %3$s sistem etiketini %2$s etiketine atadı", "%1$s unassigned system tag %3$s from %2$s" : "%1$s, %3$s sistem etiketinin %2$s atamasını kaldırdı", - "%s (not-assignable)" : "%s (atanamaz)", "%s (invisible)" : "%s (gizli)", "No files in here" : "Burada hiç dosya yok", "No entries found in this folder" : "Bu klasörde hiçbir girdi bulunamadı", diff --git a/apps/systemtags/l10n/tr.json b/apps/systemtags/l10n/tr.json index fed4afaa130..4d29b328fde 100644 --- a/apps/systemtags/l10n/tr.json +++ b/apps/systemtags/l10n/tr.json @@ -12,7 +12,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s, %3$s sistem etiketini %2$s olarak güncelledi", "%1$s assigned system tag %3$s to %2$s" : "%1$s, %3$s sistem etiketini %2$s etiketine atadı", "%1$s unassigned system tag %3$s from %2$s" : "%1$s, %3$s sistem etiketinin %2$s atamasını kaldırdı", - "%s (not-assignable)" : "%s (atanamaz)", "%s (invisible)" : "%s (gizli)", "No files in here" : "Burada hiç dosya yok", "No entries found in this folder" : "Bu klasörde hiçbir girdi bulunamadı", diff --git a/apps/systemtags/l10n/zh_CN.js b/apps/systemtags/l10n/zh_CN.js index cc83347bf01..7ab6541475c 100644 --- a/apps/systemtags/l10n/zh_CN.js +++ b/apps/systemtags/l10n/zh_CN.js @@ -14,7 +14,6 @@ OC.L10N.register( "%1$s updated system tag %3$s to %2$s" : "%1$s 更新了系统标签 %3$s 为 %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s 分配了系统标签 %3$s 到 %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s 取消分配系统标签 %3$s 从 %2$s", - "%s (not-assignable)" : "%s (不可分配)", "%s (invisible)" : "%s (不可见)", "No files in here" : "无文件", "No entries found in this folder" : "此文件夹中无项目", diff --git a/apps/systemtags/l10n/zh_CN.json b/apps/systemtags/l10n/zh_CN.json index d20c4c72469..b5dec5282ab 100644 --- a/apps/systemtags/l10n/zh_CN.json +++ b/apps/systemtags/l10n/zh_CN.json @@ -12,7 +12,6 @@ "%1$s updated system tag %3$s to %2$s" : "%1$s 更新了系统标签 %3$s 为 %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s 分配了系统标签 %3$s 到 %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s 取消分配系统标签 %3$s 从 %2$s", - "%s (not-assignable)" : "%s (不可分配)", "%s (invisible)" : "%s (不可见)", "No files in here" : "无文件", "No entries found in this folder" : "此文件夹中无项目", diff --git a/apps/systemtags/lib/Activity/Extension.php b/apps/systemtags/lib/Activity/Extension.php index 8c101a6f550..6bb83e37cfc 100644 --- a/apps/systemtags/lib/Activity/Extension.php +++ b/apps/systemtags/lib/Activity/Extension.php @@ -324,7 +324,7 @@ class Extension implements IExtension { case 'assignable': return '<parameter>' . $matches[1] . '</parameter>'; case 'not-assignable': - return '<parameter>' . $l->t('%s (not-assignable)', $matches[1]) . '</parameter>'; + return '<parameter>' . $l->t('%s (restricted)', $matches[1]) . '</parameter>'; case 'invisible': return '<parameter>' . $l->t('%s (invisible)', $matches[1]) . '</parameter>'; } diff --git a/apps/systemtags/tests/js/systemtagsinfoviewSpec.js b/apps/systemtags/tests/js/systemtagsinfoviewSpec.js index 27724822c2e..449dfd859d7 100644 --- a/apps/systemtags/tests/js/systemtagsinfoviewSpec.js +++ b/apps/systemtags/tests/js/systemtagsinfoviewSpec.js @@ -62,9 +62,9 @@ describe('OCA.SystemTags.SystemTagsInfoView tests', function() { fetchStub.yieldTo('success', view.selectedTagsCollection); expect(setDataStub.calledOnce).toEqual(true); expect(setDataStub.getCall(0).args[0]).toEqual([{ - id: '1', name: 'test1', userVisible: true, userAssignable: true + id: '1', name: 'test1', userVisible: true, userAssignable: true, canAssign: true }, { - id: '3', name: 'test3', userVisible: true, userAssignable: true + id: '3', name: 'test3', userVisible: true, userAssignable: true, canAssign: true }]); expect(view.$el.hasClass('hidden')).toEqual(false); @@ -79,7 +79,7 @@ describe('OCA.SystemTags.SystemTagsInfoView tests', function() { view = new OCA.SystemTags.SystemTagsInfoView(); view.selectedTagsCollection.add([ {id: '1', name: 'test1'}, - {id: '3', name: 'test3', userVisible: false, userAssignable: false} + {id: '3', name: 'test3', userVisible: false, userAssignable: false, canAssign: false} ]); var callback = sinon.stub(); @@ -87,9 +87,9 @@ describe('OCA.SystemTags.SystemTagsInfoView tests', function() { expect(callback.calledOnce).toEqual(true); expect(callback.getCall(0).args[0]).toEqual([{ - id: '1', name: 'test1', userVisible: true, userAssignable: true + id: '1', name: 'test1', userVisible: true, userAssignable: true, canAssign: true }, { - id: '3', name: 'test3', userVisible: false, userAssignable: false + id: '3', name: 'test3', userVisible: false, userAssignable: false, canAssign: false }]); inputViewSpy.restore(); @@ -103,7 +103,7 @@ describe('OCA.SystemTags.SystemTagsInfoView tests', function() { view = new OCA.SystemTags.SystemTagsInfoView(); view.selectedTagsCollection.add([ {id: '1', name: 'test1'}, - {id: '3', name: 'test3', userAssignable: false} + {id: '3', name: 'test3', userAssignable: false, canAssign: false} ]); var callback = sinon.stub(); @@ -111,9 +111,33 @@ describe('OCA.SystemTags.SystemTagsInfoView tests', function() { expect(callback.calledOnce).toEqual(true); expect(callback.getCall(0).args[0]).toEqual([{ - id: '1', name: 'test1', userVisible: true, userAssignable: true + id: '1', name: 'test1', userVisible: true, userAssignable: true, canAssign: true }, { - id: '3', name: 'test3', userVisible: true, userAssignable: false, locked: true + id: '3', name: 'test3', userVisible: true, userAssignable: false, canAssign: false, locked: true + }]); + + inputViewSpy.restore(); + }); + it('does not set locked flag on non-assignable tags when canAssign overrides it with true', function() { + isAdminStub.returns(false); + + var inputViewSpy = sinon.spy(OC.SystemTags, 'SystemTagsInputField'); + var element = $('<input type="hidden" val="1,4"/>'); + view.remove(); + view = new OCA.SystemTags.SystemTagsInfoView(); + view.selectedTagsCollection.add([ + {id: '1', name: 'test1'}, + {id: '4', name: 'test4', userAssignable: false, canAssign: true} + ]); + + var callback = sinon.stub(); + inputViewSpy.getCall(0).args[0].initSelection(element, callback); + + expect(callback.calledOnce).toEqual(true); + expect(callback.getCall(0).args[0]).toEqual([{ + id: '1', name: 'test1', userVisible: true, userAssignable: true, canAssign: true + }, { + id: '4', name: 'test4', userVisible: true, userAssignable: false, canAssign: true }]); inputViewSpy.restore(); @@ -152,7 +176,8 @@ describe('OCA.SystemTags.SystemTagsInfoView tests', function() { id: '2', name: 'test2', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }); createStub.restore(); diff --git a/apps/updatenotification/l10n/bg_BG.js b/apps/updatenotification/l10n/bg_BG.js index 585d75d9e57..bfe17bf4533 100644 --- a/apps/updatenotification/l10n/bg_BG.js +++ b/apps/updatenotification/l10n/bg_BG.js @@ -1,7 +1,11 @@ OC.L10N.register( "updatenotification", { + "Updated channel" : "Обновяването е отказано", "Updater" : "Обновяване", - "A new version is available: %s" : "Има Нова Версия: %s" + "A new version is available: %s" : "Има Нова Версия: %s", + "Open updater" : "Отвори обновяването", + "Your version is up to date." : "Вие разполагате с последна версия", + "Update channel:" : "Обновяване отказано:" }, "nplurals=2; plural=(n != 1);"); diff --git a/apps/updatenotification/l10n/bg_BG.json b/apps/updatenotification/l10n/bg_BG.json index 465f8e978ec..7d4b4a5940b 100644 --- a/apps/updatenotification/l10n/bg_BG.json +++ b/apps/updatenotification/l10n/bg_BG.json @@ -1,5 +1,9 @@ { "translations": { + "Updated channel" : "Обновяването е отказано", "Updater" : "Обновяване", - "A new version is available: %s" : "Има Нова Версия: %s" + "A new version is available: %s" : "Има Нова Версия: %s", + "Open updater" : "Отвори обновяването", + "Your version is up to date." : "Вие разполагате с последна версия", + "Update channel:" : "Обновяване отказано:" },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/apps/user_ldap/l10n/cs_CZ.js b/apps/user_ldap/l10n/cs_CZ.js index 0392c27f2b4..7a58411c6e4 100644 --- a/apps/user_ldap/l10n/cs_CZ.js +++ b/apps/user_ldap/l10n/cs_CZ.js @@ -5,7 +5,7 @@ OC.L10N.register( "Failed to delete the server configuration" : "Selhalo smazání nastavení serveru", "The configuration is invalid: anonymous bind is not allowed." : "Tato konfigurace není platná: anonymní bind není povolen.", "The configuration is valid and the connection could be established!" : "Nastavení je v pořádku a spojení bylo navázáno.", - "The configuration is valid, but the Bind failed. Please check the server settings and credentials." : "Konfigurace je v pořádku, ale spojení selhalo. Zkontrolujte, prosím, nastavení serveru a přihlašovací údaje.", + "The configuration is valid, but the Bind failed. Please check the server settings and credentials." : "Konfigurace je v pořádku, ale spojení selhalo. Zkontrolujte prosím nastavení serveru a přihlašovací údaje.", "The configuration is invalid. Please have a look at the logs for further details." : "Konfigurace je neplatná. Pro bližší informace se podívejte do logu.", "No action specified" : "Neurčena žádná akce", "No configuration specified" : "Neurčena žádná konfigurace", @@ -107,7 +107,7 @@ OC.L10N.register( "Expert" : "Expertní", "Advanced" : "Pokročilé", "<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behavior. Please ask your system administrator to disable one of them." : "<b>Varování:</b> Aplikace user_ldap a user_webdavauth jsou vzájemně nekompatibilní. Můžete zaznamenat neočekávané chování. Požádejte prosím svého správce systému o zakázání jedné z nich.", - "<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it." : "<b>Varování:</b> není nainstalován LDAP modul pro PHP, podpůrná vrstva nebude fungovat. Požádejte, prosím, správce systému, aby jej nainstaloval.", + "<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it." : "<b>Varování:</b> není nainstalován LDAP modul pro PHP, podpůrná vrstva nebude fungovat. Požádejte prosím správce systému, aby jej nainstaloval.", "Connection Settings" : "Nastavení spojení", "Configuration Active" : "Nastavení aktivní", "When unchecked, this configuration will be skipped." : "Pokud není zaškrtnuto, bude toto nastavení přeskočeno.", @@ -146,7 +146,7 @@ OC.L10N.register( "Quota Default" : "Výchozí kvóta", "in bytes" : "v bajtech", "Email Field" : "Pole emailu", - "User Home Folder Naming Rule" : "Pravidlo pojmenování domovské složky uživatele", + "User Home Folder Naming Rule" : "Pravidlo pojmenování domovského adresáře uživatele", "Leave empty for user name (default). Otherwise, specify an LDAP/AD attribute." : "Ponechte prázdné pro uživatelské jméno (výchozí). Jinak uveďte LDAP/AD parametr.", "Internal Username" : "Interní uživatelské jméno", "By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. To achieve a similar behavior as before ownCloud 5 enter the user display name attribute in the following field. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users." : "Ve výchozím nastavení bude uživatelské jméno vytvořeno z UUID atributu. To zajistí unikátnost uživatelského jména a není potřeba provádět konverzi znaků. Interní uživatelské jméno je omezeno na znaky: [ a-zA-Z0-9_.@- ]. Ostatní znaky jsou nahrazeny jejich ASCII ekvivalentem nebo jednoduše vynechány. V případě kolize uživatelských jmen bude přidáno/navýšeno číslo. Interní uživatelské jméno je používáno k interní identifikaci uživatele. Je také výchozím názvem uživatelského domovského adresáře. Je také součástí URL pro vzdálený přístup, například všech *DAV služeb. S tímto nastavením může být výchozí chování změněno. Pro dosažení podobného chování jako před ownCloudem 5 uveďte atribut zobrazovaného jména do pole níže. Ponechte prázdné pro výchozí chování. Změna bude mít vliv jen na nově namapované (přidané) uživatele z LDAP.", diff --git a/apps/user_ldap/l10n/cs_CZ.json b/apps/user_ldap/l10n/cs_CZ.json index 4bf061691c2..d8948505050 100644 --- a/apps/user_ldap/l10n/cs_CZ.json +++ b/apps/user_ldap/l10n/cs_CZ.json @@ -3,7 +3,7 @@ "Failed to delete the server configuration" : "Selhalo smazání nastavení serveru", "The configuration is invalid: anonymous bind is not allowed." : "Tato konfigurace není platná: anonymní bind není povolen.", "The configuration is valid and the connection could be established!" : "Nastavení je v pořádku a spojení bylo navázáno.", - "The configuration is valid, but the Bind failed. Please check the server settings and credentials." : "Konfigurace je v pořádku, ale spojení selhalo. Zkontrolujte, prosím, nastavení serveru a přihlašovací údaje.", + "The configuration is valid, but the Bind failed. Please check the server settings and credentials." : "Konfigurace je v pořádku, ale spojení selhalo. Zkontrolujte prosím nastavení serveru a přihlašovací údaje.", "The configuration is invalid. Please have a look at the logs for further details." : "Konfigurace je neplatná. Pro bližší informace se podívejte do logu.", "No action specified" : "Neurčena žádná akce", "No configuration specified" : "Neurčena žádná konfigurace", @@ -105,7 +105,7 @@ "Expert" : "Expertní", "Advanced" : "Pokročilé", "<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behavior. Please ask your system administrator to disable one of them." : "<b>Varování:</b> Aplikace user_ldap a user_webdavauth jsou vzájemně nekompatibilní. Můžete zaznamenat neočekávané chování. Požádejte prosím svého správce systému o zakázání jedné z nich.", - "<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it." : "<b>Varování:</b> není nainstalován LDAP modul pro PHP, podpůrná vrstva nebude fungovat. Požádejte, prosím, správce systému, aby jej nainstaloval.", + "<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it." : "<b>Varování:</b> není nainstalován LDAP modul pro PHP, podpůrná vrstva nebude fungovat. Požádejte prosím správce systému, aby jej nainstaloval.", "Connection Settings" : "Nastavení spojení", "Configuration Active" : "Nastavení aktivní", "When unchecked, this configuration will be skipped." : "Pokud není zaškrtnuto, bude toto nastavení přeskočeno.", @@ -144,7 +144,7 @@ "Quota Default" : "Výchozí kvóta", "in bytes" : "v bajtech", "Email Field" : "Pole emailu", - "User Home Folder Naming Rule" : "Pravidlo pojmenování domovské složky uživatele", + "User Home Folder Naming Rule" : "Pravidlo pojmenování domovského adresáře uživatele", "Leave empty for user name (default). Otherwise, specify an LDAP/AD attribute." : "Ponechte prázdné pro uživatelské jméno (výchozí). Jinak uveďte LDAP/AD parametr.", "Internal Username" : "Interní uživatelské jméno", "By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [ a-zA-Z0-9_.@- ]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all *DAV services. With this setting, the default behavior can be overridden. To achieve a similar behavior as before ownCloud 5 enter the user display name attribute in the following field. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users." : "Ve výchozím nastavení bude uživatelské jméno vytvořeno z UUID atributu. To zajistí unikátnost uživatelského jména a není potřeba provádět konverzi znaků. Interní uživatelské jméno je omezeno na znaky: [ a-zA-Z0-9_.@- ]. Ostatní znaky jsou nahrazeny jejich ASCII ekvivalentem nebo jednoduše vynechány. V případě kolize uživatelských jmen bude přidáno/navýšeno číslo. Interní uživatelské jméno je používáno k interní identifikaci uživatele. Je také výchozím názvem uživatelského domovského adresáře. Je také součástí URL pro vzdálený přístup, například všech *DAV služeb. S tímto nastavením může být výchozí chování změněno. Pro dosažení podobného chování jako před ownCloudem 5 uveďte atribut zobrazovaného jména do pole níže. Ponechte prázdné pro výchozí chování. Změna bude mít vliv jen na nově namapované (přidané) uživatele z LDAP.", diff --git a/apps/user_ldap/l10n/ro.js b/apps/user_ldap/l10n/ro.js index 292deb7ec63..dc0b56edcfd 100644 --- a/apps/user_ldap/l10n/ro.js +++ b/apps/user_ldap/l10n/ro.js @@ -3,51 +3,81 @@ OC.L10N.register( { "Failed to clear the mappings." : "Ștergerea mapărilor a eșuat.", "Failed to delete the server configuration" : "Ștergerea configurației serverului a eșuat.", - "The configuration is valid and the connection could be established!" : "Configuraţia este valida şi s-a stabilit conectarea", - "No action specified" : "Nu este specificata nici o acţiune ", - "No configuration specified" : "Nu este specificata nici o configurare ", - "No data specified" : "Nici o dată specificată", + "The configuration is valid and the connection could be established!" : "Configurația este validă și conexiunea a putut fi stabilită!", + "No action specified" : "Nu este specificată nicio acțiune ", + "No configuration specified" : "Nu este specificată nicio configurație", + "No data specified" : "Nu au fost specificate date", " Could not set configuration %s" : "Nu a putut fi setată configurația %s", "Action does not exist" : "Acțiunea nu există", + "The Base DN appears to be wrong" : "DN-ul de bază pare a fi greșit", "Testing configuration…" : "Se testează configurația...", - "Configuration incorrect" : "Configuraţie incorecta ", - "Configuration incomplete" : "Configuraţie incompleta ", - "Configuration OK" : "Configuraţie valida", - "Select groups" : "Selectaţi grupuri ", - "Do you really want to delete the current Server Configuration?" : "Sunteţi sigur ca vreţi sa ştergeţi configuraţia actuala a serverului ?", - "Confirm Deletion" : "Confirmaţi Ştergerea ", + "Configuration incorrect" : "Configurație incorectă", + "Configuration incomplete" : "Configurație incompletă", + "Configuration OK" : "Configurație validă", + "Select groups" : "Selectează grupuri ", + "Select object classes" : "Selectează clase de obiecte", + "Please check the credentials, they seem to be wrong." : "Verifică datele de autentificare, ele par a fi greșite.", + "Please specify the port, it could not be auto-detected." : "Specifică portul, nu a putut fi detectat automat.", + "Base DN could not be auto-detected, please revise credentials, host and port." : "DN-ul de bază nu a putut fi detectat automat, te rugăm revizuiește datele de autentificare, gazda și portul.", + "Could not detect Base DN, please enter it manually." : "DN-ul de bază nu a putut fi detectat, introdu-l manual.", + "{nthServer}. Server" : "{nthServer}. Server", + "More than 1,000 directory entries available." : "Mai mult de 1000 de directoare disponibile.", + "Do you really want to delete the current Server Configuration?" : "Sigur vrei să ștergi configurația curentă a serverului?", + "Confirm Deletion" : "Confirmă ștergerea", + "Mappings cleared successfully!" : "Asocierile au fost șterse!", + "Error while clearing the mappings." : "Eroare la ștergerea asocierilor.", "Select attributes" : "Selectaţi caracteristici", "_%s group found_::_%s groups found_" : ["%s grup găsit.","%s grupuri găsite.","%s grupuri găsite."], "_%s user found_::_%s users found_" : ["%s utilizator găsit.","%s utilizatori găsiți.","%s utilizatori găsiți."], + "Could not find the desired feature" : "Nu s-a putut găsi funcționalitatea dorită.", "Invalid Host" : "Host invalid", "Server" : "Server", "Users" : "Utilizatori", + "Login Attributes" : "Atribute de autentificare", "Groups" : "Grupuri", "Test Configuration" : "Configurare test", "Help" : "Ajutor", + "Available groups" : "Grupuri disponibile", + "Selected groups" : "Grupurile selectate", + "LDAP Filter:" : "Filtru LDAP:", "Other Attributes:" : "Alte caracteristici :", + "Verify settings" : "Verifică setările", + "1. Server" : "1. Server", + "%s. Server:" : "%s. Server:", + "Add a new and blank configuration" : "Adaugă o configurație nouă goală", + "Delete the current configuration" : "Șterge configurația curentă", "Host" : "Gazdă", "You can omit the protocol, except you require SSL. Then start with ldaps://" : "Puteți omite protocolul, decât dacă folosiți SSL. Atunci se începe cu ldaps://", "Port" : "Portul", - "User DN" : "DN al utilizatorului", - "The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty." : "DN-ul clientului utilizator cu care se va efectua conectarea, d.e. uid=agent,dc=example,dc=com. Pentru acces anonim, lăsăți DN și Parolă libere.", + "Detect Port" : "Detectează portul", + "User DN" : "DN-ul utilizatorului", + "The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty." : "DN-ul utilizatorului cu care se va efectua asocierea, de exemplu uid=agent,dc=example,dc=com. Pentru acces anonim, lasă DN-ul și parola libere.", "Password" : "Parolă", - "For anonymous access, leave DN and Password empty." : "Pentru acces anonim, lăsați DN și Parolă libere.", - "One Base DN per line" : "Un Base DN pe linie", - "You can specify Base DN for users and groups in the Advanced tab" : "Puteți să specificați DN de bază pentru utilizatori și grupuri în fila Avansat", + "For anonymous access, leave DN and Password empty." : "Pentru acces anonim, lasă DN-ul și parola libere.", + "One Base DN per line" : "Un DN de bază pe linie", + "You can specify Base DN for users and groups in the Advanced tab" : "Poți specifica DN-ul de bază pentru utilizatori și grupuri în fila Avansat", + "Detect Base DN" : "Detectează DN-ul de bază", + "Test Base DN" : "Testează DN-ul de bază", + "Avoids automatic LDAP requests. Better for bigger setups, but requires some LDAP knowledge." : "Evită solicitările LDAP automate. De preferat pentru instalările mai complexe, dar necesită câteva cunoștințe LDAP.", + "Manually enter LDAP filters (recommended for large directories)" : "Introdu filtrele LDAP manual (recomandat pentru medii LDAP largi)", + "Verify settings and count users" : "Verifică setările și numără utilizatorii", + "Saving" : "Se salvează", "Back" : "Înapoi", "Continue" : "Continuă", + "LDAP" : "LDAP", + "Expert" : "Expert", "Advanced" : "Avansat", "<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it." : "<b>Atenție</b> Modulul PHP LDAP nu este instalat, infrastructura nu va funcționa. Contactează administratorul sistemului pentru al instala.", "Connection Settings" : "Setările de conexiune", - "Configuration Active" : "Configuraţie activa ", + "Configuration Active" : "Configurație activă", + "When unchecked, this configuration will be skipped." : "Dacă este debifat, se va sări peste această configurație.", "Disable Main Server" : "Dezactivaţi serverul principal", "Turn off SSL certificate validation." : "Oprește validarea certificatelor SSL ", "in seconds. A change empties the cache." : "în secunde. O schimbare curăță memoria tampon.", "Directory Settings" : "Setările directorului", "User Display Name Field" : "Câmpul cu numele vizibil al utilizatorului", - "Base User Tree" : "Arborele de bază al Utilizatorilor", - "One User Base DN per line" : "Un User Base DN pe linie", + "Base User Tree" : "Arborele de bază al utilizatorilor", + "One User Base DN per line" : "Un DN utilizator de bază pe linie", "Group Display Name Field" : "Câmpul cu numele grupului", "Base Group Tree" : "Arborele de bază al Grupurilor", "One Group Base DN per line" : "Un Group Base DN pe linie", diff --git a/apps/user_ldap/l10n/ro.json b/apps/user_ldap/l10n/ro.json index 1992542fd88..80f0c5752e9 100644 --- a/apps/user_ldap/l10n/ro.json +++ b/apps/user_ldap/l10n/ro.json @@ -1,51 +1,81 @@ { "translations": { "Failed to clear the mappings." : "Ștergerea mapărilor a eșuat.", "Failed to delete the server configuration" : "Ștergerea configurației serverului a eșuat.", - "The configuration is valid and the connection could be established!" : "Configuraţia este valida şi s-a stabilit conectarea", - "No action specified" : "Nu este specificata nici o acţiune ", - "No configuration specified" : "Nu este specificata nici o configurare ", - "No data specified" : "Nici o dată specificată", + "The configuration is valid and the connection could be established!" : "Configurația este validă și conexiunea a putut fi stabilită!", + "No action specified" : "Nu este specificată nicio acțiune ", + "No configuration specified" : "Nu este specificată nicio configurație", + "No data specified" : "Nu au fost specificate date", " Could not set configuration %s" : "Nu a putut fi setată configurația %s", "Action does not exist" : "Acțiunea nu există", + "The Base DN appears to be wrong" : "DN-ul de bază pare a fi greșit", "Testing configuration…" : "Se testează configurația...", - "Configuration incorrect" : "Configuraţie incorecta ", - "Configuration incomplete" : "Configuraţie incompleta ", - "Configuration OK" : "Configuraţie valida", - "Select groups" : "Selectaţi grupuri ", - "Do you really want to delete the current Server Configuration?" : "Sunteţi sigur ca vreţi sa ştergeţi configuraţia actuala a serverului ?", - "Confirm Deletion" : "Confirmaţi Ştergerea ", + "Configuration incorrect" : "Configurație incorectă", + "Configuration incomplete" : "Configurație incompletă", + "Configuration OK" : "Configurație validă", + "Select groups" : "Selectează grupuri ", + "Select object classes" : "Selectează clase de obiecte", + "Please check the credentials, they seem to be wrong." : "Verifică datele de autentificare, ele par a fi greșite.", + "Please specify the port, it could not be auto-detected." : "Specifică portul, nu a putut fi detectat automat.", + "Base DN could not be auto-detected, please revise credentials, host and port." : "DN-ul de bază nu a putut fi detectat automat, te rugăm revizuiește datele de autentificare, gazda și portul.", + "Could not detect Base DN, please enter it manually." : "DN-ul de bază nu a putut fi detectat, introdu-l manual.", + "{nthServer}. Server" : "{nthServer}. Server", + "More than 1,000 directory entries available." : "Mai mult de 1000 de directoare disponibile.", + "Do you really want to delete the current Server Configuration?" : "Sigur vrei să ștergi configurația curentă a serverului?", + "Confirm Deletion" : "Confirmă ștergerea", + "Mappings cleared successfully!" : "Asocierile au fost șterse!", + "Error while clearing the mappings." : "Eroare la ștergerea asocierilor.", "Select attributes" : "Selectaţi caracteristici", "_%s group found_::_%s groups found_" : ["%s grup găsit.","%s grupuri găsite.","%s grupuri găsite."], "_%s user found_::_%s users found_" : ["%s utilizator găsit.","%s utilizatori găsiți.","%s utilizatori găsiți."], + "Could not find the desired feature" : "Nu s-a putut găsi funcționalitatea dorită.", "Invalid Host" : "Host invalid", "Server" : "Server", "Users" : "Utilizatori", + "Login Attributes" : "Atribute de autentificare", "Groups" : "Grupuri", "Test Configuration" : "Configurare test", "Help" : "Ajutor", + "Available groups" : "Grupuri disponibile", + "Selected groups" : "Grupurile selectate", + "LDAP Filter:" : "Filtru LDAP:", "Other Attributes:" : "Alte caracteristici :", + "Verify settings" : "Verifică setările", + "1. Server" : "1. Server", + "%s. Server:" : "%s. Server:", + "Add a new and blank configuration" : "Adaugă o configurație nouă goală", + "Delete the current configuration" : "Șterge configurația curentă", "Host" : "Gazdă", "You can omit the protocol, except you require SSL. Then start with ldaps://" : "Puteți omite protocolul, decât dacă folosiți SSL. Atunci se începe cu ldaps://", "Port" : "Portul", - "User DN" : "DN al utilizatorului", - "The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty." : "DN-ul clientului utilizator cu care se va efectua conectarea, d.e. uid=agent,dc=example,dc=com. Pentru acces anonim, lăsăți DN și Parolă libere.", + "Detect Port" : "Detectează portul", + "User DN" : "DN-ul utilizatorului", + "The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty." : "DN-ul utilizatorului cu care se va efectua asocierea, de exemplu uid=agent,dc=example,dc=com. Pentru acces anonim, lasă DN-ul și parola libere.", "Password" : "Parolă", - "For anonymous access, leave DN and Password empty." : "Pentru acces anonim, lăsați DN și Parolă libere.", - "One Base DN per line" : "Un Base DN pe linie", - "You can specify Base DN for users and groups in the Advanced tab" : "Puteți să specificați DN de bază pentru utilizatori și grupuri în fila Avansat", + "For anonymous access, leave DN and Password empty." : "Pentru acces anonim, lasă DN-ul și parola libere.", + "One Base DN per line" : "Un DN de bază pe linie", + "You can specify Base DN for users and groups in the Advanced tab" : "Poți specifica DN-ul de bază pentru utilizatori și grupuri în fila Avansat", + "Detect Base DN" : "Detectează DN-ul de bază", + "Test Base DN" : "Testează DN-ul de bază", + "Avoids automatic LDAP requests. Better for bigger setups, but requires some LDAP knowledge." : "Evită solicitările LDAP automate. De preferat pentru instalările mai complexe, dar necesită câteva cunoștințe LDAP.", + "Manually enter LDAP filters (recommended for large directories)" : "Introdu filtrele LDAP manual (recomandat pentru medii LDAP largi)", + "Verify settings and count users" : "Verifică setările și numără utilizatorii", + "Saving" : "Se salvează", "Back" : "Înapoi", "Continue" : "Continuă", + "LDAP" : "LDAP", + "Expert" : "Expert", "Advanced" : "Avansat", "<b>Warning:</b> The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it." : "<b>Atenție</b> Modulul PHP LDAP nu este instalat, infrastructura nu va funcționa. Contactează administratorul sistemului pentru al instala.", "Connection Settings" : "Setările de conexiune", - "Configuration Active" : "Configuraţie activa ", + "Configuration Active" : "Configurație activă", + "When unchecked, this configuration will be skipped." : "Dacă este debifat, se va sări peste această configurație.", "Disable Main Server" : "Dezactivaţi serverul principal", "Turn off SSL certificate validation." : "Oprește validarea certificatelor SSL ", "in seconds. A change empties the cache." : "în secunde. O schimbare curăță memoria tampon.", "Directory Settings" : "Setările directorului", "User Display Name Field" : "Câmpul cu numele vizibil al utilizatorului", - "Base User Tree" : "Arborele de bază al Utilizatorilor", - "One User Base DN per line" : "Un User Base DN pe linie", + "Base User Tree" : "Arborele de bază al utilizatorilor", + "One User Base DN per line" : "Un DN utilizator de bază pe linie", "Group Display Name Field" : "Câmpul cu numele grupului", "Base Group Tree" : "Arborele de bază al Grupurilor", "One Group Base DN per line" : "Un Group Base DN pe linie", diff --git a/build/integration/features/bootstrap/TagsContext.php b/build/integration/features/bootstrap/TagsContext.php index 10d0b9ae545..882f5d9e13a 100644 --- a/build/integration/features/bootstrap/TagsContext.php +++ b/build/integration/features/bootstrap/TagsContext.php @@ -97,28 +97,36 @@ class TagsContext implements \Behat\Behat\Context\Context { } /** - * @When :user creates a :type tag with name :name * @param string $user * @param string $type * @param string $name - * @throws \Exception + * @param string $groups */ - public function createsATagWithName($user, $type, $name) { - $userVisible = 'true'; - $userAssignable = 'true'; + private function createTag($user, $type, $name, $groups = null) { + $userVisible = true; + $userAssignable = true; switch ($type) { case 'normal': break; case 'not user-assignable': - $userAssignable = 'false'; + $userAssignable = false; break; case 'not user-visible': - $userVisible = 'false'; + $userVisible = false; break; default: throw new \Exception('Unsupported type'); } + $body = [ + 'name' => $name, + 'userVisible' => $userVisible, + 'userAssignable' => $userAssignable, + ]; + if ($groups !== null) { + $body['groups'] = $groups; + } + try { $this->response = $this->client->post( $this->baseUrl . '/remote.php/dav/systemtags/', @@ -130,15 +138,38 @@ class TagsContext implements \Behat\Behat\Context\Context { 'headers' => [ 'Content-Type' => 'application/json', ], - 'body' => '{"name":"'.$name.'","userVisible":'.$userVisible.',"userAssignable":'.$userAssignable.'}', + 'body' => json_encode($body) ] ); - } catch (\GuzzleHttp\Exception\ClientException $e){ + } catch (\GuzzleHttp\Exception\ClientException $e) { $this->response = $e->getResponse(); } } /** + * @When :user creates a :type tag with name :name + * @param string $user + * @param string $type + * @param string $name + * @throws \Exception + */ + public function createsATagWithName($user, $type, $name) { + $this->createTag($user, $type, $name); + } + + /** + * @When :user creates a :type tag with name :name and groups :groups + * @param string $user + * @param string $type + * @param string $name + * @param string $groups + * @throws \Exception + */ + public function createsATagWithNameAndGroups($user, $type, $name, $groups) { + $this->createTag($user, $type, $name, $groups); + } + + /** * @Then The response should have a status code :statusCode * @param int $statusCode * @throws \Exception @@ -155,21 +186,30 @@ class TagsContext implements \Behat\Behat\Context\Context { * @param string $user * @return array */ - private function requestTagsForUser($user) { + private function requestTagsForUser($user, $withGroups = false) { try { - $request = $this->client->createRequest( - 'PROPFIND', - $this->baseUrl . '/remote.php/dav/systemtags/', - [ - 'body' => '<?xml version="1.0"?> + $body = '<?xml version="1.0"?> <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"> <d:prop> <oc:id /> <oc:display-name /> <oc:user-visible /> - <oc:user-assignable /> + <oc:user-assignable /> + <oc:can-assign /> +'; + + if ($withGroups) { + $body .= '<oc:groups />'; + } + + $body .= ' </d:prop> -</d:propfind>', +</d:propfind>'; + $request = $this->client->createRequest( + 'PROPFIND', + $this->baseUrl . '/remote.php/dav/systemtags/', + [ + 'body' => $body, 'auth' => [ $user, $this->getPasswordForUser($user), @@ -193,11 +233,16 @@ class TagsContext implements \Behat\Behat\Context\Context { continue; } + // FIXME: use actual property names instead of guessing index position $tags[$singleEntry[0]['value']] = [ 'display-name' => $singleEntry[1]['value'], 'user-visible' => $singleEntry[2]['value'], 'user-assignable' => $singleEntry[3]['value'], + 'can-assign' => $singleEntry[4]['value'], ]; + if (isset($singleEntry[5])) { + $tags[$singleEntry[0]['value']]['groups'] = $singleEntry[5]['value']; + } } return $tags; @@ -239,6 +284,42 @@ class TagsContext implements \Behat\Behat\Context\Context { } /** + * @Then the user :user :can assign The :type tag with name :tagName + */ + public function theUserCanAssignTheTag($user, $can, $type, $tagName) { + $foundTag = $this->findTag($type, $tagName, $user); + if ($foundTag === null) { + throw new \Exception('No matching tag found'); + } + + if ($can === 'can') { + $expected = 'true'; + } else if ($can === 'cannot') { + $expected = 'false'; + } else { + throw new \Exception('Invalid condition, must be "can" or "cannot"'); + } + + if ($foundTag['can-assign'] !== $expected) { + throw new \Exception('Tag cannot be assigned by user'); + } + } + + /** + * @Then The :type tag with name :tagName has the groups :groups + */ + public function theTagHasGroup($type, $tagName, $groups) { + $foundTag = $this->findTag($type, $tagName, 'admin', true); + if ($foundTag === null) { + throw new \Exception('No matching tag found'); + } + + if ($foundTag['groups'] !== $groups) { + throw new \Exception('Tag has groups "' . $foundTag['group'] . '" instead of the expected "' . $groups . '"'); + } + } + + /** * @Then :count tags should exist for :user * @param int $count * @param string $user @@ -251,6 +332,45 @@ class TagsContext implements \Behat\Behat\Context\Context { } /** + * Find tag by type and name + * + * @param string $type tag type + * @param string $tagName tag name + * @param string $user retrieved from which user + * @param bool $withGroups whether to also query the tag's groups + * + * @return array tag values or null if not found + */ + private function findTag($type, $tagName, $user = 'admin', $withGroups = false) { + $tags = $this->requestTagsForUser($user, $withGroups); + $userAssignable = 'true'; + $userVisible = 'true'; + switch ($type) { + case 'normal': + break; + case 'not user-assignable': + $userAssignable = 'false'; + break; + case 'not user-visible': + $userVisible = 'false'; + break; + default: + throw new \Exception('Unsupported type'); + } + + $foundTag = null; + foreach ($tags as $tag) { + if ($tag['display-name'] === $tagName + && $tag['user-visible'] === $userVisible + && $tag['user-assignable'] === $userAssignable) { + $foundTag = $tag; + break; + } + } + return $foundTag; + } + + /** * @param string $name * @return int */ @@ -305,6 +425,44 @@ class TagsContext implements \Behat\Behat\Context\Context { } /** + * @When :user edits the tag with name :oldNmae and sets its groups to :groups + * @param string $user + * @param string $oldName + * @param string $groups + * @throws \Exception + */ + public function editsTheTagWithNameAndSetsItsGroupsTo($user, $oldName, $groups) { + $tagId = $this->findTagIdByName($oldName); + if($tagId === 0) { + throw new \Exception('Could not find tag to rename'); + } + + try { + $request = $this->client->createRequest( + 'PROPPATCH', + $this->baseUrl . '/remote.php/dav/systemtags/' . $tagId, + [ + 'body' => '<?xml version="1.0"?> +<d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"> + <d:set> + <d:prop> + <oc:groups>' . $groups . '</oc:groups> + </d:prop> + </d:set> +</d:propertyupdate>', + 'auth' => [ + $user, + $this->getPasswordForUser($user), + ], + ] + ); + $this->response = $this->client->send($request); + } catch (\GuzzleHttp\Exception\ClientException $e) { + $this->response = $e->getResponse(); + } + } + + /** * @When :user deletes the tag with name :name * @param string $user * @param string $name diff --git a/build/integration/features/tags.feature b/build/integration/features/tags.feature index 286fb62bf42..d793c0d3c61 100644 --- a/build/integration/features/tags.feature +++ b/build/integration/features/tags.feature @@ -21,6 +21,18 @@ Feature: tags Then The response should have a status code "400" And "0" tags should exist for "admin" + Scenario: Creating a not user-assignable tag with groups as admin should work + Given user "user0" exists + When "admin" creates a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2" + Then The response should have a status code "201" + And The "not user-assignable" tag with name "TagWithGroups" has the groups "group1|group2" + + Scenario: Creating a normal tag with groups as regular user should fail + Given user "user0" exists + When "user0" creates a "normal" tag with name "MySuperAwesomeTagName" and groups "group1|group2" + Then The response should have a status code "400" + And "0" tags should exist for "user0" + Scenario: Renaming a normal tag as regular user should work Given user "user0" exists Given "admin" creates a "normal" tag with name "MySuperAwesomeTagName" @@ -45,6 +57,19 @@ Feature: tags And The following tags should exist for "admin" |MySuperAwesomeTagName|false|true| + Scenario: Editing tag groups as admin should work + Given user "user0" exists + Given "admin" creates a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2" + When "admin" edits the tag with name "TagWithGroups" and sets its groups to "group1|group3" + Then The response should have a status code "207" + And The "not user-assignable" tag with name "TagWithGroups" has the groups "group1|group3" + + Scenario: Editing tag groups as regular user should fail + Given user "user0" exists + Given "admin" creates a "not user-assignable" tag with name "TagWithGroups" + When "user0" edits the tag with name "TagWithGroups" and sets its groups to "group1|group3" + Then The response should have a status code "403" + Scenario: Deleting a normal tag as regular user should work Given user "user0" exists Given "admin" creates a "normal" tag with name "MySuperAwesomeTagName" @@ -122,6 +147,23 @@ Feature: tags And "/myFileToTag.txt" shared by "user0" has the following tags |MyFirstTag| + Scenario: Assigning a not user-assignable tag to a file shared by someone else as regular user belongs to tag's groups should work + Given user "user0" exists + Given user "user1" exists + Given group "group1" exists + Given user "user1" belongs to group "group1" + Given "admin" creates a "not user-assignable" tag with name "MySuperAwesomeTagName" and groups "group1" + Given user "user0" uploads file "data/textfile.txt" to "/myFileToTag.txt" + Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with + | path | myFileToTag.txt | + | shareWith | user1 | + | shareType | 0 | + When "user1" adds the tag "MySuperAwesomeTagName" to "/myFileToTag.txt" shared by "user0" + Then The response should have a status code "201" + And "/myFileToTag.txt" shared by "user0" has the following tags + |MySuperAwesomeTagName| + + Scenario: Assigning a not user-visible tag to a file shared by someone else as regular user should fail Given user "user0" exists Given user "user1" exists @@ -368,3 +410,18 @@ Feature: tags And "/myFileToTag.txt" shared by "user0" has the following tags for "user1" || And The response should have a status code "404" + + Scenario: User can assign tags when in the tag's groups + Given user "user0" exists + Given group "group1" exists + Given user "user0" belongs to group "group1" + When "admin" creates a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2" + Then The response should have a status code "201" + And the user "user0" can assign the "not user-assignable" tag with name "TagWithGroups" + + Scenario: User cannot assign tags when not in the tag's groups + Given user "user0" exists + When "admin" creates a "not user-assignable" tag with name "TagWithGroups" and groups "group1|group2" + Then The response should have a status code "201" + And the user "user0" cannot assign the "not user-assignable" tag with name "TagWithGroups" + diff --git a/build/jsdocs9.tar.bz2 b/build/jsdocs9.tar.bz2 Binary files differnew file mode 100644 index 00000000000..dfab675733d --- /dev/null +++ b/build/jsdocs9.tar.bz2 diff --git a/config/config.sample.php b/config/config.sample.php index a2bc8e4343c..f3c1845c5c2 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -615,17 +615,6 @@ $CONFIG = array( 'cron_log' => true, /** - * Location of the lock file for cron executions can be specified here. - * Default is within the tmp directory. The file is named in the following way: - * owncloud-server-$INSTANCEID-cron.lock - * where $INSTANCEID is the string specified in the ``instanceid`` field. - * Because the cron lock file is accessed at regular intervals, it may prevent - * enabled disk drives from spinning down. A different location for this file - * can solve such issues. - */ -'cron.lockfile.location' => '', - -/** * Enables log rotation and limits the total size of logfiles. The default is 0, * or no rotation. Specify a size in bytes, for example 104857600 (100 megabytes * = 100 * 1024 * 1024 bytes). A new logfile is created with a new name when the diff --git a/core/js/systemtags/systemtagmodel.js b/core/js/systemtags/systemtagmodel.js index b41fbdde61e..89728357e25 100644 --- a/core/js/systemtags/systemtagmodel.js +++ b/core/js/systemtags/systemtagmodel.js @@ -23,14 +23,17 @@ defaults: { userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }, davProperties: { 'id': '{' + NS_OWNCLOUD + '}id', 'name': '{' + NS_OWNCLOUD + '}display-name', 'userVisible': '{' + NS_OWNCLOUD + '}user-visible', - 'userAssignable': '{' + NS_OWNCLOUD + '}user-assignable' + 'userAssignable': '{' + NS_OWNCLOUD + '}user-assignable', + // read-only, effective permissions computed by the server, + 'canAssign': '{' + NS_OWNCLOUD + '}can-assign' }, parse: function(data) { @@ -38,7 +41,8 @@ id: data.id, name: data.name, userVisible: data.userVisible === true || data.userVisible === 'true', - userAssignable: data.userAssignable === true || data.userAssignable === 'true' + userAssignable: data.userAssignable === true || data.userAssignable === 'true', + canAssign: data.canAssign === true || data.canAssign === 'true' }; } }); diff --git a/core/js/systemtags/systemtags.js b/core/js/systemtags/systemtags.js index 042f49bb8ed..05ead6f3dcd 100644 --- a/core/js/systemtags/systemtags.js +++ b/core/js/systemtags/systemtags.js @@ -36,7 +36,7 @@ var scope; if (!tag.userAssignable) { - scope = t('core', 'not assignable'); + scope = t('core', 'restricted'); } if (!tag.userVisible) { // invisible also implicitly means not assignable diff --git a/core/js/systemtags/systemtagsinputfield.js b/core/js/systemtags/systemtagsinputfield.js index 45dc5b7b03e..2eb8d0a44cb 100644 --- a/core/js/systemtags/systemtagsinputfield.js +++ b/core/js/systemtags/systemtagsinputfield.js @@ -206,7 +206,8 @@ tag = this.collection.create({ name: e.object.name.trim(), userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }, { success: function(model) { self._addToSelect2Selection(model.toJSON()); @@ -263,7 +264,7 @@ var tagModels = collection.filterByName(query.term.trim()); if (!self._isAdmin) { tagModels = _.filter(tagModels, function(tagModel) { - return tagModel.get('userAssignable'); + return tagModel.get('canAssign'); }); } query.callback({ @@ -331,6 +332,7 @@ name: term, userAssignable: true, userVisible: true, + canAssign: true, isNew: true }; } else { @@ -346,7 +348,7 @@ function modelToSelection(model) { var data = model.toJSON(); - if (!self._isAdmin && !data.userAssignable) { + if (!self._isAdmin && !data.canAssign) { // lock static tags for non-admins data.locked = true; } diff --git a/core/js/tests/specs/systemtags/systemtagsSpec.js b/core/js/tests/specs/systemtags/systemtagsSpec.js index 515b75258a0..f6d99e62a3c 100644 --- a/core/js/tests/specs/systemtags/systemtagsSpec.js +++ b/core/js/tests/specs/systemtags/systemtagsSpec.js @@ -64,6 +64,6 @@ describe('OC.SystemTags tests', function() { testScope(true, true, 'Fourty Two'); testScope(false, true, 'Fourty Two (invisible)'); testScope(false, false, 'Fourty Two (invisible)'); - testScope(true, false, 'Fourty Two (not assignable)'); + testScope(true, false, 'Fourty Two (restricted)'); }); }); diff --git a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js index 22bf0d2c82a..503bef7cf2b 100644 --- a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js +++ b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js @@ -68,7 +68,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { view.collection.add([ new OC.SystemTags.SystemTagModel({id: '1', name: 'abc'}), new OC.SystemTags.SystemTagModel({id: '2', name: 'def'}), - new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false}), + new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false, canAssign: false}), ]); }); it('does not create dummy tag when user types non-matching name', function() { @@ -84,6 +84,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { expect(result.isNew).toEqual(true); expect(result.userVisible).toEqual(true); expect(result.userAssignable).toEqual(true); + expect(result.canAssign).toEqual(true); }); it('creates dummy tag when user types non-matching name even with prefix of existing tag', function() { var opts = select2Stub.getCall(0).args[0]; @@ -93,6 +94,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { expect(result.isNew).toEqual(true); expect(result.userVisible).toEqual(true); expect(result.userAssignable).toEqual(true); + expect(result.canAssign).toEqual(true); }); it('creates the real tag and fires select event after user selects the dummy tag', function() { var selectHandler = sinon.stub(); @@ -110,14 +112,16 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { expect(createStub.getCall(0).args[0]).toEqual({ name: 'newname', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }); var newModel = new OC.SystemTags.SystemTagModel({ id: '123', name: 'newname', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }); // not called yet @@ -186,7 +190,8 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { expect(createStub.getCall(0).args[0]).toEqual({ name: 'newname', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }); var newModel = new OC.SystemTags.SystemTagModel({ @@ -320,7 +325,8 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { testTags = [ new OC.SystemTags.SystemTagModel({id: '1', name: 'test1'}), new OC.SystemTags.SystemTagModel({id: '2', name: 'test2'}), - new OC.SystemTags.SystemTagModel({id: '3', name: 'test3', userAssignable: false}), + new OC.SystemTags.SystemTagModel({id: '3', name: 'test3', userAssignable: false, canAssign: false}), + new OC.SystemTags.SystemTagModel({id: '4', name: 'test4', userAssignable: false, canAssign: true}) ]; }); afterEach(function() { @@ -328,7 +334,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { }); it('grabs values from the full collection', function() { var $el = view.$el.find('input'); - $el.val('1,3'); + $el.val('1,3,4'); var opts = select2Stub.getCall(0).args[0]; var callback = sinon.stub(); opts.initSelection($el, callback); @@ -339,11 +345,16 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { expect(callback.calledOnce).toEqual(true); var models = callback.getCall(0).args[0]; - expect(models.length).toEqual(2); + expect(models.length).toEqual(3); expect(models[0].id).toEqual('1'); expect(models[0].name).toEqual('test1'); + expect(models[0].locked).toBeFalsy(); expect(models[1].id).toEqual('3'); expect(models[1].name).toEqual('test3'); + expect(models[1].locked).toBeFalsy(); + expect(models[2].id).toEqual('4'); + expect(models[2].name).toEqual('test4'); + expect(models[2].locked).toBeFalsy(); }); }); describe('autocomplete', function() { @@ -356,7 +367,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { view.collection.add([ new OC.SystemTags.SystemTagModel({id: '1', name: 'abc'}), new OC.SystemTags.SystemTagModel({id: '2', name: 'def'}), - new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false}), + new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false, canAssign: false}), new OC.SystemTags.SystemTagModel({id: '4', name: 'Deg'}), ]); }); @@ -379,13 +390,15 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { id: '1', name: 'abc', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }, { id: '3', name: 'abd', userVisible: true, - userAssignable: false + userAssignable: false, + canAssign: false } ]); }); @@ -405,13 +418,15 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { id: '2', name: 'def', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }, { id: '4', name: 'Deg', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true } ]); }); @@ -445,7 +460,8 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { testTags = [ new OC.SystemTags.SystemTagModel({id: '1', name: 'test1'}), new OC.SystemTags.SystemTagModel({id: '2', name: 'test2'}), - new OC.SystemTags.SystemTagModel({id: '3', name: 'test3', userAssignable: false}), + new OC.SystemTags.SystemTagModel({id: '3', name: 'test3', userAssignable: false, canAssign: false}), + new OC.SystemTags.SystemTagModel({id: '4', name: 'test4', userAssignable: false, canAssign: true}) ]; view.render(); }); @@ -454,7 +470,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { }); it('grabs values from the full collection', function() { var $el = view.$el.find('input'); - $el.val('1,3'); + $el.val('1,3,4'); var opts = select2Stub.getCall(0).args[0]; var callback = sinon.stub(); opts.initSelection($el, callback); @@ -465,11 +481,17 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { expect(callback.calledOnce).toEqual(true); var models = callback.getCall(0).args[0]; - expect(models.length).toEqual(2); + expect(models.length).toEqual(3); expect(models[0].id).toEqual('1'); expect(models[0].name).toEqual('test1'); + expect(models[0].locked).toBeFalsy(); expect(models[1].id).toEqual('3'); expect(models[1].name).toEqual('test3'); + // restricted / cannot assign locks the entry + expect(models[1].locked).toEqual(true); + expect(models[2].id).toEqual('4'); + expect(models[2].name).toEqual('test4'); + expect(models[2].locked).toBeFalsy(); }); }); describe('autocomplete', function() { @@ -483,8 +505,9 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { view.collection.add([ new OC.SystemTags.SystemTagModel({id: '1', name: 'abc'}), new OC.SystemTags.SystemTagModel({id: '2', name: 'def'}), - new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false}), + new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false, canAssign: false}), new OC.SystemTags.SystemTagModel({id: '4', name: 'Deg'}), + new OC.SystemTags.SystemTagModel({id: '5', name: 'abe', userAssignable: false, canAssign: true}) ]); }); afterEach(function() { @@ -506,7 +529,15 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { id: '1', name: 'abc', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true + }, + { + id: '5', + name: 'abe', + userVisible: true, + userAssignable: false, + canAssign: true } ]); }); @@ -526,13 +557,15 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { id: '2', name: 'def', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true }, { id: '4', name: 'Deg', userVisible: true, - userAssignable: true + userAssignable: true, + canAssign: true } ]); }); diff --git a/core/l10n/ar.js b/core/l10n/ar.js index 4a7e4f059f1..1f855a6baf9 100644 --- a/core/l10n/ar.js +++ b/core/l10n/ar.js @@ -5,6 +5,7 @@ OC.L10N.register( "Unknown filetype" : "نوع الملف غير معروف", "Invalid image" : "الصورة غير صالحة", "%s password reset" : "تمت إعادة ضبط كلمة مرور %s", + "Error deleting tag(s)" : "خطأ أثناء حذف العلامة (العلامات)", "Updated database" : "قاعدة بيانات المرفوعات", "Sunday" : "الأحد", "Monday" : "الأثنين", diff --git a/core/l10n/ar.json b/core/l10n/ar.json index e92d5ef8c30..c3b1f18a74d 100644 --- a/core/l10n/ar.json +++ b/core/l10n/ar.json @@ -3,6 +3,7 @@ "Unknown filetype" : "نوع الملف غير معروف", "Invalid image" : "الصورة غير صالحة", "%s password reset" : "تمت إعادة ضبط كلمة مرور %s", + "Error deleting tag(s)" : "خطأ أثناء حذف العلامة (العلامات)", "Updated database" : "قاعدة بيانات المرفوعات", "Sunday" : "الأحد", "Monday" : "الأثنين", diff --git a/core/l10n/cs_CZ.js b/core/l10n/cs_CZ.js index a3638a471f9..3da51c98c02 100644 --- a/core/l10n/cs_CZ.js +++ b/core/l10n/cs_CZ.js @@ -102,7 +102,7 @@ OC.L10N.register( "Saving..." : "Ukládám...", "Dismiss" : "Zamítnout", "seconds ago" : "před pár sekundami", - "The link to reset your password has been sent to your email. If you do not receive it within a reasonable amount of time, check your spam/junk folders.<br>If it is not there ask your local administrator." : "Odkaz na obnovení hesla byl odeslán na vaši emailovou adresu. Pokud jej v krátké době neobdržíte, zkontrolujte složku nevyžádané pošty a koš.<br>Pokud jej nenaleznete, kontaktujte svého správce systému.", + "The link to reset your password has been sent to your email. If you do not receive it within a reasonable amount of time, check your spam/junk folders.<br>If it is not there ask your local administrator." : "Odkaz na obnovení hesla byl odeslán na vaši emailovou adresu. Pokud jej v krátké době neobdržíte, zkontrolujte nevyžádanou poštu a koš.<br>Pokud jej nenaleznete, kontaktujte svého správce systému.", "Your files are encrypted. If you haven't enabled the recovery key, there will be no way to get your data back after your password is reset.<br />If you are not sure what to do, please contact your administrator before you continue. <br />Do you really want to continue?" : "Vaše soubory jsou šifrovány. Pokud jste nepovolili klíč pro obnovení, neexistuje způsob jak získat po změně hesla vaše data zpět.<br />Pokud si nejste jisti co dělat, kontaktujte nejprve svého správce systému, než budete pokračovat. <br />Opravdu si přejete pokračovat?", "I know what I'm doing" : "Vím co dělám", "Password can not be changed. Please contact your administrator." : "Heslo nelze změnit. Kontaktujte prosím svého správce systému.", @@ -195,7 +195,7 @@ OC.L10N.register( "Warning" : "Varování", "Error while sending notification" : "Chyba při odesílání upozornění", "Non-existing tag #{tag}" : "Neexistující tag #{tag}", - "not assignable" : "nepřiřaditelný", + "restricted" : "omezeno", "invisible" : "neviditelný", "({scope})" : "({scope})", "Delete" : "Smazat", @@ -256,7 +256,7 @@ OC.L10N.register( "Create an <strong>admin account</strong>" : "Vytvořit <strong>účet správce</strong>", "Username" : "Uživatelské jméno", "Storage & database" : "Úložiště & databáze", - "Data folder" : "Složka s daty", + "Data folder" : "Adresář s daty", "Configure the database" : "Nastavit databázi", "Only %s is available." : "Pouze %s je dostupný.", "Install and activate additional PHP modules to choose other database types." : "Pro výběr jiných typů databáze je třeba nainstalovat a povolit dodatečné PHP moduly.", @@ -282,7 +282,7 @@ OC.L10N.register( "Please contact your administrator." : "Kontaktujte prosím svého správce systému.", "An internal error occurred." : "Nastala vnitřní chyba.", "Please try again or contact your administrator." : "Prosím zkuste to znovu nebo kontaktujte vašeho správce.", - "Username or email" : "Uživatelské jméno nebo e-mail", + "Username or email" : "Uživatelské jméno nebo email", "Log in" : "Přihlásit", "Wrong password. Reset it?" : "Nesprávné heslo. Resetovat?", "Wrong password." : "Chybné heslo.", diff --git a/core/l10n/cs_CZ.json b/core/l10n/cs_CZ.json index 4cab502d7c4..e802b6fbb89 100644 --- a/core/l10n/cs_CZ.json +++ b/core/l10n/cs_CZ.json @@ -100,7 +100,7 @@ "Saving..." : "Ukládám...", "Dismiss" : "Zamítnout", "seconds ago" : "před pár sekundami", - "The link to reset your password has been sent to your email. If you do not receive it within a reasonable amount of time, check your spam/junk folders.<br>If it is not there ask your local administrator." : "Odkaz na obnovení hesla byl odeslán na vaši emailovou adresu. Pokud jej v krátké době neobdržíte, zkontrolujte složku nevyžádané pošty a koš.<br>Pokud jej nenaleznete, kontaktujte svého správce systému.", + "The link to reset your password has been sent to your email. If you do not receive it within a reasonable amount of time, check your spam/junk folders.<br>If it is not there ask your local administrator." : "Odkaz na obnovení hesla byl odeslán na vaši emailovou adresu. Pokud jej v krátké době neobdržíte, zkontrolujte nevyžádanou poštu a koš.<br>Pokud jej nenaleznete, kontaktujte svého správce systému.", "Your files are encrypted. If you haven't enabled the recovery key, there will be no way to get your data back after your password is reset.<br />If you are not sure what to do, please contact your administrator before you continue. <br />Do you really want to continue?" : "Vaše soubory jsou šifrovány. Pokud jste nepovolili klíč pro obnovení, neexistuje způsob jak získat po změně hesla vaše data zpět.<br />Pokud si nejste jisti co dělat, kontaktujte nejprve svého správce systému, než budete pokračovat. <br />Opravdu si přejete pokračovat?", "I know what I'm doing" : "Vím co dělám", "Password can not be changed. Please contact your administrator." : "Heslo nelze změnit. Kontaktujte prosím svého správce systému.", @@ -193,7 +193,7 @@ "Warning" : "Varování", "Error while sending notification" : "Chyba při odesílání upozornění", "Non-existing tag #{tag}" : "Neexistující tag #{tag}", - "not assignable" : "nepřiřaditelný", + "restricted" : "omezeno", "invisible" : "neviditelný", "({scope})" : "({scope})", "Delete" : "Smazat", @@ -254,7 +254,7 @@ "Create an <strong>admin account</strong>" : "Vytvořit <strong>účet správce</strong>", "Username" : "Uživatelské jméno", "Storage & database" : "Úložiště & databáze", - "Data folder" : "Složka s daty", + "Data folder" : "Adresář s daty", "Configure the database" : "Nastavit databázi", "Only %s is available." : "Pouze %s je dostupný.", "Install and activate additional PHP modules to choose other database types." : "Pro výběr jiných typů databáze je třeba nainstalovat a povolit dodatečné PHP moduly.", @@ -280,7 +280,7 @@ "Please contact your administrator." : "Kontaktujte prosím svého správce systému.", "An internal error occurred." : "Nastala vnitřní chyba.", "Please try again or contact your administrator." : "Prosím zkuste to znovu nebo kontaktujte vašeho správce.", - "Username or email" : "Uživatelské jméno nebo e-mail", + "Username or email" : "Uživatelské jméno nebo email", "Log in" : "Přihlásit", "Wrong password. Reset it?" : "Nesprávné heslo. Resetovat?", "Wrong password." : "Chybné heslo.", diff --git a/core/l10n/de.js b/core/l10n/de.js index e17910f6450..47f0a8df89d 100644 --- a/core/l10n/de.js +++ b/core/l10n/de.js @@ -195,7 +195,7 @@ OC.L10N.register( "Warning" : "Warnung", "Error while sending notification" : "Fehler beim Senden der Benachrichtigung", "Non-existing tag #{tag}" : "Nicht vorhandener Tag #{tag}", - "not assignable" : "nicht übertragbar", + "restricted" : "Eingeschränkt", "invisible" : "unsichtbar", "({scope})" : "({scope})", "Delete" : "Löschen", diff --git a/core/l10n/de.json b/core/l10n/de.json index 1a9acc8b653..81411d4a095 100644 --- a/core/l10n/de.json +++ b/core/l10n/de.json @@ -193,7 +193,7 @@ "Warning" : "Warnung", "Error while sending notification" : "Fehler beim Senden der Benachrichtigung", "Non-existing tag #{tag}" : "Nicht vorhandener Tag #{tag}", - "not assignable" : "nicht übertragbar", + "restricted" : "Eingeschränkt", "invisible" : "unsichtbar", "({scope})" : "({scope})", "Delete" : "Löschen", diff --git a/core/l10n/de_AT.js b/core/l10n/de_AT.js index 56c0d291a24..229bb06ff94 100644 --- a/core/l10n/de_AT.js +++ b/core/l10n/de_AT.js @@ -192,7 +192,6 @@ OC.L10N.register( "Warning" : "Warnung", "Error while sending notification" : "Fehler beim Senden der Benachrichtigung", "Non-existing tag #{tag}" : "Nicht vorhandener Tag #{tag}", - "not assignable" : "nicht übertragbar", "invisible" : "unsichtbar", "({scope})" : "({scope})", "Delete" : "Löschen", diff --git a/core/l10n/de_AT.json b/core/l10n/de_AT.json index 47d82d36af8..d799ff265f5 100644 --- a/core/l10n/de_AT.json +++ b/core/l10n/de_AT.json @@ -190,7 +190,6 @@ "Warning" : "Warnung", "Error while sending notification" : "Fehler beim Senden der Benachrichtigung", "Non-existing tag #{tag}" : "Nicht vorhandener Tag #{tag}", - "not assignable" : "nicht übertragbar", "invisible" : "unsichtbar", "({scope})" : "({scope})", "Delete" : "Löschen", diff --git a/core/l10n/de_DE.js b/core/l10n/de_DE.js index e84e581fc2a..16584c6f503 100644 --- a/core/l10n/de_DE.js +++ b/core/l10n/de_DE.js @@ -195,7 +195,7 @@ OC.L10N.register( "Warning" : "Warnung", "Error while sending notification" : "Fehler beim Senden der Benachrichtigung", "Non-existing tag #{tag}" : "Nicht existierender Tag #{tag}", - "not assignable" : "nicht zuweisbar", + "restricted" : "Eingeschränkt", "invisible" : "unsichtbar", "({scope})" : "({scope})", "Delete" : "Löschen", diff --git a/core/l10n/de_DE.json b/core/l10n/de_DE.json index 27b9d6df0bf..7b449e7c055 100644 --- a/core/l10n/de_DE.json +++ b/core/l10n/de_DE.json @@ -193,7 +193,7 @@ "Warning" : "Warnung", "Error while sending notification" : "Fehler beim Senden der Benachrichtigung", "Non-existing tag #{tag}" : "Nicht existierender Tag #{tag}", - "not assignable" : "nicht zuweisbar", + "restricted" : "Eingeschränkt", "invisible" : "unsichtbar", "({scope})" : "({scope})", "Delete" : "Löschen", diff --git a/core/l10n/en_GB.js b/core/l10n/en_GB.js index 946006f0633..0e89143886d 100644 --- a/core/l10n/en_GB.js +++ b/core/l10n/en_GB.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Warning", "Error while sending notification" : "Error whilst sending notification", "Non-existing tag #{tag}" : "Non-existing tag #{tag}", - "not assignable" : "not assignable", "invisible" : "invisible", "({scope})" : "({scope})", "Delete" : "Delete", diff --git a/core/l10n/en_GB.json b/core/l10n/en_GB.json index 4e63ab9e28a..9c062d7b392 100644 --- a/core/l10n/en_GB.json +++ b/core/l10n/en_GB.json @@ -193,7 +193,6 @@ "Warning" : "Warning", "Error while sending notification" : "Error whilst sending notification", "Non-existing tag #{tag}" : "Non-existing tag #{tag}", - "not assignable" : "not assignable", "invisible" : "invisible", "({scope})" : "({scope})", "Delete" : "Delete", diff --git a/core/l10n/eo.js b/core/l10n/eo.js index 45ee7db15bf..f9383d713fb 100644 --- a/core/l10n/eo.js +++ b/core/l10n/eo.js @@ -134,7 +134,6 @@ OC.L10N.register( "Warning" : "Averto", "Error while sending notification" : "Eraris sendo de sciigo", "Non-existing tag #{tag}" : "Ne ekzistas etikedo #{tag}", - "not assignable" : "neatribuebla", "invisible" : "nevidebla", "({scope})" : "({scope})", "Delete" : "Forigi", diff --git a/core/l10n/eo.json b/core/l10n/eo.json index fafe6301225..b65deb9a15a 100644 --- a/core/l10n/eo.json +++ b/core/l10n/eo.json @@ -132,7 +132,6 @@ "Warning" : "Averto", "Error while sending notification" : "Eraris sendo de sciigo", "Non-existing tag #{tag}" : "Ne ekzistas etikedo #{tag}", - "not assignable" : "neatribuebla", "invisible" : "nevidebla", "({scope})" : "({scope})", "Delete" : "Forigi", diff --git a/core/l10n/es.js b/core/l10n/es.js index cbfda7179c9..aede6c81656 100644 --- a/core/l10n/es.js +++ b/core/l10n/es.js @@ -195,7 +195,7 @@ OC.L10N.register( "Warning" : "Precaución", "Error while sending notification" : "Error mientras se enviaba la notificación", "Non-existing tag #{tag}" : "Categoría #{tag} no existente", - "not assignable" : "no asignable", + "restricted" : "Restringido", "invisible" : "invisible", "({scope})" : "({scope})", "Delete" : "Eliminar", diff --git a/core/l10n/es.json b/core/l10n/es.json index a50b095f411..d74b0fa0b53 100644 --- a/core/l10n/es.json +++ b/core/l10n/es.json @@ -193,7 +193,7 @@ "Warning" : "Precaución", "Error while sending notification" : "Error mientras se enviaba la notificación", "Non-existing tag #{tag}" : "Categoría #{tag} no existente", - "not assignable" : "no asignable", + "restricted" : "Restringido", "invisible" : "invisible", "({scope})" : "({scope})", "Delete" : "Eliminar", diff --git a/core/l10n/et_EE.js b/core/l10n/et_EE.js index db1b37b4b72..8ed6c99f237 100644 --- a/core/l10n/et_EE.js +++ b/core/l10n/et_EE.js @@ -156,7 +156,6 @@ OC.L10N.register( "Share" : "Jaga", "Warning" : "Hoiatus", "Error while sending notification" : "Tõrge teavituse saatmisel", - "not assignable" : "pole määratav", "invisible" : "nähtamatu", "({scope})" : "({scope})", "Delete" : "Kustuta", diff --git a/core/l10n/et_EE.json b/core/l10n/et_EE.json index d12627727da..2c69f262315 100644 --- a/core/l10n/et_EE.json +++ b/core/l10n/et_EE.json @@ -154,7 +154,6 @@ "Share" : "Jaga", "Warning" : "Hoiatus", "Error while sending notification" : "Tõrge teavituse saatmisel", - "not assignable" : "pole määratav", "invisible" : "nähtamatu", "({scope})" : "({scope})", "Delete" : "Kustuta", diff --git a/core/l10n/fi_FI.js b/core/l10n/fi_FI.js index d769faf04d0..30d5bd2ec40 100644 --- a/core/l10n/fi_FI.js +++ b/core/l10n/fi_FI.js @@ -187,7 +187,6 @@ OC.L10N.register( "Warning" : "Varoitus", "Error while sending notification" : "Virhe ilmoitusta lähettäessä", "Non-existing tag #{tag}" : "Ei olemassa oleva tunniste #{tag}", - "not assignable" : "ei määritettävissä", "invisible" : "näkymätön", "({scope})" : "({scope})", "Delete" : "Poista", diff --git a/core/l10n/fi_FI.json b/core/l10n/fi_FI.json index e5de89e3258..bf8764a202d 100644 --- a/core/l10n/fi_FI.json +++ b/core/l10n/fi_FI.json @@ -185,7 +185,6 @@ "Warning" : "Varoitus", "Error while sending notification" : "Virhe ilmoitusta lähettäessä", "Non-existing tag #{tag}" : "Ei olemassa oleva tunniste #{tag}", - "not assignable" : "ei määritettävissä", "invisible" : "näkymätön", "({scope})" : "({scope})", "Delete" : "Poista", diff --git a/core/l10n/fr.js b/core/l10n/fr.js index 8f74eecc035..7b7f62ffb7c 100644 --- a/core/l10n/fr.js +++ b/core/l10n/fr.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Attention", "Error while sending notification" : "Erreur lors de l'envoi de la notification", "Non-existing tag #{tag}" : "Étiquette #{tag} inexistante", - "not assignable" : "inassignable", "invisible" : "invisible", "({scope})" : "({scope})", "Delete" : "Supprimer", diff --git a/core/l10n/fr.json b/core/l10n/fr.json index 09b2928e964..278af3f913a 100644 --- a/core/l10n/fr.json +++ b/core/l10n/fr.json @@ -193,7 +193,6 @@ "Warning" : "Attention", "Error while sending notification" : "Erreur lors de l'envoi de la notification", "Non-existing tag #{tag}" : "Étiquette #{tag} inexistante", - "not assignable" : "inassignable", "invisible" : "invisible", "({scope})" : "({scope})", "Delete" : "Supprimer", diff --git a/core/l10n/he.js b/core/l10n/he.js index 8cc184fad17..217dfe8cc0b 100644 --- a/core/l10n/he.js +++ b/core/l10n/he.js @@ -181,7 +181,6 @@ OC.L10N.register( "Warning" : "אזהרה", "Error while sending notification" : "שגיאה בזמן שליחת הודעה", "Non-existing tag #{tag}" : "תגית לא קיימת #{tag}", - "not assignable" : "לא ניתן להקצאה", "invisible" : "בלתי גלוי", "({scope})" : "({scope})", "Delete" : "מחיקה", diff --git a/core/l10n/he.json b/core/l10n/he.json index 1ebaff05d53..60bd0a33ca9 100644 --- a/core/l10n/he.json +++ b/core/l10n/he.json @@ -179,7 +179,6 @@ "Warning" : "אזהרה", "Error while sending notification" : "שגיאה בזמן שליחת הודעה", "Non-existing tag #{tag}" : "תגית לא קיימת #{tag}", - "not assignable" : "לא ניתן להקצאה", "invisible" : "בלתי גלוי", "({scope})" : "({scope})", "Delete" : "מחיקה", diff --git a/core/l10n/hu_HU.js b/core/l10n/hu_HU.js index a838ef07c07..3bf38c15eb7 100644 --- a/core/l10n/hu_HU.js +++ b/core/l10n/hu_HU.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Figyelmeztetés", "Error while sending notification" : "Hiba történt az értesítő küldése közben", "Non-existing tag #{tag}" : "Nem létező címke #{tag}", - "not assignable" : "nem hozzárendelhető", "invisible" : "láthatatlan", "({scope})" : "({scope})", "Delete" : "Törlés", diff --git a/core/l10n/hu_HU.json b/core/l10n/hu_HU.json index 40c18689e4a..83d7fd157d5 100644 --- a/core/l10n/hu_HU.json +++ b/core/l10n/hu_HU.json @@ -193,7 +193,6 @@ "Warning" : "Figyelmeztetés", "Error while sending notification" : "Hiba történt az értesítő küldése közben", "Non-existing tag #{tag}" : "Nem létező címke #{tag}", - "not assignable" : "nem hozzárendelhető", "invisible" : "láthatatlan", "({scope})" : "({scope})", "Delete" : "Törlés", diff --git a/core/l10n/is.js b/core/l10n/is.js index d26d49863da..4d840d81c3f 100644 --- a/core/l10n/is.js +++ b/core/l10n/is.js @@ -181,7 +181,6 @@ OC.L10N.register( "Warning" : "Aðvörun", "Error while sending notification" : "Villa við að senda tilkynningu", "Non-existing tag #{tag}" : "Merki sem er ekki til #{tag}", - "not assignable" : "ekki úthlutanlegt", "invisible" : "ósýnilegt", "({scope})" : "({scope})", "Delete" : "Eyða", diff --git a/core/l10n/is.json b/core/l10n/is.json index 9c0a541e1cc..b19e8e87c2e 100644 --- a/core/l10n/is.json +++ b/core/l10n/is.json @@ -179,7 +179,6 @@ "Warning" : "Aðvörun", "Error while sending notification" : "Villa við að senda tilkynningu", "Non-existing tag #{tag}" : "Merki sem er ekki til #{tag}", - "not assignable" : "ekki úthlutanlegt", "invisible" : "ósýnilegt", "({scope})" : "({scope})", "Delete" : "Eyða", diff --git a/core/l10n/it.js b/core/l10n/it.js index 86b6cd71c14..289a60ad11b 100644 --- a/core/l10n/it.js +++ b/core/l10n/it.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Avviso", "Error while sending notification" : "Errore durante l'invio della notifica", "Non-existing tag #{tag}" : "Etichetta #{tag} inesistente", - "not assignable" : "non assegnabile", "invisible" : "invisibile", "({scope})" : "({scope})", "Delete" : "Elimina", diff --git a/core/l10n/it.json b/core/l10n/it.json index fc5a1abb743..37c536a514b 100644 --- a/core/l10n/it.json +++ b/core/l10n/it.json @@ -193,7 +193,6 @@ "Warning" : "Avviso", "Error while sending notification" : "Errore durante l'invio della notifica", "Non-existing tag #{tag}" : "Etichetta #{tag} inesistente", - "not assignable" : "non assegnabile", "invisible" : "invisibile", "({scope})" : "({scope})", "Delete" : "Elimina", diff --git a/core/l10n/ja.js b/core/l10n/ja.js index d23c7a83b83..397a417eb9d 100644 --- a/core/l10n/ja.js +++ b/core/l10n/ja.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "警告", "Error while sending notification" : "通知送信中にエラーが発生", "Non-existing tag #{tag}" : "存在しないタグ#{tag}", - "not assignable" : "割り当てできない", "invisible" : "不可視", "({scope})" : "({scope})", "Delete" : "削除", diff --git a/core/l10n/ja.json b/core/l10n/ja.json index fae13987a67..11c88968ee2 100644 --- a/core/l10n/ja.json +++ b/core/l10n/ja.json @@ -193,7 +193,6 @@ "Warning" : "警告", "Error while sending notification" : "通知送信中にエラーが発生", "Non-existing tag #{tag}" : "存在しないタグ#{tag}", - "not assignable" : "割り当てできない", "invisible" : "不可視", "({scope})" : "({scope})", "Delete" : "削除", diff --git a/core/l10n/ko.js b/core/l10n/ko.js index 3899a4d0596..396ba18f6b1 100644 --- a/core/l10n/ko.js +++ b/core/l10n/ko.js @@ -176,7 +176,6 @@ OC.L10N.register( "Warning" : "경고", "Error while sending notification" : "알림을 보내는 중 오류 발생", "Non-existing tag #{tag}" : "존재하지 않는 태그 #{tag}", - "not assignable" : "할당할 수 없음", "invisible" : "보이지 않음", "({scope})" : "({scope})", "Delete" : "삭제", diff --git a/core/l10n/ko.json b/core/l10n/ko.json index 156ec364864..6562827894d 100644 --- a/core/l10n/ko.json +++ b/core/l10n/ko.json @@ -174,7 +174,6 @@ "Warning" : "경고", "Error while sending notification" : "알림을 보내는 중 오류 발생", "Non-existing tag #{tag}" : "존재하지 않는 태그 #{tag}", - "not assignable" : "할당할 수 없음", "invisible" : "보이지 않음", "({scope})" : "({scope})", "Delete" : "삭제", diff --git a/core/l10n/lv.js b/core/l10n/lv.js index 71fa7f8ce40..a3ff72b4d0d 100644 --- a/core/l10n/lv.js +++ b/core/l10n/lv.js @@ -69,7 +69,7 @@ OC.L10N.register( "Error while sharing" : "Kļūda, daloties", "Error while unsharing" : "Kļūda, beidzot dalīties", "Error setting expiration date" : "Kļūda, iestatot termiņa datumu", - "Set expiration date" : "Iestaties termiņa datumu", + "Set expiration date" : "Iestatiet termiņa datumu", "Expiration date" : "Termiņa datums", "Resharing is not allowed" : "Atkārtota dalīšanās nav atļauta", "Share link" : "Dalīt saiti", diff --git a/core/l10n/lv.json b/core/l10n/lv.json index f6befe4ba84..7bace2eff80 100644 --- a/core/l10n/lv.json +++ b/core/l10n/lv.json @@ -67,7 +67,7 @@ "Error while sharing" : "Kļūda, daloties", "Error while unsharing" : "Kļūda, beidzot dalīties", "Error setting expiration date" : "Kļūda, iestatot termiņa datumu", - "Set expiration date" : "Iestaties termiņa datumu", + "Set expiration date" : "Iestatiet termiņa datumu", "Expiration date" : "Termiņa datums", "Resharing is not allowed" : "Atkārtota dalīšanās nav atļauta", "Share link" : "Dalīt saiti", diff --git a/core/l10n/mk.js b/core/l10n/mk.js index c897c3b0dba..8984638f161 100644 --- a/core/l10n/mk.js +++ b/core/l10n/mk.js @@ -146,7 +146,6 @@ OC.L10N.register( "access control" : "контрола на пристап", "Share" : "Сподели", "Warning" : "Предупредување", - "not assignable" : "не може да се додаде", "invisible" : "невидлив", "Delete" : "Избриши", "Rename" : "Преименувај", diff --git a/core/l10n/mk.json b/core/l10n/mk.json index 26946706940..b7b234b72be 100644 --- a/core/l10n/mk.json +++ b/core/l10n/mk.json @@ -144,7 +144,6 @@ "access control" : "контрола на пристап", "Share" : "Сподели", "Warning" : "Предупредување", - "not assignable" : "не може да се додаде", "invisible" : "невидлив", "Delete" : "Избриши", "Rename" : "Преименувај", diff --git a/core/l10n/nb_NO.js b/core/l10n/nb_NO.js index c3ab3985d47..f98af93b7d4 100644 --- a/core/l10n/nb_NO.js +++ b/core/l10n/nb_NO.js @@ -176,7 +176,6 @@ OC.L10N.register( "Warning" : "Advarsel", "Error while sending notification" : "Feil ved sending av varsling", "Non-existing tag #{tag}" : "Ikke-eksisterende merkelapp #{tag}", - "not assignable" : "kan ikke tilordnes", "invisible" : "usynlig", "({scope})" : "({scope})", "Delete" : "Slett", diff --git a/core/l10n/nb_NO.json b/core/l10n/nb_NO.json index a10ab106140..d5616e66949 100644 --- a/core/l10n/nb_NO.json +++ b/core/l10n/nb_NO.json @@ -174,7 +174,6 @@ "Warning" : "Advarsel", "Error while sending notification" : "Feil ved sending av varsling", "Non-existing tag #{tag}" : "Ikke-eksisterende merkelapp #{tag}", - "not assignable" : "kan ikke tilordnes", "invisible" : "usynlig", "({scope})" : "({scope})", "Delete" : "Slett", diff --git a/core/l10n/nl.js b/core/l10n/nl.js index fc191d0bb78..e7ab738e3ee 100644 --- a/core/l10n/nl.js +++ b/core/l10n/nl.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Waarschuwing", "Error while sending notification" : "Fout bij versturen melding", "Non-existing tag #{tag}" : "Niet bestaande tag #{tag}", - "not assignable" : "niet toewijsbaar", "invisible" : "onzichtbaar", "({scope})" : "({scope})", "Delete" : "Verwijder", diff --git a/core/l10n/nl.json b/core/l10n/nl.json index f27bbfa39c7..270cf9e471f 100644 --- a/core/l10n/nl.json +++ b/core/l10n/nl.json @@ -193,7 +193,6 @@ "Warning" : "Waarschuwing", "Error while sending notification" : "Fout bij versturen melding", "Non-existing tag #{tag}" : "Niet bestaande tag #{tag}", - "not assignable" : "niet toewijsbaar", "invisible" : "onzichtbaar", "({scope})" : "({scope})", "Delete" : "Verwijder", diff --git a/core/l10n/pt_BR.js b/core/l10n/pt_BR.js index fc1905654b7..24aa8eaf64c 100644 --- a/core/l10n/pt_BR.js +++ b/core/l10n/pt_BR.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Aviso", "Error while sending notification" : "Erro ao enviar notificação", "Non-existing tag #{tag}" : "Etiqueta não existente #{tag}", - "not assignable" : "não atribuível", "invisible" : "invisível", "({scope})" : "({scope})", "Delete" : "Eliminar", diff --git a/core/l10n/pt_BR.json b/core/l10n/pt_BR.json index 078b8a579fb..e49c3e61eb1 100644 --- a/core/l10n/pt_BR.json +++ b/core/l10n/pt_BR.json @@ -193,7 +193,6 @@ "Warning" : "Aviso", "Error while sending notification" : "Erro ao enviar notificação", "Non-existing tag #{tag}" : "Etiqueta não existente #{tag}", - "not assignable" : "não atribuível", "invisible" : "invisível", "({scope})" : "({scope})", "Delete" : "Eliminar", diff --git a/core/l10n/pt_PT.js b/core/l10n/pt_PT.js index 0ef81e1443d..df62ba1e39c 100644 --- a/core/l10n/pt_PT.js +++ b/core/l10n/pt_PT.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Aviso", "Error while sending notification" : "Erro enquanto estava a enviar a notificação", "Non-existing tag #{tag}" : "Etiqueta não existente #{tag}", - "not assignable" : "não atribuível", "invisible" : "invisível", "({scope})" : "({scope})", "Delete" : "Apagar", diff --git a/core/l10n/pt_PT.json b/core/l10n/pt_PT.json index bb81f640523..43961003d05 100644 --- a/core/l10n/pt_PT.json +++ b/core/l10n/pt_PT.json @@ -193,7 +193,6 @@ "Warning" : "Aviso", "Error while sending notification" : "Erro enquanto estava a enviar a notificação", "Non-existing tag #{tag}" : "Etiqueta não existente #{tag}", - "not assignable" : "não atribuível", "invisible" : "invisível", "({scope})" : "({scope})", "Delete" : "Apagar", diff --git a/core/l10n/ro.js b/core/l10n/ro.js index 156763ed6ae..7b4cf2c8957 100644 --- a/core/l10n/ro.js +++ b/core/l10n/ro.js @@ -161,6 +161,7 @@ OC.L10N.register( "Access forbidden" : "Acces restricționat", "File not found" : "Fișierul nu a fost găsit", "The share will expire on %s." : "Partajarea va expira în data de %s.", + "Cheers!" : "Noroc!", "Technical details" : "Detalii tehnice", "Type: %s" : "Tip: %s", "Code: %s" : "Cod: %s", diff --git a/core/l10n/ro.json b/core/l10n/ro.json index c2245791fa5..cea43ae3142 100644 --- a/core/l10n/ro.json +++ b/core/l10n/ro.json @@ -159,6 +159,7 @@ "Access forbidden" : "Acces restricționat", "File not found" : "Fișierul nu a fost găsit", "The share will expire on %s." : "Partajarea va expira în data de %s.", + "Cheers!" : "Noroc!", "Technical details" : "Detalii tehnice", "Type: %s" : "Tip: %s", "Code: %s" : "Cod: %s", diff --git a/core/l10n/ru.js b/core/l10n/ru.js index ae7c85e1934..5848c6264a3 100644 --- a/core/l10n/ru.js +++ b/core/l10n/ru.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Предупреждение", "Error while sending notification" : "Ошибка при отправке уведомления", "Non-existing tag #{tag}" : "Несуществующий тег #{tag}", - "not assignable" : "не назначаемый", "invisible" : "невидимый", "({scope})" : "({scope})", "Delete" : "Удалить", diff --git a/core/l10n/ru.json b/core/l10n/ru.json index 1ff9b934478..39e28b0dc0d 100644 --- a/core/l10n/ru.json +++ b/core/l10n/ru.json @@ -193,7 +193,6 @@ "Warning" : "Предупреждение", "Error while sending notification" : "Ошибка при отправке уведомления", "Non-existing tag #{tag}" : "Несуществующий тег #{tag}", - "not assignable" : "не назначаемый", "invisible" : "невидимый", "({scope})" : "({scope})", "Delete" : "Удалить", diff --git a/core/l10n/sl.js b/core/l10n/sl.js index a5628c91bf0..0e105dec45e 100644 --- a/core/l10n/sl.js +++ b/core/l10n/sl.js @@ -192,7 +192,6 @@ OC.L10N.register( "Warning" : "Opozorilo", "Error while sending notification" : "Napaka med pošiljanjem obvestila", "Non-existing tag #{tag}" : "Neobstoječa oznaka #{tag}", - "not assignable" : "ni dodeljivo", "invisible" : "nevidno", "({scope})" : "({scope})", "Delete" : "Izbriši", diff --git a/core/l10n/sl.json b/core/l10n/sl.json index 022027d6156..495cef55eab 100644 --- a/core/l10n/sl.json +++ b/core/l10n/sl.json @@ -190,7 +190,6 @@ "Warning" : "Opozorilo", "Error while sending notification" : "Napaka med pošiljanjem obvestila", "Non-existing tag #{tag}" : "Neobstoječa oznaka #{tag}", - "not assignable" : "ni dodeljivo", "invisible" : "nevidno", "({scope})" : "({scope})", "Delete" : "Izbriši", diff --git a/core/l10n/sq.js b/core/l10n/sq.js index 32f8fe8a89f..a2da0643f0e 100644 --- a/core/l10n/sq.js +++ b/core/l10n/sq.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Kujdes", "Error while sending notification" : "Gabim gjatë dërgimit të njoftimit", "Non-existing tag #{tag}" : "Etiketë #{tag} që s’ekziston", - "not assignable" : "e pacaktueshme", "invisible" : "e padukshme", "({scope})" : "({scope})", "Delete" : "Fshije", diff --git a/core/l10n/sq.json b/core/l10n/sq.json index f6d3012ae62..03faca27d8b 100644 --- a/core/l10n/sq.json +++ b/core/l10n/sq.json @@ -193,7 +193,6 @@ "Warning" : "Kujdes", "Error while sending notification" : "Gabim gjatë dërgimit të njoftimit", "Non-existing tag #{tag}" : "Etiketë #{tag} që s’ekziston", - "not assignable" : "e pacaktueshme", "invisible" : "e padukshme", "({scope})" : "({scope})", "Delete" : "Fshije", diff --git a/core/l10n/sv.js b/core/l10n/sv.js index 6e2447decbb..cd271687695 100644 --- a/core/l10n/sv.js +++ b/core/l10n/sv.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "Varning", "Error while sending notification" : "Fel när notifikation skulle skickas", "Non-existing tag #{tag}" : "Icke-existerande tag #{tag}", - "not assignable" : "Ej tilldelningsbar", "invisible" : "osynlig", "({scope})" : "({scope})", "Delete" : "Radera", diff --git a/core/l10n/sv.json b/core/l10n/sv.json index 8490beddf50..c15bac55c1e 100644 --- a/core/l10n/sv.json +++ b/core/l10n/sv.json @@ -193,7 +193,6 @@ "Warning" : "Varning", "Error while sending notification" : "Fel när notifikation skulle skickas", "Non-existing tag #{tag}" : "Icke-existerande tag #{tag}", - "not assignable" : "Ej tilldelningsbar", "invisible" : "osynlig", "({scope})" : "({scope})", "Delete" : "Radera", diff --git a/core/l10n/th_TH.js b/core/l10n/th_TH.js index c6157dc8556..019a2cf7290 100644 --- a/core/l10n/th_TH.js +++ b/core/l10n/th_TH.js @@ -180,7 +180,6 @@ OC.L10N.register( "Warning" : "คำเตือน", "Error while sending notification" : "เกิดข้อผิดพลาดขณะกำลังส่งการแจ้งเตือน", "Non-existing tag #{tag}" : "ไม่มีแท็กนี้อยู่ #{tag}", - "not assignable" : "ไม่ได้รับมอบหมาย", "invisible" : "จะมองไม่เห็น", "({scope})" : "({scope})", "Delete" : "ลบ", diff --git a/core/l10n/th_TH.json b/core/l10n/th_TH.json index a9fe8615b8c..f33e83bc934 100644 --- a/core/l10n/th_TH.json +++ b/core/l10n/th_TH.json @@ -178,7 +178,6 @@ "Warning" : "คำเตือน", "Error while sending notification" : "เกิดข้อผิดพลาดขณะกำลังส่งการแจ้งเตือน", "Non-existing tag #{tag}" : "ไม่มีแท็กนี้อยู่ #{tag}", - "not assignable" : "ไม่ได้รับมอบหมาย", "invisible" : "จะมองไม่เห็น", "({scope})" : "({scope})", "Delete" : "ลบ", diff --git a/core/l10n/tr.js b/core/l10n/tr.js index 9eb73d52b5d..3aef2c006d3 100644 --- a/core/l10n/tr.js +++ b/core/l10n/tr.js @@ -181,7 +181,6 @@ OC.L10N.register( "Warning" : "Uyarı", "Error while sending notification" : "Bildirim gönderilirken hata", "Non-existing tag #{tag}" : "Mevcut olmayan etiket #{tag}", - "not assignable" : "atanamaz", "invisible" : "görünmez", "({scope})" : "({scope})", "Delete" : "Sil", diff --git a/core/l10n/tr.json b/core/l10n/tr.json index 957fabc770a..b27488088e7 100644 --- a/core/l10n/tr.json +++ b/core/l10n/tr.json @@ -179,7 +179,6 @@ "Warning" : "Uyarı", "Error while sending notification" : "Bildirim gönderilirken hata", "Non-existing tag #{tag}" : "Mevcut olmayan etiket #{tag}", - "not assignable" : "atanamaz", "invisible" : "görünmez", "({scope})" : "({scope})", "Delete" : "Sil", diff --git a/core/l10n/zh_CN.js b/core/l10n/zh_CN.js index 841593a8e86..9f3a5544996 100644 --- a/core/l10n/zh_CN.js +++ b/core/l10n/zh_CN.js @@ -195,7 +195,6 @@ OC.L10N.register( "Warning" : "警告", "Error while sending notification" : "发送通知时出现错误", "Non-existing tag #{tag}" : "标签 #{tag} 不存在", - "not assignable" : "不可分配", "invisible" : "不可见", "({scope})" : "({scope})", "Delete" : "删除", diff --git a/core/l10n/zh_CN.json b/core/l10n/zh_CN.json index 9474967a4ce..a8b39e0d377 100644 --- a/core/l10n/zh_CN.json +++ b/core/l10n/zh_CN.json @@ -193,7 +193,6 @@ "Warning" : "警告", "Error while sending notification" : "发送通知时出现错误", "Non-existing tag #{tag}" : "标签 #{tag} 不存在", - "not assignable" : "不可分配", "invisible" : "不可见", "({scope})" : "({scope})", "Delete" : "删除", diff --git a/core/l10n/zh_TW.js b/core/l10n/zh_TW.js index b23427f3c19..137b77cdb22 100644 --- a/core/l10n/zh_TW.js +++ b/core/l10n/zh_TW.js @@ -180,7 +180,6 @@ OC.L10N.register( "Warning" : "警告", "Error while sending notification" : "發送通知錯誤", "Non-existing tag #{tag}" : "不存在的標籤 #{tag}", - "not assignable" : "不可指定", "invisible" : "不可見", "({scope})" : "({scope})", "Delete" : "刪除", diff --git a/core/l10n/zh_TW.json b/core/l10n/zh_TW.json index b9ee6d307d3..b110f66e1ee 100644 --- a/core/l10n/zh_TW.json +++ b/core/l10n/zh_TW.json @@ -178,7 +178,6 @@ "Warning" : "警告", "Error while sending notification" : "發送通知錯誤", "Non-existing tag #{tag}" : "不存在的標籤 #{tag}", - "not assignable" : "不可指定", "invisible" : "不可見", "({scope})" : "({scope})", "Delete" : "刪除", diff --git a/core/shipped.json b/core/shipped.json index e33269dad75..a3abe22d8d5 100644 --- a/core/shipped.json +++ b/core/shipped.json @@ -30,6 +30,7 @@ "provisioning_api", "sharepoint", "systemtags", + "systemtags_management", "templateeditor", "updatenotification", "user_external", @@ -100,34 +100,11 @@ try { } } - $instanceId = $config->getSystemValue('instanceid'); - $lockFileName = 'owncloud-server-' . $instanceId . '-cron.lock'; - $lockDirectory = $config->getSystemValue('cron.lockfile.location', sys_get_temp_dir()); - $lockDirectory = rtrim($lockDirectory, '\\/'); - $lockFile = $lockDirectory . '/' . $lockFileName; - - if (!file_exists($lockFile)) { - touch($lockFile); - } - // We call ownCloud from the CLI (aka cron) if ($appMode != 'cron') { \OCP\BackgroundJob::setExecutionType('cron'); } - // open the file and try to lock it. If it is not locked, the background - // job can be executed, otherwise another instance is already running - $fp = fopen($lockFile, 'w'); - $isLocked = flock($fp, LOCK_EX|LOCK_NB, $wouldBlock); - - // check if backgroundjobs is still running. The wouldBlock check is - // needed on systems with advisory locking, see - // http://php.net/manual/en/function.flock.php#45464 - if (!$isLocked || $wouldBlock) { - echo "Another instance of cron.php is still running!" . PHP_EOL; - exit(1); - } - // Work $jobList = \OC::$server->getJobList(); @@ -138,6 +115,7 @@ try { $executedJobs = []; while ($job = $jobList->getNext()) { if (isset($executedJobs[$job->getId()])) { + $jobList->unlockJob($job); break; } @@ -154,10 +132,6 @@ try { } } - // unlock the file - flock($fp, LOCK_UN); - fclose($fp); - } else { // We call cron.php from some website if ($appMode == 'cron') { diff --git a/db_structure.xml b/db_structure.xml index 6e57b003fcf..e535814b518 100644 --- a/db_structure.xml +++ b/db_structure.xml @@ -968,12 +968,29 @@ </field> <field> + <!-- timestamp when the job was executed the last time --> <name>last_run</name> <type>integer</type> <default></default> <notnull>false</notnull> </field> + <field> + <!-- timestamp when the job was checked if it needs execution the last time --> + <name>last_checked</name> + <type>integer</type> + <default></default> + <notnull>false</notnull> + </field> + + <field> + <!-- timestamp when the job was reserved the last time, 1 day timeout --> + <name>reserved_at</name> + <type>integer</type> + <default></default> + <notnull>false</notnull> + </field> + <index> <name>job_class_index</name> <field> @@ -1383,6 +1400,49 @@ <table> <!-- + System tag to group mapping + --> + <name>*dbprefix*systemtag_group</name> + + <declaration> + + <!-- Foreign Key systemtag::id --> + <field> + <name>systemtagid</name> + <type>integer</type> + <default>0</default> + <notnull>true</notnull> + <unsigned>true</unsigned> + <length>4</length> + </field> + + <field> + <name>gid</name> + <type>string</type> + <notnull>true</notnull> + </field> + + <index> + <name>systemtag_group</name> + <primary>true</primary> + <unique>true</unique> + <field> + <name>gid</name> + <sorting>ascending</sorting> + </field> + <field> + <name>systemtagid</name> + <sorting>ascending</sorting> + </field> + </index> + + </declaration> + + </table> + + <table> + + <!-- Namespaced Key-Value Store for arbitrary data. - Keys are namespaced per userid and appid. - E.g. (admin, files, foo) -> bar diff --git a/lib/autoloader.php b/lib/autoloader.php index 9cc573c0997..89b66a426a7 100644 --- a/lib/autoloader.php +++ b/lib/autoloader.php @@ -94,7 +94,7 @@ class Autoloader { $paths[] = \OC::$CLASSPATH[$class]; /** * @TODO: Remove this when necessary - * Remove "apps/" from inclusion path for smooth migration to mutli app dir + * Remove "apps/" from inclusion path for smooth migration to multi app dir */ if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) { \OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG); @@ -102,8 +102,6 @@ class Autoloader { } } elseif (strpos($class, 'OC_') === 0) { $paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php'); - } elseif (strpos($class, 'OCP\\') === 0) { - $paths[] = \OC::$SERVERROOT . '/lib/public/' . strtolower(str_replace('\\', '/', substr($class, 4)) . '.php'); } elseif (strpos($class, 'OCA\\') === 0) { list(, $app, $rest) = explode('\\', $class, 3); $app = strtolower($app); @@ -113,10 +111,10 @@ class Autoloader { // If not found in the root of the app directory, insert '/lib' after app id and try again. $paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php'); } - } elseif (strpos($class, 'Test_') === 0) { - $paths[] = \OC::$SERVERROOT . '/tests/lib/' . strtolower(str_replace('_', '/', substr($class, 5)) . '.php'); - } elseif (strpos($class, 'Test\\') === 0) { - $paths[] = \OC::$SERVERROOT . '/tests/lib/' . strtolower(str_replace('\\', '/', substr($class, 5)) . '.php'); + } elseif ($class === 'Test\\TestCase') { + // This File is considered public API, so we make sure that the class + // can still be loaded, although the PSR-4 paths have not been loaded. + $paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php'; } return $paths; } diff --git a/lib/base.php b/lib/base.php index 1fdcf44f4d0..391bcf865a0 100644 --- a/lib/base.php +++ b/lib/base.php @@ -53,7 +53,7 @@ * */ -require_once 'public/constants.php'; +require_once 'public/Constants.php'; /** * Class that is a namespace for all global OC variables @@ -481,11 +481,7 @@ class OC { $loaderStart = microtime(true); require_once __DIR__ . '/autoloader.php'; self::$loader = new \OC\Autoloader([ - OC::$SERVERROOT . '/lib', - OC::$SERVERROOT . '/core', - OC::$SERVERROOT . '/settings', - OC::$SERVERROOT . '/ocs', - OC::$SERVERROOT . '/ocs-provider', + OC::$SERVERROOT . '/lib/private/legacy', ]); if (defined('PHPUNIT_RUN')) { self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); diff --git a/lib/l10n/cs_CZ.js b/lib/l10n/cs_CZ.js index 9614eeef125..8074111faed 100644 --- a/lib/l10n/cs_CZ.js +++ b/lib/l10n/cs_CZ.js @@ -9,7 +9,7 @@ OC.L10N.register( "It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Pravděpodobně byla zkopírována konfigurační nastavení ze vzorových souborů. Toto není podporováno a může poškodit vaši instalaci. Nahlédněte prosím do dokumentace před prováděním změn v souboru config.php", "PHP %s or higher is required." : "Je vyžadováno PHP %s nebo vyšší.", "PHP with a version lower than %s is required." : "Je vyžadováno PHP ve verzi nižší než %s.", - "%sbit or higher PHP required." : "Je vyžadováno PHP %s nebo vyšší.", + "%sbit or higher PHP required." : "Je vyžadováno PHP %sbit nebo vyšší.", "Following databases are supported: %s" : "Jsou podporovány následující databáze: %s", "The command line tool %s could not be found" : "Nástroj příkazového řádku %s nebyl nalezen", "The library %s is not available." : "Knihovna %s není dostupná.", @@ -38,7 +38,7 @@ OC.L10N.register( "File name contains at least one invalid character" : "Jméno souboru obsahuje nejméně jeden neplatný znak", "File name is too long" : "Jméno souboru je moc dlouhé", "App directory already exists" : "Adresář aplikace již existuje", - "Can't create app folder. Please fix permissions. %s" : "Nelze vytvořit složku aplikace. Opravte práva souborů. %s", + "Can't create app folder. Please fix permissions. %s" : "Nelze vytvořit adresář aplikace. Opravte práva souborů. %s", "Archive does not contain a directory named %s" : "Archiv neobsahuje adresář pojmenovaný %s", "No source specified when installing app" : "Nebyl zadán zdroj při instalaci aplikace", "No href specified when installing app from http" : "Nebyl zadán odkaz pro instalaci aplikace z HTTP", @@ -102,7 +102,7 @@ OC.L10N.register( "Sharing %s failed, because the sharing backend for %s could not find its source" : "Sdílení položky %s selhalo, protože úložiště sdílení %s nenalezla zdroj", "Sharing %s failed, because the file could not be found in the file cache" : "Sdílení položky %s selhalo, protože soubor nebyl nalezen ve vyrovnávací paměti", "Cannot increase permissions of %s" : "Nelze navýšit oprávnění u %s", - "Files can't be shared with delete permissions" : "Soubory nelze sdílet se smazanými oprávněními", + "Files can't be shared with delete permissions" : "Soubory nelze sdílet s oprávněními ke smazání", "Files can't be shared with create permissions" : "Soubory nelze sdílet s vytvořenými oprávněními", "Expiration date is in the past" : "Datum vypršení je v minulosti", "Cannot set expiration date more than %s days in the future" : "Datum vypršení nelze nastavit na více než %s dní do budoucnosti", @@ -138,7 +138,7 @@ OC.L10N.register( "Cannot write into \"apps\" directory" : "Nelze zapisovat do adresáře \"apps\"", "This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "To lze obvykle vyřešit %spovolením zápisu webovému serveru do adresáře apps%s nebo zakázáním appstore v konfiguračním souboru.", "Cannot create \"data\" directory (%s)" : "Nelze vytvořit adresář \"data\" (%s)", - "This can usually be fixed by <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">giving the webserver write access to the root directory</a>." : "Toto může být obvykle opraveno <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">nastavením přístupových práv webového serveru pro zápis do kořenové složky</a>.", + "This can usually be fixed by <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">giving the webserver write access to the root directory</a>." : "Toto může být obvykle opraveno <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">nastavením přístupových práv webového serveru pro zápis do kořenového adresáře</a>.", "Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." : "Oprávnění lze obvykle napravit %spovolením zápisu webovému serveru do kořenového adresáře%s.", "Setting locale to %s failed" : "Nastavení jazyka na %s selhalo", "Please install one of these locales on your system and restart your webserver." : "Prosím nainstalujte alespoň jeden z těchto jazyků do svého systému a restartujte webový server.", @@ -167,6 +167,8 @@ OC.L10N.register( "Storage incomplete configuration. %s" : "Nekompletní konfigurace úložiště. %s", "Storage connection error. %s" : "Chyba připojení úložiště. %s", "Storage not available" : "Úložiště není dostupné", - "Storage connection timeout. %s" : "Vypršení připojení k úložišti. %s" + "Storage connection timeout. %s" : "Vypršení připojení k úložišti. %s", + "_%n file_::_%n files_" : ["%n soubor","%n soubory","%n souborů"], + "_%n window_::_%n windows_" : ["%n okno","%n okna","%n oken"] }, "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;"); diff --git a/lib/l10n/cs_CZ.json b/lib/l10n/cs_CZ.json index 50eb92efea6..1657a4b2dc0 100644 --- a/lib/l10n/cs_CZ.json +++ b/lib/l10n/cs_CZ.json @@ -7,7 +7,7 @@ "It has been detected that the sample configuration has been copied. This can break your installation and is unsupported. Please read the documentation before performing changes on config.php" : "Pravděpodobně byla zkopírována konfigurační nastavení ze vzorových souborů. Toto není podporováno a může poškodit vaši instalaci. Nahlédněte prosím do dokumentace před prováděním změn v souboru config.php", "PHP %s or higher is required." : "Je vyžadováno PHP %s nebo vyšší.", "PHP with a version lower than %s is required." : "Je vyžadováno PHP ve verzi nižší než %s.", - "%sbit or higher PHP required." : "Je vyžadováno PHP %s nebo vyšší.", + "%sbit or higher PHP required." : "Je vyžadováno PHP %sbit nebo vyšší.", "Following databases are supported: %s" : "Jsou podporovány následující databáze: %s", "The command line tool %s could not be found" : "Nástroj příkazového řádku %s nebyl nalezen", "The library %s is not available." : "Knihovna %s není dostupná.", @@ -36,7 +36,7 @@ "File name contains at least one invalid character" : "Jméno souboru obsahuje nejméně jeden neplatný znak", "File name is too long" : "Jméno souboru je moc dlouhé", "App directory already exists" : "Adresář aplikace již existuje", - "Can't create app folder. Please fix permissions. %s" : "Nelze vytvořit složku aplikace. Opravte práva souborů. %s", + "Can't create app folder. Please fix permissions. %s" : "Nelze vytvořit adresář aplikace. Opravte práva souborů. %s", "Archive does not contain a directory named %s" : "Archiv neobsahuje adresář pojmenovaný %s", "No source specified when installing app" : "Nebyl zadán zdroj při instalaci aplikace", "No href specified when installing app from http" : "Nebyl zadán odkaz pro instalaci aplikace z HTTP", @@ -100,7 +100,7 @@ "Sharing %s failed, because the sharing backend for %s could not find its source" : "Sdílení položky %s selhalo, protože úložiště sdílení %s nenalezla zdroj", "Sharing %s failed, because the file could not be found in the file cache" : "Sdílení položky %s selhalo, protože soubor nebyl nalezen ve vyrovnávací paměti", "Cannot increase permissions of %s" : "Nelze navýšit oprávnění u %s", - "Files can't be shared with delete permissions" : "Soubory nelze sdílet se smazanými oprávněními", + "Files can't be shared with delete permissions" : "Soubory nelze sdílet s oprávněními ke smazání", "Files can't be shared with create permissions" : "Soubory nelze sdílet s vytvořenými oprávněními", "Expiration date is in the past" : "Datum vypršení je v minulosti", "Cannot set expiration date more than %s days in the future" : "Datum vypršení nelze nastavit na více než %s dní do budoucnosti", @@ -136,7 +136,7 @@ "Cannot write into \"apps\" directory" : "Nelze zapisovat do adresáře \"apps\"", "This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." : "To lze obvykle vyřešit %spovolením zápisu webovému serveru do adresáře apps%s nebo zakázáním appstore v konfiguračním souboru.", "Cannot create \"data\" directory (%s)" : "Nelze vytvořit adresář \"data\" (%s)", - "This can usually be fixed by <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">giving the webserver write access to the root directory</a>." : "Toto může být obvykle opraveno <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">nastavením přístupových práv webového serveru pro zápis do kořenové složky</a>.", + "This can usually be fixed by <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">giving the webserver write access to the root directory</a>." : "Toto může být obvykle opraveno <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">nastavením přístupových práv webového serveru pro zápis do kořenového adresáře</a>.", "Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." : "Oprávnění lze obvykle napravit %spovolením zápisu webovému serveru do kořenového adresáře%s.", "Setting locale to %s failed" : "Nastavení jazyka na %s selhalo", "Please install one of these locales on your system and restart your webserver." : "Prosím nainstalujte alespoň jeden z těchto jazyků do svého systému a restartujte webový server.", @@ -165,6 +165,8 @@ "Storage incomplete configuration. %s" : "Nekompletní konfigurace úložiště. %s", "Storage connection error. %s" : "Chyba připojení úložiště. %s", "Storage not available" : "Úložiště není dostupné", - "Storage connection timeout. %s" : "Vypršení připojení k úložišti. %s" + "Storage connection timeout. %s" : "Vypršení připojení k úložišti. %s", + "_%n file_::_%n files_" : ["%n soubor","%n soubory","%n souborů"], + "_%n window_::_%n windows_" : ["%n okno","%n okna","%n oken"] },"pluralForm" :"nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;" }
\ No newline at end of file diff --git a/lib/l10n/de.js b/lib/l10n/de.js index ac65d37ecba..74f845ba6d9 100644 --- a/lib/l10n/de.js +++ b/lib/l10n/de.js @@ -167,6 +167,8 @@ OC.L10N.register( "Storage incomplete configuration. %s" : "Unvollständige Konfiguration des Storage. %s", "Storage connection error. %s" : "Verbindungsfehler zum Storage. %s", "Storage not available" : "Speicher nicht verfügbar", - "Storage connection timeout. %s" : "Zeitüberschreitung der Verbindung zum Storage. %s" + "Storage connection timeout. %s" : "Zeitüberschreitung der Verbindung zum Storage. %s", + "_%n file_::_%n files_" : ["%n Datei","%n Dateien"], + "_%n window_::_%n windows_" : ["%n Fenster","%n Fenster"] }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/de.json b/lib/l10n/de.json index 97a5b59fea3..65bd3e97edf 100644 --- a/lib/l10n/de.json +++ b/lib/l10n/de.json @@ -165,6 +165,8 @@ "Storage incomplete configuration. %s" : "Unvollständige Konfiguration des Storage. %s", "Storage connection error. %s" : "Verbindungsfehler zum Storage. %s", "Storage not available" : "Speicher nicht verfügbar", - "Storage connection timeout. %s" : "Zeitüberschreitung der Verbindung zum Storage. %s" + "Storage connection timeout. %s" : "Zeitüberschreitung der Verbindung zum Storage. %s", + "_%n file_::_%n files_" : ["%n Datei","%n Dateien"], + "_%n window_::_%n windows_" : ["%n Fenster","%n Fenster"] },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/l10n/de_DE.js b/lib/l10n/de_DE.js index ab4fa068c47..5e9900fd395 100644 --- a/lib/l10n/de_DE.js +++ b/lib/l10n/de_DE.js @@ -167,6 +167,8 @@ OC.L10N.register( "Storage incomplete configuration. %s" : "Speicher-Konfiguration unvollständig. %s", "Storage connection error. %s" : "Speicher-Verbindungsfehler. %s", "Storage not available" : "Speicher nicht verfügbar", - "Storage connection timeout. %s" : "Speicher-Verbindungszeitüberschreitung. %s" + "Storage connection timeout. %s" : "Speicher-Verbindungszeitüberschreitung. %s", + "_%n file_::_%n files_" : ["%n Datei","%n Dateien"], + "_%n window_::_%n windows_" : ["%n Fenster","%n Fenster"] }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/de_DE.json b/lib/l10n/de_DE.json index 8d3fe907524..5d0114eadf1 100644 --- a/lib/l10n/de_DE.json +++ b/lib/l10n/de_DE.json @@ -165,6 +165,8 @@ "Storage incomplete configuration. %s" : "Speicher-Konfiguration unvollständig. %s", "Storage connection error. %s" : "Speicher-Verbindungsfehler. %s", "Storage not available" : "Speicher nicht verfügbar", - "Storage connection timeout. %s" : "Speicher-Verbindungszeitüberschreitung. %s" + "Storage connection timeout. %s" : "Speicher-Verbindungszeitüberschreitung. %s", + "_%n file_::_%n files_" : ["%n Datei","%n Dateien"], + "_%n window_::_%n windows_" : ["%n Fenster","%n Fenster"] },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/l10n/es.js b/lib/l10n/es.js index 9e108b52ec7..dbf8ba89b48 100644 --- a/lib/l10n/es.js +++ b/lib/l10n/es.js @@ -167,6 +167,8 @@ OC.L10N.register( "Storage incomplete configuration. %s" : "Configuración de almacenamiento incompleta. %s", "Storage connection error. %s" : "Error de conexión de almacenamiento. %s", "Storage not available" : "Almacenamiento no disponible", - "Storage connection timeout. %s" : "Tiempo de conexión de almacenamiento agotado. %s" + "Storage connection timeout. %s" : "Tiempo de conexión de almacenamiento agotado. %s", + "_%n file_::_%n files_" : ["%n archivo","%n archivos"], + "_%n window_::_%n windows_" : ["%n window","%n windows"] }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/es.json b/lib/l10n/es.json index 36f8a63c317..723d8699949 100644 --- a/lib/l10n/es.json +++ b/lib/l10n/es.json @@ -165,6 +165,8 @@ "Storage incomplete configuration. %s" : "Configuración de almacenamiento incompleta. %s", "Storage connection error. %s" : "Error de conexión de almacenamiento. %s", "Storage not available" : "Almacenamiento no disponible", - "Storage connection timeout. %s" : "Tiempo de conexión de almacenamiento agotado. %s" + "Storage connection timeout. %s" : "Tiempo de conexión de almacenamiento agotado. %s", + "_%n file_::_%n files_" : ["%n archivo","%n archivos"], + "_%n window_::_%n windows_" : ["%n window","%n windows"] },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/l10n/fi_FI.js b/lib/l10n/fi_FI.js index 11e50686a15..b82b6a7b513 100644 --- a/lib/l10n/fi_FI.js +++ b/lib/l10n/fi_FI.js @@ -146,6 +146,8 @@ OC.L10N.register( "Storage incomplete configuration. %s" : "Tallennustilan puutteellinen määritys. %s", "Storage connection error. %s" : "Tallennustilan yhteysvirhe. %s", "Storage not available" : "Tallennustila ei ole käytettävissä", - "Storage connection timeout. %s" : "Tallennustilan yhteyden aikakatkaisu. %s" + "Storage connection timeout. %s" : "Tallennustilan yhteyden aikakatkaisu. %s", + "_%n file_::_%n files_" : ["%n tiedosto","%n tiedostoa"], + "_%n window_::_%n windows_" : ["%n ikkuna","%n ikkunaa"] }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/fi_FI.json b/lib/l10n/fi_FI.json index f1c35d271f2..4bdddef1c57 100644 --- a/lib/l10n/fi_FI.json +++ b/lib/l10n/fi_FI.json @@ -144,6 +144,8 @@ "Storage incomplete configuration. %s" : "Tallennustilan puutteellinen määritys. %s", "Storage connection error. %s" : "Tallennustilan yhteysvirhe. %s", "Storage not available" : "Tallennustila ei ole käytettävissä", - "Storage connection timeout. %s" : "Tallennustilan yhteyden aikakatkaisu. %s" + "Storage connection timeout. %s" : "Tallennustilan yhteyden aikakatkaisu. %s", + "_%n file_::_%n files_" : ["%n tiedosto","%n tiedostoa"], + "_%n window_::_%n windows_" : ["%n ikkuna","%n ikkunaa"] },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/l10n/it.js b/lib/l10n/it.js index ca940ac94c5..fbc26530db4 100644 --- a/lib/l10n/it.js +++ b/lib/l10n/it.js @@ -167,6 +167,8 @@ OC.L10N.register( "Storage incomplete configuration. %s" : "Configurazione dell'archiviazione incompleta.%s", "Storage connection error. %s" : "Errore di connessione all'archiviazione. %s", "Storage not available" : "Archiviazione non disponibile", - "Storage connection timeout. %s" : "Timeout di connessione all'archiviazione. %s" + "Storage connection timeout. %s" : "Timeout di connessione all'archiviazione. %s", + "_%n file_::_%n files_" : ["%n file","%n file"], + "_%n window_::_%n windows_" : ["%n finestra","%n finestre"] }, "nplurals=2; plural=(n != 1);"); diff --git a/lib/l10n/it.json b/lib/l10n/it.json index f74f2e818ab..3955bf27508 100644 --- a/lib/l10n/it.json +++ b/lib/l10n/it.json @@ -165,6 +165,8 @@ "Storage incomplete configuration. %s" : "Configurazione dell'archiviazione incompleta.%s", "Storage connection error. %s" : "Errore di connessione all'archiviazione. %s", "Storage not available" : "Archiviazione non disponibile", - "Storage connection timeout. %s" : "Timeout di connessione all'archiviazione. %s" + "Storage connection timeout. %s" : "Timeout di connessione all'archiviazione. %s", + "_%n file_::_%n files_" : ["%n file","%n file"], + "_%n window_::_%n windows_" : ["%n finestra","%n finestre"] },"pluralForm" :"nplurals=2; plural=(n != 1);" }
\ No newline at end of file diff --git a/lib/private/AppFramework/Db/Db.php b/lib/private/AppFramework/Db/Db.php index 0d17d7bc225..ab06d56cfd1 100644 --- a/lib/private/AppFramework/Db/Db.php +++ b/lib/private/AppFramework/Db/Db.php @@ -29,6 +29,7 @@ namespace OC\AppFramework\Db; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDb; use OCP\IDBConnection; +use OCP\PreConditionNotMetException; /** * @deprecated use IDBConnection directly, will be removed in ownCloud 10 @@ -157,13 +158,27 @@ class Db implements IDb { * @param array $updatePreconditionValues ensure values match preconditions (column name => value) * @return int number of new rows * @throws \Doctrine\DBAL\DBALException - * @throws PreconditionNotMetException + * @throws PreConditionNotMetException */ public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []) { return $this->connection->setValues($table, $keys, $values, $updatePreconditionValues); } /** + * @inheritdoc + */ + public function lockTable($tableName) { + $this->connection->lockTable($tableName); + } + + /** + * @inheritdoc + */ + public function unlockTable() { + $this->connection->unlockTable(); + } + + /** * Start a transaction */ public function beginTransaction() { diff --git a/lib/private/Authentication/Token/DefaultTokenMapper.php b/lib/private/Authentication/Token/DefaultTokenMapper.php index 18adbe48d78..9f173571270 100644 --- a/lib/private/Authentication/Token/DefaultTokenMapper.php +++ b/lib/private/Authentication/Token/DefaultTokenMapper.php @@ -26,6 +26,7 @@ use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\Mapper; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; +use OCP\IUser; class DefaultTokenMapper extends Mapper { @@ -83,4 +84,31 @@ class DefaultTokenMapper extends Mapper { return DefaultToken::fromRow($data); } + /** + * Get all token of a user + * + * The provider may limit the number of result rows in case of an abuse + * where a high number of (session) tokens is generated + * + * @param IUser $user + * @return DefaultToken[] + */ + public function getTokenByUser(IUser $user) { + /* @var $qb IQueryBuilder */ + $qb = $this->db->getQueryBuilder(); + $qb->select('id', 'uid', 'password', 'name', 'type', 'token', 'last_activity') + ->from('authtoken') + ->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID()))) + ->setMaxResults(1000); + $result = $qb->execute(); + $data = $result->fetchAll(); + $result->closeCursor(); + + $entities = array_map(function ($row) { + return DefaultToken::fromRow($row); + }, $data); + + return $entities; + } + } diff --git a/lib/private/Authentication/Token/DefaultTokenProvider.php b/lib/private/Authentication/Token/DefaultTokenProvider.php index a335b79e332..6c69d852d7b 100644 --- a/lib/private/Authentication/Token/DefaultTokenProvider.php +++ b/lib/private/Authentication/Token/DefaultTokenProvider.php @@ -28,6 +28,7 @@ use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\ILogger; +use OCP\IUser; use OCP\Security\ICrypto; class DefaultTokenProvider implements IProvider { @@ -103,6 +104,19 @@ class DefaultTokenProvider implements IProvider { } /** + * Get all token of a user + * + * The provider may limit the number of result rows in case of an abuse + * where a high number of (session) tokens is generated + * + * @param IUser $user + * @return IToken[] + */ + public function getTokenByUser(IUser $user) { + return $this->mapper->getTokenByUser($user); + } + + /** * Get a token by token id * * @param string $tokenId diff --git a/lib/private/Authentication/Token/IProvider.php b/lib/private/Authentication/Token/IProvider.php index 1fd3a70fbbf..a5c5faa5639 100644 --- a/lib/private/Authentication/Token/IProvider.php +++ b/lib/private/Authentication/Token/IProvider.php @@ -23,6 +23,7 @@ namespace OC\Authentication\Token; use OC\Authentication\Exceptions\InvalidTokenException; +use OCP\IUser; interface IProvider { @@ -69,6 +70,17 @@ interface IProvider { public function updateToken(IToken $token); /** + * Get all token of a user + * + * The provider may limit the number of result rows in case of an abuse + * where a high number of (session) tokens is generated + * + * @param IUser $user + * @return IToken[] + */ + public function getTokenByUser(IUser $user); + + /** * Get the (unencrypted) password of the given token * * @param IToken $token diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index 2429b830446..c84969776c2 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -25,27 +25,34 @@ namespace OC\BackgroundJob; use OCP\AppFramework\QueryException; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; use OCP\AutoloadNotAllowedException; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\IConfig; +use OCP\IDBConnection; class JobList implements IJobList { - /** @var \OCP\IDBConnection */ + + /** @var IDBConnection */ protected $connection; - /** - * @var \OCP\IConfig $config - */ + /**@var IConfig */ protected $config; + /**@var ITimeFactory */ + protected $timeFactory; + /** - * @param \OCP\IDBConnection $connection - * @param \OCP\IConfig $config + * @param IDBConnection $connection + * @param IConfig $config + * @param ITimeFactory $timeFactory */ - public function __construct($connection, $config) { + public function __construct(IDBConnection $connection, IConfig $config, ITimeFactory $timeFactory) { $this->connection = $connection; $this->config = $config; + $this->timeFactory = $timeFactory; } /** @@ -71,6 +78,7 @@ class JobList implements IJobList { 'class' => $query->createNamedParameter($class), 'argument' => $query->createNamedParameter($argument), 'last_run' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT), + 'last_checked' => $query->createNamedParameter($this->timeFactory->getTime(), IQueryBuilder::PARAM_INT), ]); $query->execute(); } @@ -167,45 +175,40 @@ class JobList implements IJobList { * @return IJob|null */ public function getNext() { - $lastId = $this->getLastJob(); - $query = $this->connection->getQueryBuilder(); $query->select('*') ->from('jobs') - ->where($query->expr()->lt('id', $query->createNamedParameter($lastId, IQueryBuilder::PARAM_INT))) - ->orderBy('id', 'DESC') + ->where($query->expr()->lte('reserved_at', $query->createNamedParameter($this->timeFactory->getTime() - 12 * 3600, IQueryBuilder::PARAM_INT))) + ->orderBy('last_checked', 'ASC') ->setMaxResults(1); + + $update = $this->connection->getQueryBuilder(); + $update->update('jobs') + ->set('reserved_at', $update->createNamedParameter($this->timeFactory->getTime())) + ->set('last_checked', $update->createNamedParameter($this->timeFactory->getTime())) + ->where($update->expr()->eq('id', $update->createParameter('jobid'))); + + $this->connection->lockTable('jobs'); $result = $query->execute(); $row = $result->fetch(); $result->closeCursor(); if ($row) { - $jobId = $row['id']; + $update->setParameter('jobid', $row['id']); + $update->execute(); + $this->connection->unlockTable(); + $job = $this->buildJob($row); - } else { - //begin at the start of the queue - $query = $this->connection->getQueryBuilder(); - $query->select('*') - ->from('jobs') - ->orderBy('id', 'DESC') - ->setMaxResults(1); - $result = $query->execute(); - $row = $result->fetch(); - $result->closeCursor(); - - if ($row) { - $jobId = $row['id']; - $job = $this->buildJob($row); - } else { - return null; //empty job list + + if ($job === null) { + // Background job from disabled app, try again. + return $this->getNext(); } - } - if (is_null($job)) { - $this->removeById($jobId); - return $this->getNext(); - } else { return $job; + } else { + $this->connection->unlockTable(); + return null; } } @@ -267,13 +270,30 @@ class JobList implements IJobList { * @param IJob $job */ public function setLastJob($job) { + $this->unlockJob($job); $this->config->setAppValue('backgroundjob', 'lastjob', $job->getId()); } /** + * Remove the reservation for a job + * + * @param IJob $job + */ + public function unlockJob($job) { + $query = $this->connection->getQueryBuilder(); + $query->update('jobs') + ->set('reserved_at', $query->expr()->literal(0, IQueryBuilder::PARAM_INT)) + ->where($query->expr()->eq('id', $query->createNamedParameter($job->getId(), IQueryBuilder::PARAM_INT))); + $query->execute(); + } + + /** * get the id of the last ran job * * @return int + * @deprecated 9.1.0 - The functionality behind the value is deprecated, it + * only tells you which job finished last, but since we now allow multiple + * executors to run in parallel, it's not used to calculate the next job. */ public function getLastJob() { return (int) $this->config->getAppValue('backgroundjob', 'lastjob', 0); diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php index 9522f768c88..bcced395cb7 100644 --- a/lib/private/DB/Adapter.php +++ b/lib/private/DB/Adapter.php @@ -58,6 +58,26 @@ class Adapter { } /** + * Create an exclusive read+write lock on a table + * + * @param string $tableName + * @since 9.1.0 + */ + public function lockTable($tableName) { + $this->conn->beginTransaction(); + $this->conn->executeUpdate('LOCK TABLE `' .$tableName . '` IN EXCLUSIVE MODE'); + } + + /** + * Release a previous acquired lock again + * + * @since 9.1.0 + */ + public function unlockTable() { + $this->conn->commit(); + } + + /** * Insert a row if the matching row does not exists. * * @param string $table The table name (will replace *PREFIX* with the actual prefix) diff --git a/lib/private/DB/AdapterMySQL.php b/lib/private/DB/AdapterMySQL.php index ab87c589747..8504fc74e0f 100644 --- a/lib/private/DB/AdapterMySQL.php +++ b/lib/private/DB/AdapterMySQL.php @@ -24,6 +24,18 @@ namespace OC\DB; class AdapterMySQL extends Adapter { + + /** + * @param string $tableName + */ + public function lockTable($tableName) { + $this->conn->executeUpdate('LOCK TABLES `' .$tableName . '` WRITE'); + } + + public function unlockTable() { + $this->conn->executeUpdate('UNLOCK TABLES'); + } + public function fixupStatement($statement) { $statement = str_replace(' ILIKE ', ' COLLATE utf8_general_ci LIKE ', $statement); return $statement; diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php index 3466e0e1aac..cefb06ffac6 100644 --- a/lib/private/DB/AdapterSqlite.php +++ b/lib/private/DB/AdapterSqlite.php @@ -27,6 +27,18 @@ namespace OC\DB; class AdapterSqlite extends Adapter { + + /** + * @param string $tableName + */ + public function lockTable($tableName) { + $this->conn->executeUpdate('BEGIN EXCLUSIVE TRANSACTION'); + } + + public function unlockTable() { + $this->conn->executeUpdate('COMMIT TRANSACTION'); + } + public function fixupStatement($statement) { $statement = preg_replace('( I?LIKE \?)', '$0 ESCAPE \'\\\'', $statement); $statement = preg_replace('/`(\w+)` ILIKE \?/', 'LOWER($1) LIKE LOWER(?)', $statement); diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 7904fab0726..5b7026db2f3 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -25,6 +25,7 @@ */ namespace OC\DB; + use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Configuration; @@ -33,7 +34,7 @@ use Doctrine\Common\EventManager; use OC\DB\QueryBuilder\QueryBuilder; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; -use OCP\PreconditionNotMetException; +use OCP\PreConditionNotMetException; class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { /** @@ -46,6 +47,8 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { */ protected $adapter; + protected $lockedTable = null; + public function connect() { try { return parent::connect(); @@ -262,7 +265,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { * @param array $updatePreconditionValues ensure values match preconditions (column name => value) * @return int number of new rows * @throws \Doctrine\DBAL\DBALException - * @throws PreconditionNotMetException + * @throws PreConditionNotMetException */ public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []) { try { @@ -281,7 +284,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { foreach ($values as $name => $value) { $updateQb->set($name, $updateQb->createNamedParameter($value, $this->getType($value))); } - $where = $updateQb->expr()->andx(); + $where = $updateQb->expr()->andX(); $whereValues = array_merge($keys, $updatePreconditionValues); foreach ($whereValues as $name => $value) { $where->add($updateQb->expr()->eq( @@ -294,7 +297,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { $affected = $updateQb->execute(); if ($affected === 0 && !empty($updatePreconditionValues)) { - throw new PreconditionNotMetException(); + throw new PreConditionNotMetException(); } return 0; @@ -302,6 +305,33 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection { } /** + * Create an exclusive read+write lock on a table + * + * @param string $tableName + * @throws \BadMethodCallException When trying to acquire a second lock + * @since 9.1.0 + */ + public function lockTable($tableName) { + if ($this->lockedTable !== null) { + throw new \BadMethodCallException('Can not lock a new table until the previous lock is released.'); + } + + $tableName = $this->tablePrefix . $tableName; + $this->lockedTable = $tableName; + $this->adapter->lockTable($tableName); + } + + /** + * Release a previous acquired lock again + * + * @since 9.1.0 + */ + public function unlockTable() { + $this->adapter->unlockTable(); + $this->lockedTable = null; + } + + /** * returns the error code and message as a string for logging * works with DoctrineException * @return string diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 03aca1924b0..10bb5f33e08 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -355,29 +355,45 @@ class Scanner extends BasicEmitter implements IScanner { * @param string $path * @param bool $recursive * @param int $reuse - * @param array $folderData existing cache data for the folder to be scanned + * @param int $folderId id for the folder to be scanned * @param bool $lock set to false to disable getting an additional read lock during scanning * @return int the size of the scanned folder or -1 if the size is unknown at this stage */ - protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderData = null, $lock = true) { + protected function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $folderId = null, $lock = true) { if ($reuse === -1) { $reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG; } $this->emit('\OC\Files\Cache\Scanner', 'scanFolder', array($path, $this->storageId)); $size = 0; - $childQueue = array(); - if (is_array($folderData) and isset($folderData['fileid'])) { - $folderId = $folderData['fileid']; - } else { + if (!is_null($folderId)) { $folderId = $this->cache->getId($path); } + $childQueue = $this->handleChildren($path, $recursive, $reuse, $folderId, $lock, $size); + + foreach ($childQueue as $child => $childId) { + $childSize = $this->scanChildren($child, self::SCAN_RECURSIVE, $reuse, $childId, $lock); + if ($childSize === -1) { + $size = -1; + } else if ($size !== -1) { + $size += $childSize; + } + } + $this->updateCache($path, array('size' => $size), $folderId); + $this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', array($path, $this->storageId)); + return $size; + } + + private function handleChildren($path, $recursive, $reuse, $folderId, $lock, &$size) { + // we put this in it's own function so it cleans up the memory before we start recursing $existingChildren = $this->getExistingChildren($folderId); $newChildren = $this->getNewChildren($path); if ($this->useTransactions) { \OC::$server->getDatabaseConnection()->beginTransaction(); } + $exceptionOccurred = false; + $childQueue = []; foreach ($newChildren as $file) { $child = ($path) ? $path . '/' . $file : $file; try { @@ -385,7 +401,7 @@ class Scanner extends BasicEmitter implements IScanner { $data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock); if ($data) { if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE) { - $childQueue[$child] = $data; + $childQueue[$child] = $data['fileid']; } else if ($data['size'] === -1) { $size = -1; } else if ($size !== -1) { @@ -420,20 +436,7 @@ class Scanner extends BasicEmitter implements IScanner { // we reload them here \OC::$server->getMimeTypeLoader()->reset(); } - - foreach ($childQueue as $child => $childData) { - $childSize = $this->scanChildren($child, self::SCAN_RECURSIVE, $reuse, $childData, $lock); - if ($childSize === -1) { - $size = -1; - } else if ($size !== -1) { - $size += $childSize; - } - } - if (!is_array($folderData) or !isset($folderData['size']) or $folderData['size'] !== $size) { - $this->updateCache($path, array('size' => $size), $folderId); - } - $this->emit('\OC\Files\Cache\Scanner', 'postScanFolder', array($path, $this->storageId)); - return $size; + return $childQueue; } /** @@ -466,7 +469,7 @@ class Scanner extends BasicEmitter implements IScanner { } else { $lastPath = null; while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) { - $this->runBackgroundScanJob(function() use ($path) { + $this->runBackgroundScanJob(function () use ($path) { $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG); }, $path); // FIXME: this won't proceed with the next item, needs revamping of getIncomplete() diff --git a/ocs-provider/provider.php b/lib/private/OCS/Provider.php index 396b5b23fc6..4a7caa79fa5 100644 --- a/ocs-provider/provider.php +++ b/lib/private/OCS/Provider.php @@ -19,6 +19,8 @@ * */ +namespace OC\OCS; + class Provider extends \OCP\AppFramework\Controller { /** @var \OCP\App\IAppManager */ private $appManager; diff --git a/lib/private/Server.php b/lib/private/Server.php index a4294ee2c88..0b7b8f9e403 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -362,7 +362,11 @@ class Server extends ServerContainer implements IServerContainer { }); $this->registerService('JobList', function (Server $c) { $config = $c->getConfig(); - return new \OC\BackgroundJob\JobList($c->getDatabaseConnection(), $config); + return new \OC\BackgroundJob\JobList( + $c->getDatabaseConnection(), + $config, + new TimeFactory() + ); }); $this->registerService('Router', function (Server $c) { $cacheFactory = $c->getMemCacheFactory(); diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index f0de39fdad3..8a39c18a495 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -733,7 +733,7 @@ class DefaultShareProvider implements IShareProvider { * @throws InvalidShare */ private function createShare($data) { - $share = new Share($this->rootFolder); + $share = new Share($this->rootFolder, $this->userManager); $share->setId((int)$data['id']) ->setShareType((int)$data['share_type']) ->setPermissions((int)$data['permissions']) diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index dee9e0cdd21..3568995472a 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -201,7 +201,12 @@ class Manager implements IManager { } // And you can't share your rootfolder - if ($this->rootFolder->getUserFolder($share->getSharedBy())->getPath() === $share->getNode()->getPath()) { + if ($this->userManager->userExists($share->getSharedBy())) { + $sharedPath = $this->rootFolder->getUserFolder($share->getSharedBy())->getPath(); + } else { + $sharedPath = $this->rootFolder->getUserFolder($share->getShareOwner())->getPath(); + } + if ($sharedPath === $share->getNode()->getPath()) { throw new \InvalidArgumentException('You can\'t share your root folder'); } @@ -713,7 +718,11 @@ class Manager implements IManager { } if ($share->getPermissions() !== $originalShare->getPermissions()) { - $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner()); + if ($this->userManager->userExists($share->getShareOwner())) { + $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner()); + } else { + $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy()); + } \OC_Hook::emit('OCP\Share', 'post_update_permissions', array( 'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder', 'itemSource' => $share->getNode()->getId(), @@ -1107,7 +1116,7 @@ class Manager implements IManager { * @return \OCP\Share\IShare; */ public function newShare() { - return new \OC\Share20\Share($this->rootFolder); + return new \OC\Share20\Share($this->rootFolder, $this->userManager); } /** diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index 0bedfb84fc7..b436a7bc5f3 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -115,7 +115,8 @@ class ProviderFactory implements IProviderFactory { $l, $this->serverContainer->getLogger(), $this->serverContainer->getLazyRootFolder(), - $this->serverContainer->getConfig() + $this->serverContainer->getConfig(), + $this->serverContainer->getUserManager() ); } diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index c361f01216f..f56fd94b409 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -24,8 +24,7 @@ use OCP\Files\File; use OCP\Files\IRootFolder; use OCP\Files\Node; use OCP\Files\NotFoundException; -use OCP\IUser; -use OCP\IGroup; +use OCP\IUserManager; use OCP\Share\Exceptions\IllegalIDChangeException; class Share implements \OCP\Share\IShare { @@ -68,8 +67,12 @@ class Share implements \OCP\Share\IShare { /** @var IRootFolder */ private $rootFolder; - public function __construct(IRootFolder $rootFolder) { + /** @var IUserManager */ + private $userManager; + + public function __construct(IRootFolder $rootFolder, IUserManager $userManager) { $this->rootFolder = $rootFolder; + $this->userManager = $userManager; } /** @@ -145,7 +148,13 @@ class Share implements \OCP\Share\IShare { throw new NotFoundException(); } - $userFolder = $this->rootFolder->getUserFolder($this->shareOwner); + // for federated shares the owner can be a remote user, in this + // case we use the initiator + if($this->userManager->userExists($this->shareOwner)) { + $userFolder = $this->rootFolder->getUserFolder($this->shareOwner); + } else { + $userFolder = $this->rootFolder->getUserFolder($this->sharedBy); + } $nodes = $userFolder->getById($this->fileId); if (empty($nodes)) { diff --git a/lib/private/SystemTag/ManagerFactory.php b/lib/private/SystemTag/ManagerFactory.php index d9acf327f8a..6b238e3c428 100644 --- a/lib/private/SystemTag/ManagerFactory.php +++ b/lib/private/SystemTag/ManagerFactory.php @@ -59,6 +59,7 @@ class ManagerFactory implements ISystemTagManagerFactory { public function getManager() { return new SystemTagManager( $this->serverContainer->getDatabaseConnection(), + $this->serverContainer->getGroupManager(), $this->serverContainer->getEventDispatcher() ); } diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index 76a60a91328..2b0ef03e471 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -30,10 +30,18 @@ use OCP\SystemTag\ManagerEvent; use OCP\SystemTag\TagAlreadyExistsException; use OCP\SystemTag\TagNotFoundException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use OCP\IUserManager; +use OCP\IGroupManager; +use OCP\SystemTag\ISystemTag; +use OCP\IUser; +/** + * Manager class for system tags + */ class SystemTagManager implements ISystemTagManager { const TAG_TABLE = 'systemtag'; + const TAG_GROUP_TABLE = 'systemtag_group'; /** @var IDBConnection */ protected $connection; @@ -41,6 +49,9 @@ class SystemTagManager implements ISystemTagManager { /** @var EventDispatcherInterface */ protected $dispatcher; + /** @var IGroupManager */ + protected $groupManager; + /** * Prepared query for selecting tags directly * @@ -54,8 +65,13 @@ class SystemTagManager implements ISystemTagManager { * @param IDBConnection $connection database connection * @param EventDispatcherInterface $dispatcher */ - public function __construct(IDBConnection $connection, EventDispatcherInterface $dispatcher) { + public function __construct( + IDBConnection $connection, + IGroupManager $groupManager, + EventDispatcherInterface $dispatcher + ) { $this->connection = $connection; + $this->groupManager = $groupManager; $this->dispatcher = $dispatcher; $query = $this->connection->getQueryBuilder(); @@ -316,7 +332,102 @@ class SystemTagManager implements ISystemTagManager { } } + /** + * {@inheritdoc} + */ + public function canUserAssignTag(ISystemTag $tag, IUser $user) { + // early check to avoid unneeded group lookups + if ($tag->isUserAssignable() && $tag->isUserVisible()) { + return true; + } + + if ($this->groupManager->isAdmin($user->getUID())) { + return true; + } + + if (!$tag->isUserVisible()) { + return false; + } + + $groupIds = $this->groupManager->getUserGroupIds($user); + if (!empty($groupIds)) { + $matchingGroups = array_intersect($groupIds, $this->getTagGroups($tag)); + if (!empty($matchingGroups)) { + return true; + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function canUserSeeTag(ISystemTag $tag, IUser $user) { + if ($tag->isUserVisible()) { + return true; + } + + if ($this->groupManager->isAdmin($user->getUID())) { + return true; + } + + return false; + } + private function createSystemTagFromRow($row) { return new SystemTag((int)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable']); } + + /** + * {@inheritdoc} + */ + public function setTagGroups(ISystemTag $tag, $groupIds) { + // delete relationships first + $this->connection->beginTransaction(); + try { + $query = $this->connection->getQueryBuilder(); + $query->delete(self::TAG_GROUP_TABLE) + ->where($query->expr()->eq('systemtagid', $query->createNamedParameter($tag->getId()))) + ->execute(); + + // add each group id + $query = $this->connection->getQueryBuilder(); + $query->insert(self::TAG_GROUP_TABLE) + ->values([ + 'systemtagid' => $query->createNamedParameter($tag->getId()), + 'gid' => $query->createParameter('gid'), + ]); + foreach ($groupIds as $groupId) { + $query->setParameter('gid', $groupId); + $query->execute(); + } + + $this->connection->commit(); + } catch (\Exception $e) { + $this->connection->rollback(); + throw $e; + } + } + + /** + * {@inheritdoc} + */ + public function getTagGroups(ISystemTag $tag) { + $groupIds = []; + $query = $this->connection->getQueryBuilder(); + $query->select('gid') + ->from(self::TAG_GROUP_TABLE) + ->where($query->expr()->eq('systemtagid', $query->createNamedParameter($tag->getId()))) + ->orderBy('gid'); + + $result = $query->execute(); + while ($row = $result->fetch()) { + $groupIds[] = $row['gid']; + } + + $result->closeCursor(); + + return $groupIds; + } } diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 3f074fa8adf..7104f46fea2 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -362,6 +362,10 @@ class Session implements IUserSession, Emitter { // user does not exist return false; } + if (!$user->isEnabled()) { + // disabled users can not log in + return false; + } //login $this->setUser($user); diff --git a/lib/public/api.php b/lib/public/API.php index 4d68bef6f29..4d68bef6f29 100644 --- a/lib/public/api.php +++ b/lib/public/API.php diff --git a/lib/public/app.php b/lib/public/App.php index c3ba90cea41..c3ba90cea41 100644 --- a/lib/public/app.php +++ b/lib/public/App.php diff --git a/lib/public/autoloadnotallowedexception.php b/lib/public/AutoloadNotAllowedException.php index f0028b7d49d..f0028b7d49d 100644 --- a/lib/public/autoloadnotallowedexception.php +++ b/lib/public/AutoloadNotAllowedException.php diff --git a/lib/public/backgroundjob.php b/lib/public/BackgroundJob.php index f532a97c747..f532a97c747 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/BackgroundJob.php diff --git a/lib/public/BackgroundJob/IJobList.php b/lib/public/BackgroundJob/IJobList.php index 5a76ce1ba26..9e401e68419 100644 --- a/lib/public/BackgroundJob/IJobList.php +++ b/lib/public/BackgroundJob/IJobList.php @@ -93,10 +93,21 @@ interface IJobList { public function setLastJob($job); /** + * Remove the reservation for a job + * + * @param IJob $job + * @since 9.1.0 + */ + public function unlockJob($job); + + /** * get the id of the last ran job * * @return int * @since 7.0.0 + * @deprecated 9.1.0 - The functionality behind the value is deprecated, it + * only tells you which job finished last, but since we now allow multiple + * executors to run in parallel, it's not used to calculate the next job. */ public function getLastJob(); diff --git a/lib/public/Comments/CommentsEntityEvent.php b/lib/public/Comments/CommentsEntityEvent.php new file mode 100644 index 00000000000..5f012a79885 --- /dev/null +++ b/lib/public/Comments/CommentsEntityEvent.php @@ -0,0 +1,76 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * + * @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 <http://www.gnu.org/licenses/> + * + */ + +namespace OCP\Comments; + +use Symfony\Component\EventDispatcher\Event; + +/** + * Class CommentsEntityEvent + * + * @package OCP\Comments + * @since 9.1.0 + */ +class CommentsEntityEvent extends Event { + + const EVENT_ENTITY = 'OCP\Comments\ICommentsManager::registerEntity'; + + /** @var string */ + protected $event; + /** @var \Closure[] */ + protected $collections; + + /** + * DispatcherEvent constructor. + * + * @param string $event + * @since 9.1.0 + */ + public function __construct($event) { + $this->event = $event; + $this->collections = []; + } + + /** + * @param string $name + * @param \Closure $entityExistsFunction The closure should take one + * argument, which is the id of the entity, that comments + * should be handled for. The return should then be bool, + * depending on whether comments are allowed (true) or not. + * @throws \OutOfBoundsException when the entity name is already taken + * @since 9.1.0 + */ + public function addEntityCollection($name, \Closure $entityExistsFunction) { + if (isset($this->collections[$name])) { + throw new \OutOfBoundsException('Duplicate entity name "' . $name . '"'); + } + + $this->collections[$name] = $entityExistsFunction; + } + + /** + * @return \Closure[] + * @since 9.1.0 + */ + public function getEntityCollections() { + return $this->collections; + } +} diff --git a/lib/public/config.php b/lib/public/Config.php index 5b5dcb0e78e..5b5dcb0e78e 100644 --- a/lib/public/config.php +++ b/lib/public/Config.php diff --git a/lib/public/constants.php b/lib/public/Constants.php index abf5f95eb96..abf5f95eb96 100644 --- a/lib/public/constants.php +++ b/lib/public/Constants.php diff --git a/lib/public/contacts.php b/lib/public/Contacts.php index 590fd9af1bd..590fd9af1bd 100644 --- a/lib/public/contacts.php +++ b/lib/public/Contacts.php diff --git a/lib/public/db.php b/lib/public/DB.php index 4706c5e95ee..4706c5e95ee 100644 --- a/lib/public/db.php +++ b/lib/public/DB.php diff --git a/lib/public/defaults.php b/lib/public/Defaults.php index 58b25d5914a..58b25d5914a 100644 --- a/lib/public/defaults.php +++ b/lib/public/Defaults.php diff --git a/lib/public/files.php b/lib/public/Files.php index f7f0b30bf86..f7f0b30bf86 100644 --- a/lib/public/files.php +++ b/lib/public/Files.php diff --git a/lib/public/groupinterface.php b/lib/public/GroupInterface.php index 628bc2f42ef..628bc2f42ef 100644 --- a/lib/public/groupinterface.php +++ b/lib/public/GroupInterface.php diff --git a/lib/public/iaddressbook.php b/lib/public/IAddressBook.php index 63e7e061448..63e7e061448 100644 --- a/lib/public/iaddressbook.php +++ b/lib/public/IAddressBook.php diff --git a/lib/public/iappconfig.php b/lib/public/IAppConfig.php index 1406e8a56d6..1406e8a56d6 100644 --- a/lib/public/iappconfig.php +++ b/lib/public/IAppConfig.php diff --git a/lib/public/iavatar.php b/lib/public/IAvatar.php index 7b811b26b68..7b811b26b68 100644 --- a/lib/public/iavatar.php +++ b/lib/public/IAvatar.php diff --git a/lib/public/iavatarmanager.php b/lib/public/IAvatarManager.php index ef6b00ffd13..ef6b00ffd13 100644 --- a/lib/public/iavatarmanager.php +++ b/lib/public/IAvatarManager.php diff --git a/lib/public/icache.php b/lib/public/ICache.php index a1ce068d819..a1ce068d819 100644 --- a/lib/public/icache.php +++ b/lib/public/ICache.php diff --git a/lib/public/icachefactory.php b/lib/public/ICacheFactory.php index 233a4f5525d..233a4f5525d 100644 --- a/lib/public/icachefactory.php +++ b/lib/public/ICacheFactory.php diff --git a/lib/public/icertificate.php b/lib/public/ICertificate.php index c3a003fbf0a..c3a003fbf0a 100644 --- a/lib/public/icertificate.php +++ b/lib/public/ICertificate.php diff --git a/lib/public/icertificatemanager.php b/lib/public/ICertificateManager.php index 27eebcf0491..27eebcf0491 100644 --- a/lib/public/icertificatemanager.php +++ b/lib/public/ICertificateManager.php diff --git a/lib/public/iconfig.php b/lib/public/IConfig.php index 8dac390a99c..8dac390a99c 100644 --- a/lib/public/iconfig.php +++ b/lib/public/IConfig.php diff --git a/lib/public/icontainer.php b/lib/public/IContainer.php index d23ee5ea3b5..d23ee5ea3b5 100644 --- a/lib/public/icontainer.php +++ b/lib/public/IContainer.php diff --git a/lib/public/idbconnection.php b/lib/public/IDBConnection.php index 780fcd26364..4ecf01ca27e 100644 --- a/lib/public/idbconnection.php +++ b/lib/public/IDBConnection.php @@ -125,6 +125,25 @@ interface IDBConnection { public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []); /** + * Create an exclusive read+write lock on a table + * + * Important Note: Due to the nature how locks work on different DBs, it is + * only possible to lock one table at a time. You should also NOT start a + * transaction while holding a lock. + * + * @param string $tableName + * @since 9.1.0 + */ + public function lockTable($tableName); + + /** + * Release a previous acquired lock again + * + * @since 9.1.0 + */ + public function unlockTable(); + + /** * Start a transaction * @since 6.0.0 */ diff --git a/lib/public/idatetimeformatter.php b/lib/public/IDateTimeFormatter.php index e8d357ae50f..e8d357ae50f 100644 --- a/lib/public/idatetimeformatter.php +++ b/lib/public/IDateTimeFormatter.php diff --git a/lib/public/idatetimezone.php b/lib/public/IDateTimeZone.php index 3df705a2413..3df705a2413 100644 --- a/lib/public/idatetimezone.php +++ b/lib/public/IDateTimeZone.php diff --git a/lib/public/idb.php b/lib/public/IDb.php index f21fedd1f54..f21fedd1f54 100644 --- a/lib/public/idb.php +++ b/lib/public/IDb.php diff --git a/lib/public/ieventsource.php b/lib/public/IEventSource.php index b643d1c9da7..b643d1c9da7 100644 --- a/lib/public/ieventsource.php +++ b/lib/public/IEventSource.php diff --git a/lib/public/igroup.php b/lib/public/IGroup.php index 02f2ef201fd..02f2ef201fd 100644 --- a/lib/public/igroup.php +++ b/lib/public/IGroup.php diff --git a/lib/public/igroupmanager.php b/lib/public/IGroupManager.php index cda40606f9d..cda40606f9d 100644 --- a/lib/public/igroupmanager.php +++ b/lib/public/IGroupManager.php diff --git a/lib/public/ihelper.php b/lib/public/IHelper.php index 4ad1d5704fd..4ad1d5704fd 100644 --- a/lib/public/ihelper.php +++ b/lib/public/IHelper.php diff --git a/lib/public/iimage.php b/lib/public/IImage.php index db0ca0f93be..db0ca0f93be 100644 --- a/lib/public/iimage.php +++ b/lib/public/IImage.php diff --git a/lib/public/il10n.php b/lib/public/IL10N.php index f1954eeb4b9..f1954eeb4b9 100644 --- a/lib/public/il10n.php +++ b/lib/public/IL10N.php diff --git a/lib/public/ilogger.php b/lib/public/ILogger.php index fa947612fcd..fa947612fcd 100644 --- a/lib/public/ilogger.php +++ b/lib/public/ILogger.php diff --git a/lib/public/imemcache.php b/lib/public/IMemcache.php index b5c0cef923d..b5c0cef923d 100644 --- a/lib/public/imemcache.php +++ b/lib/public/IMemcache.php diff --git a/lib/public/imemcachettl.php b/lib/public/IMemcacheTTL.php index f2d03dcdf40..f2d03dcdf40 100644 --- a/lib/public/imemcachettl.php +++ b/lib/public/IMemcacheTTL.php diff --git a/lib/public/inavigationmanager.php b/lib/public/INavigationManager.php index 243f6ea3eea..243f6ea3eea 100644 --- a/lib/public/inavigationmanager.php +++ b/lib/public/INavigationManager.php diff --git a/lib/public/ipreview.php b/lib/public/IPreview.php index cfcbebd8639..cfcbebd8639 100644 --- a/lib/public/ipreview.php +++ b/lib/public/IPreview.php diff --git a/lib/public/irequest.php b/lib/public/IRequest.php index 296c70f4ecc..296c70f4ecc 100644 --- a/lib/public/irequest.php +++ b/lib/public/IRequest.php diff --git a/lib/public/isearch.php b/lib/public/ISearch.php index ec6673dabbd..ec6673dabbd 100644 --- a/lib/public/isearch.php +++ b/lib/public/ISearch.php diff --git a/lib/public/isession.php b/lib/public/ISession.php index 7bc8654a1b9..7bc8654a1b9 100644 --- a/lib/public/isession.php +++ b/lib/public/ISession.php diff --git a/lib/public/itagmanager.php b/lib/public/ITagManager.php index e6d67ddd02c..e6d67ddd02c 100644 --- a/lib/public/itagmanager.php +++ b/lib/public/ITagManager.php diff --git a/lib/public/itags.php b/lib/public/ITags.php index cbc178c37bf..cbc178c37bf 100644 --- a/lib/public/itags.php +++ b/lib/public/ITags.php diff --git a/lib/public/itempmanager.php b/lib/public/ITempManager.php index 025e43d8563..025e43d8563 100644 --- a/lib/public/itempmanager.php +++ b/lib/public/ITempManager.php diff --git a/lib/public/iurlgenerator.php b/lib/public/IURLGenerator.php index a702ca47bfc..a702ca47bfc 100644 --- a/lib/public/iurlgenerator.php +++ b/lib/public/IURLGenerator.php diff --git a/lib/public/iuser.php b/lib/public/IUser.php index 16617a2f2f6..16617a2f2f6 100644 --- a/lib/public/iuser.php +++ b/lib/public/IUser.php diff --git a/lib/public/iuserbackend.php b/lib/public/IUserBackend.php index 5cd7945dd7a..5cd7945dd7a 100644 --- a/lib/public/iuserbackend.php +++ b/lib/public/IUserBackend.php diff --git a/lib/public/iusermanager.php b/lib/public/IUserManager.php index 00c0bbc8721..00c0bbc8721 100644 --- a/lib/public/iusermanager.php +++ b/lib/public/IUserManager.php diff --git a/lib/public/iusersession.php b/lib/public/IUserSession.php index 2196f2c8ce0..2196f2c8ce0 100644 --- a/lib/public/iusersession.php +++ b/lib/public/IUserSession.php diff --git a/lib/public/image.php b/lib/public/Image.php index 4a7ffe8bc9a..4a7ffe8bc9a 100644 --- a/lib/public/image.php +++ b/lib/public/Image.php diff --git a/lib/public/json.php b/lib/public/JSON.php index fceffa0001e..fceffa0001e 100644 --- a/lib/public/json.php +++ b/lib/public/JSON.php diff --git a/lib/public/lock/ilockingprovider.php b/lib/public/Lock/ILockingProvider.php index b4b579bbc7a..b4b579bbc7a 100644 --- a/lib/public/lock/ilockingprovider.php +++ b/lib/public/Lock/ILockingProvider.php diff --git a/lib/public/lock/lockedexception.php b/lib/public/Lock/LockedException.php index d084046046e..d084046046e 100644 --- a/lib/public/lock/lockedexception.php +++ b/lib/public/Lock/LockedException.php diff --git a/lib/public/mail/imailer.php b/lib/public/Mail/IMailer.php index e3c751277ac..e3c751277ac 100644 --- a/lib/public/mail/imailer.php +++ b/lib/public/Mail/IMailer.php diff --git a/lib/public/migration/ioutput.php b/lib/public/Migration/IOutput.php index d3b43028495..d3b43028495 100644 --- a/lib/public/migration/ioutput.php +++ b/lib/public/Migration/IOutput.php diff --git a/lib/public/migration/irepairstep.php b/lib/public/Migration/IRepairStep.php index 07830a935f9..07830a935f9 100644 --- a/lib/public/migration/irepairstep.php +++ b/lib/public/Migration/IRepairStep.php diff --git a/lib/public/notification/iaction.php b/lib/public/Notification/IAction.php index 1f4d1d5b7fe..1f4d1d5b7fe 100644 --- a/lib/public/notification/iaction.php +++ b/lib/public/Notification/IAction.php diff --git a/lib/public/notification/iapp.php b/lib/public/Notification/IApp.php index 98da265559b..98da265559b 100644 --- a/lib/public/notification/iapp.php +++ b/lib/public/Notification/IApp.php diff --git a/lib/public/notification/imanager.php b/lib/public/Notification/IManager.php index a18af747b10..a18af747b10 100644 --- a/lib/public/notification/imanager.php +++ b/lib/public/Notification/IManager.php diff --git a/lib/public/notification/inotification.php b/lib/public/Notification/INotification.php index 2d8557ec64d..2d8557ec64d 100644 --- a/lib/public/notification/inotification.php +++ b/lib/public/Notification/INotification.php diff --git a/lib/public/notification/inotifier.php b/lib/public/Notification/INotifier.php index 0d9cecc88b8..0d9cecc88b8 100644 --- a/lib/public/notification/inotifier.php +++ b/lib/public/Notification/INotifier.php diff --git a/lib/public/preconditionnotmetexception.php b/lib/public/PreConditionNotMetException.php index 212efc08ded..212efc08ded 100644 --- a/lib/public/preconditionnotmetexception.php +++ b/lib/public/PreConditionNotMetException.php diff --git a/lib/public/preview/iprovider.php b/lib/public/Preview/IProvider.php index 8231e90f000..8231e90f000 100644 --- a/lib/public/preview/iprovider.php +++ b/lib/public/Preview/IProvider.php diff --git a/lib/public/response.php b/lib/public/Response.php index a2a7667684a..a2a7667684a 100644 --- a/lib/public/response.php +++ b/lib/public/Response.php diff --git a/lib/public/route/iroute.php b/lib/public/Route/IRoute.php index 904cb81b0bd..904cb81b0bd 100644 --- a/lib/public/route/iroute.php +++ b/lib/public/Route/IRoute.php diff --git a/lib/public/route/irouter.php b/lib/public/Route/IRouter.php index b4573fb39f2..b4573fb39f2 100644 --- a/lib/public/route/irouter.php +++ b/lib/public/Route/IRouter.php diff --git a/lib/public/sabrepluginevent.php b/lib/public/SabrePluginEvent.php index 11d939aee47..11d939aee47 100644 --- a/lib/public/sabrepluginevent.php +++ b/lib/public/SabrePluginEvent.php diff --git a/lib/public/sabrepluginexception.php b/lib/public/SabrePluginException.php index 2c5a799c4f7..2c5a799c4f7 100644 --- a/lib/public/sabrepluginexception.php +++ b/lib/public/SabrePluginException.php diff --git a/lib/public/security/icontentsecuritypolicymanager.php b/lib/public/Security/IContentSecurityPolicyManager.php index 10f1efe995f..10f1efe995f 100644 --- a/lib/public/security/icontentsecuritypolicymanager.php +++ b/lib/public/Security/IContentSecurityPolicyManager.php diff --git a/lib/public/security/icredentialsmanager.php b/lib/public/Security/ICredentialsManager.php index d576bbcfbd8..d576bbcfbd8 100644 --- a/lib/public/security/icredentialsmanager.php +++ b/lib/public/Security/ICredentialsManager.php diff --git a/lib/public/security/icrypto.php b/lib/public/Security/ICrypto.php index 62f27017ab7..62f27017ab7 100644 --- a/lib/public/security/icrypto.php +++ b/lib/public/Security/ICrypto.php diff --git a/lib/public/security/ihasher.php b/lib/public/Security/IHasher.php index 39ba5094b12..39ba5094b12 100644 --- a/lib/public/security/ihasher.php +++ b/lib/public/Security/IHasher.php diff --git a/lib/public/security/isecurerandom.php b/lib/public/Security/ISecureRandom.php index 9b346afe680..9b346afe680 100644 --- a/lib/public/security/isecurerandom.php +++ b/lib/public/Security/ISecureRandom.php diff --git a/lib/public/security/stringutils.php b/lib/public/Security/StringUtils.php index ff1e290315a..ff1e290315a 100644 --- a/lib/public/security/stringutils.php +++ b/lib/public/Security/StringUtils.php diff --git a/lib/public/share.php b/lib/public/Share.php index 9c62ec703e4..9c62ec703e4 100644 --- a/lib/public/share.php +++ b/lib/public/Share.php diff --git a/lib/public/share_backend.php b/lib/public/Share_Backend.php index 110403c1f49..110403c1f49 100644 --- a/lib/public/share_backend.php +++ b/lib/public/Share_Backend.php diff --git a/lib/public/share_backend_collection.php b/lib/public/Share_Backend_Collection.php index 185cf32ce3e..185cf32ce3e 100644 --- a/lib/public/share_backend_collection.php +++ b/lib/public/Share_Backend_Collection.php diff --git a/lib/public/share_backend_file_dependent.php b/lib/public/Share_Backend_File_Dependent.php index 64b3bf43319..64b3bf43319 100644 --- a/lib/public/share_backend_file_dependent.php +++ b/lib/public/Share_Backend_File_Dependent.php diff --git a/lib/public/systemtag/isystemtag.php b/lib/public/SystemTag/ISystemTag.php index 02d02037293..02d02037293 100644 --- a/lib/public/systemtag/isystemtag.php +++ b/lib/public/SystemTag/ISystemTag.php diff --git a/lib/public/systemtag/isystemtagmanager.php b/lib/public/SystemTag/ISystemTagManager.php index 983bfd636ce..35447b05fdc 100644 --- a/lib/public/systemtag/isystemtagmanager.php +++ b/lib/public/SystemTag/ISystemTagManager.php @@ -22,6 +22,9 @@ namespace OCP\SystemTag; +use OCP\IUser; +use OCP\SystemTag\ISystemTag; + /** * Public interface to access and manage system-wide tags. * @@ -113,4 +116,49 @@ interface ISystemTagManager { */ public function deleteTags($tagIds); + /** + * Checks whether the given user is allowed to assign/unassign the tag with the + * given id. + * + * @param ISystemTag $tag tag to check permission for + * @param IUser $user user to check permission for + * + * @return true if the user is allowed to assign/unassign the tag, false otherwise + * + * @since 9.1.0 + */ + public function canUserAssignTag(ISystemTag $tag, IUser $user); + + /** + * Checks whether the given user is allowed to see the tag with the given id. + * + * @param ISystemTag $tag tag to check permission for + * @param IUser $user user to check permission for + * + * @return true if the user can see the tag, false otherwise + * + * @since 9.1.0 + */ + public function canUserSeeTag(ISystemTag $tag, IUser $userId); + + /** + * Set groups that can assign a given tag. + * + * @param ISystemTag $tag tag for group assignment + * @param string[] $groupIds group ids of groups that can assign/unassign the tag + * + * @since 9.1.0 + */ + public function setTagGroups(ISystemTag $tag, $groupIds); + + /** + * Get groups that can assign a given tag. + * + * @param ISystemTag $tag tag for group assignment + * + * @return string[] group ids of groups that can assign/unassign the tag + * + * @since 9.1.0 + */ + public function getTagGroups(ISystemTag $tag); } diff --git a/lib/public/systemtag/isystemtagmanagerfactory.php b/lib/public/SystemTag/ISystemTagManagerFactory.php index ad7467633b1..ad7467633b1 100644 --- a/lib/public/systemtag/isystemtagmanagerfactory.php +++ b/lib/public/SystemTag/ISystemTagManagerFactory.php diff --git a/lib/public/systemtag/isystemtagobjectmapper.php b/lib/public/SystemTag/ISystemTagObjectMapper.php index 59b988a3656..59b988a3656 100644 --- a/lib/public/systemtag/isystemtagobjectmapper.php +++ b/lib/public/SystemTag/ISystemTagObjectMapper.php diff --git a/lib/public/systemtag/managerevent.php b/lib/public/SystemTag/ManagerEvent.php index a0429fc9f67..a0429fc9f67 100644 --- a/lib/public/systemtag/managerevent.php +++ b/lib/public/SystemTag/ManagerEvent.php diff --git a/lib/public/systemtag/mapperevent.php b/lib/public/SystemTag/MapperEvent.php index e05a5ce09c8..e05a5ce09c8 100644 --- a/lib/public/systemtag/mapperevent.php +++ b/lib/public/SystemTag/MapperEvent.php diff --git a/lib/public/systemtag/tagalreadyexistsexception.php b/lib/public/SystemTag/TagAlreadyExistsException.php index 5c3d86ad642..5c3d86ad642 100644 --- a/lib/public/systemtag/tagalreadyexistsexception.php +++ b/lib/public/SystemTag/TagAlreadyExistsException.php diff --git a/lib/public/systemtag/tagnotfoundexception.php b/lib/public/SystemTag/TagNotFoundException.php index 12feda8f58a..12feda8f58a 100644 --- a/lib/public/systemtag/tagnotfoundexception.php +++ b/lib/public/SystemTag/TagNotFoundException.php diff --git a/lib/public/template.php b/lib/public/Template.php index 7e46745c9d8..7e46745c9d8 100644 --- a/lib/public/template.php +++ b/lib/public/Template.php diff --git a/lib/public/user.php b/lib/public/User.php index 64ac92d2100..64ac92d2100 100644 --- a/lib/public/user.php +++ b/lib/public/User.php diff --git a/lib/public/userinterface.php b/lib/public/UserInterface.php index 954c2d68133..954c2d68133 100644 --- a/lib/public/userinterface.php +++ b/lib/public/UserInterface.php diff --git a/lib/public/util.php b/lib/public/Util.php index 45df62ac735..45df62ac735 100644 --- a/lib/public/util.php +++ b/lib/public/Util.php diff --git a/ocs-provider/index.php b/ocs-provider/index.php index 316b39cace8..20e27e38ce7 100644 --- a/ocs-provider/index.php +++ b/ocs-provider/index.php @@ -20,13 +20,12 @@ */ require_once('../lib/base.php'); -require_once(__DIR__ . '/provider.php'); header('Content-Type: application/json'); $server = \OC::$server; -$controller = new Provider( +$controller = new \OC\OCS\Provider( 'ocs_provider', $server->getRequest(), $server->getAppManager() diff --git a/ocs/routes.php b/ocs/routes.php index af9c3e74137..7f4f78dd35d 100644 --- a/ocs/routes.php +++ b/ocs/routes.php @@ -100,7 +100,25 @@ API::register( // Server-to-Server Sharing if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) { $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing'); - $s2s = new \OCA\Files_Sharing\API\Server2Server($federatedSharingApp->getFederatedShareProvider()); + $addressHandler = new \OCA\FederatedFileSharing\AddressHandler( + \OC::$server->getURLGenerator(), + \OC::$server->getL10N('federatedfilesharing') + ); + $notification = new \OCA\FederatedFileSharing\Notifications( + $addressHandler, + \OC::$server->getHTTPClientService(), + new \OCA\FederatedFileSharing\DiscoveryManager(\OC::$server->getMemCacheFactory(), \OC::$server->getHTTPClientService()), + \OC::$server->getJobList() + ); + $s2s = new OCA\FederatedFileSharing\RequestHandler( + $federatedSharingApp->getFederatedShareProvider(), + \OC::$server->getDatabaseConnection(), + \OC::$server->getShareManager(), + \OC::$server->getRequest(), + $notification, + $addressHandler, + \OC::$server->getUserManager() + ); API::register('post', '/cloud/shares', array($s2s, 'createShare'), @@ -109,6 +127,21 @@ if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) { ); API::register('post', + '/cloud/shares/{id}/reshare', + array($s2s, 'reShare'), + 'files_sharing', + API::GUEST_AUTH + ); + + API::register('post', + '/cloud/shares/{id}/permissions', + array($s2s, 'updatePermissions'), + 'files_sharing', + API::GUEST_AUTH + ); + + + API::register('post', '/cloud/shares/{id}/accept', array($s2s, 'acceptShare'), 'files_sharing', @@ -128,4 +161,11 @@ if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) { 'files_sharing', API::GUEST_AUTH ); + + API::register('post', + '/cloud/shares/{id}/revoke', + array($s2s, 'revoke'), + 'files_sharing', + API::GUEST_AUTH + ); } diff --git a/settings/js/settings.js b/settings/js/settings.js index fcbe328b76f..5a2ba4bcec7 100644 --- a/settings/js/settings.js +++ b/settings/js/settings.js @@ -16,10 +16,13 @@ OC.Settings = _.extend(OC.Settings, { * for groups) * * @param $elements jQuery element (hidden input) to setup select2 on - * @param [extraOptions] extra options hash to pass to select2 + * @param {Array} [extraOptions] extra options hash to pass to select2 + * @param {Array} [options] extra options + * @param {Array} [options.excludeAdmins=false] flag whether to exclude admin groups */ - setupGroupsSelect: function($elements, extraOptions) { + setupGroupsSelect: function($elements, extraOptions, options) { var self = this; + options = options || {}; if ($elements.length > 0) { // note: settings are saved through a "change" event registered // on all input fields @@ -48,9 +51,11 @@ OC.Settings = _.extend(OC.Settings, { var results = []; // add groups - $.each(data.data.adminGroups, function(i, group) { - results.push({id:group.id, displayname:group.name}); - }); + if (!options.excludeAdmins) { + $.each(data.data.adminGroups, function(i, group) { + results.push({id:group.id, displayname:group.name}); + }); + } $.each(data.data.groups, function(i, group) { results.push({id:group.id, displayname:group.name}); }); diff --git a/settings/l10n/lv.js b/settings/l10n/lv.js index 43a526fb657..90538cf7ef5 100644 --- a/settings/l10n/lv.js +++ b/settings/l10n/lv.js @@ -120,12 +120,15 @@ OC.L10N.register( "Hide description …" : "Slēpt aprakstu …", "Online documentation" : "Tiešsaistes dokumentācija", "Forum" : "Forums", + "You are using <strong>%s</strong> of <strong>%s</strong>" : "Jūs izmantojiet <strong>%s</strong> no <strong>%s</strong>", "Profile picture" : "Profila attēls", "Upload new" : "Ielādēt jaunu", "Remove image" : "Novākt attēlu", "Cancel" : "Atcelt", + "Full name" : "Pilns vārds", "Email" : "E-pasts", "Your email address" : "Jūsu e-pasta adrese", + "You are member of the following groups:" : "Jūs esat šādu grupu biedrs:", "Password" : "Parole", "Unable to change your password" : "Nevar nomainīt jūsu paroli", "Current password" : "Pašreizējā parole", diff --git a/settings/l10n/lv.json b/settings/l10n/lv.json index 1c6e84569eb..9c5bd4f7aa6 100644 --- a/settings/l10n/lv.json +++ b/settings/l10n/lv.json @@ -118,12 +118,15 @@ "Hide description …" : "Slēpt aprakstu …", "Online documentation" : "Tiešsaistes dokumentācija", "Forum" : "Forums", + "You are using <strong>%s</strong> of <strong>%s</strong>" : "Jūs izmantojiet <strong>%s</strong> no <strong>%s</strong>", "Profile picture" : "Profila attēls", "Upload new" : "Ielādēt jaunu", "Remove image" : "Novākt attēlu", "Cancel" : "Atcelt", + "Full name" : "Pilns vārds", "Email" : "E-pasts", "Your email address" : "Jūsu e-pasta adrese", + "You are member of the following groups:" : "Jūs esat šādu grupu biedrs:", "Password" : "Parole", "Unable to change your password" : "Nevar nomainīt jūsu paroli", "Current password" : "Pašreizējā parole", diff --git a/settings/l10n/ro.js b/settings/l10n/ro.js index 2484ce4b60d..e0d750a6c8c 100644 --- a/settings/l10n/ro.js +++ b/settings/l10n/ro.js @@ -88,6 +88,7 @@ OC.L10N.register( "Less" : "Mai puțin", "Especially when using the desktop client for file syncing the use of SQLite is discouraged." : "În special atunci când este folosit clientul desktop pentru sincronizarea fișierelor, utilizarea SQLite este nerecomandată.", "Version" : "Versiunea", + "Cheers!" : "Noroc!", "Forum" : "Forum", "Profile picture" : "Imagine de profil", "Upload new" : "Încarcă una nouă", @@ -107,6 +108,7 @@ OC.L10N.register( "Android app" : "Aplicatie Android", "iOS app" : "Aplicație iOS", "Username" : "Nume utilizator", + "E-Mail" : "Email", "Create" : "Crează", "Admin Recovery Password" : "Parolă de recuperare a Administratorului", "Enter the recovery password in order to recover the users files during password change" : "Introdu parola de recuperare pentru a recupera fișierele utilizatorilor în timpul schimbării parolei", diff --git a/settings/l10n/ro.json b/settings/l10n/ro.json index e9807ae3359..57b068f61fe 100644 --- a/settings/l10n/ro.json +++ b/settings/l10n/ro.json @@ -86,6 +86,7 @@ "Less" : "Mai puțin", "Especially when using the desktop client for file syncing the use of SQLite is discouraged." : "În special atunci când este folosit clientul desktop pentru sincronizarea fișierelor, utilizarea SQLite este nerecomandată.", "Version" : "Versiunea", + "Cheers!" : "Noroc!", "Forum" : "Forum", "Profile picture" : "Imagine de profil", "Upload new" : "Încarcă una nouă", @@ -105,6 +106,7 @@ "Android app" : "Aplicatie Android", "iOS app" : "Aplicație iOS", "Username" : "Nume utilizator", + "E-Mail" : "Email", "Create" : "Crează", "Admin Recovery Password" : "Parolă de recuperare a Administratorului", "Enter the recovery password in order to recover the users files during password change" : "Introdu parola de recuperare pentru a recupera fișierele utilizatorilor în timpul schimbării parolei", diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 86bedc3f325..c58d9f58522 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -8,7 +8,8 @@ if ($configDir) { require_once __DIR__ . '/../lib/base.php'; -\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); +\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true); +\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true); // load all enabled apps \OC_App::loadApps(); diff --git a/tests/lib/api.php b/tests/lib/APITest.php index 1d1f97c4942..d3ab6db9e4b 100644 --- a/tests/lib/api.php +++ b/tests/lib/APITest.php @@ -6,7 +6,9 @@ * See the COPYING-README file. */ -class Test_API extends \Test\TestCase { +namespace Test; + +class APITest extends \Test\TestCase { // Helps build a response variable @@ -14,7 +16,7 @@ class Test_API extends \Test\TestCase { * @param string $message */ function buildResponse($shipped, $data, $code, $message=null) { - $resp = new OC_OCS_Result($data, $code, $message); + $resp = new \OC_OCS_Result($data, $code, $message); $resp->addHeader('KEY', 'VALUE'); return [ 'shipped' => $shipped, @@ -26,13 +28,13 @@ class Test_API extends \Test\TestCase { // Validate details of the result /** - * @param OC_OCS_Result $result + * @param \OC_OCS_Result $result */ function checkResult($result, $success) { // Check response is of correct type $this->assertInstanceOf('OC_OCS_Result', $result); // Check if it succeeded - /** @var $result OC_OCS_Result */ + /** @var $result \OC_OCS_Result */ $this->assertEquals($success, $result->succeeded()); } @@ -108,7 +110,7 @@ class Test_API extends \Test\TestCase { // Test merging one success result $response = $this->buildResponse(true, $data1, $statusCode); - $result = OC_API::mergeResponses([$response]); + $result = \OC_API::mergeResponses([$response]); $this->assertEquals($response['response'], $result); $this->checkResult($result, $succeeded); } @@ -170,7 +172,7 @@ class Test_API extends \Test\TestCase { )); // Two shipped success results - $result = OC_API::mergeResponses(array( + $result = \OC_API::mergeResponses(array( $this->buildResponse($shipped1, $data1, $statusCode1, "message1"), $this->buildResponse($shipped2, $data2, $statusCode2, "message2"), )); diff --git a/tests/lib/activity/managertest.php b/tests/lib/Activity/ManagerTest.php index cf855dd2813..cf855dd2813 100644 --- a/tests/lib/activity/managertest.php +++ b/tests/lib/Activity/ManagerTest.php diff --git a/tests/lib/allconfig.php b/tests/lib/AllConfigTest.php index 869bf9b8d66..4f8b0658b80 100644 --- a/tests/lib/allconfig.php +++ b/tests/lib/AllConfigTest.php @@ -9,13 +9,13 @@ namespace Test; /** - * Class TestAllConfig + * Class AllConfigTest * * @group DB * * @package Test */ -class TestAllConfig extends \Test\TestCase { +class AllConfigTest extends \Test\TestCase { /** @var \OCP\IDBConnection */ protected $connection; diff --git a/tests/lib/app/codechecker/codecheckertest.php b/tests/lib/App/CodeChecker/CodeCheckerTest.php index cdbb7c17da5..cdbb7c17da5 100644 --- a/tests/lib/app/codechecker/codecheckertest.php +++ b/tests/lib/App/CodeChecker/CodeCheckerTest.php diff --git a/tests/lib/app/codechecker/deprecationchecktest.php b/tests/lib/App/CodeChecker/DeprecationCheckTest.php index ee69f075a61..ee69f075a61 100644 --- a/tests/lib/app/codechecker/deprecationchecktest.php +++ b/tests/lib/App/CodeChecker/DeprecationCheckTest.php diff --git a/tests/lib/app/codechecker/infocheckertest.php b/tests/lib/App/CodeChecker/InfoCheckerTest.php index c6df5a715a1..1032e800be1 100644 --- a/tests/lib/app/codechecker/infocheckertest.php +++ b/tests/lib/App/CodeChecker/InfoCheckerTest.php @@ -19,13 +19,14 @@ * */ -namespace OC\App\CodeChecker; +namespace Test\App\CodeChecker; +use OC\App\CodeChecker\InfoChecker; use OC\App\InfoParser; use Test\TestCase; class InfoCheckerTest extends TestCase { - /** @var InfoChecker */ + /** @var InfoChecker */ protected $infoChecker; public static function setUpBeforeClass() { diff --git a/tests/lib/app/codechecker/mock/testlist.php b/tests/lib/App/CodeChecker/Mock/TestList.php index 1fe83293acf..1fe83293acf 100644 --- a/tests/lib/app/codechecker/mock/testlist.php +++ b/tests/lib/App/CodeChecker/Mock/TestList.php diff --git a/tests/lib/app/codechecker/nodevisitortest.php b/tests/lib/App/CodeChecker/NodeVisitorTest.php index 0b5aea28324..ca0b6e9ccc1 100644 --- a/tests/lib/app/codechecker/nodevisitortest.php +++ b/tests/lib/App/CodeChecker/NodeVisitorTest.php @@ -6,7 +6,7 @@ * See the COPYING-README file. */ -namespace Test\AppCodeChecker; +namespace Test\App\CodeChecker; use OC\App\CodeChecker\CodeChecker; use OC\App\CodeChecker\EmptyCheck; diff --git a/tests/lib/app/codechecker/strongcomparisonchecktest.php b/tests/lib/App/CodeChecker/StrongComparisonCheckTest.php index c73eae286ab..c73eae286ab 100644 --- a/tests/lib/app/codechecker/strongcomparisonchecktest.php +++ b/tests/lib/App/CodeChecker/StrongComparisonCheckTest.php diff --git a/tests/lib/app/dependencyanalyzer.php b/tests/lib/App/DependencyAnalyzerTest.php index eee0bc29083..7882f6dd031 100644 --- a/tests/lib/app/dependencyanalyzer.php +++ b/tests/lib/App/DependencyAnalyzerTest.php @@ -14,7 +14,7 @@ use OC\App\Platform; use OCP\IL10N; use Test\TestCase; -class DependencyAnalyzer extends TestCase { +class DependencyAnalyzerTest extends TestCase { /** @var Platform */ private $platformMock; diff --git a/tests/lib/app/infoparser.php b/tests/lib/App/InfoParserTest.php index cb89dd0131c..7f52507bcf7 100644 --- a/tests/lib/app/infoparser.php +++ b/tests/lib/App/InfoParserTest.php @@ -13,7 +13,7 @@ use OC; use OCP\IURLGenerator; use Test\TestCase; -class InfoParser extends TestCase { +class InfoParserTest extends TestCase { /** @var \OC\App\InfoParser */ private $parser; diff --git a/tests/lib/app/manager.php b/tests/lib/App/ManagerTest.php index ef7c01658e1..26584829b5f 100644 --- a/tests/lib/app/manager.php +++ b/tests/lib/App/ManagerTest.php @@ -19,7 +19,7 @@ use Test\TestCase; * @package Test\App * @group DB */ -class Manager extends TestCase { +class ManagerTest extends TestCase { /** * @return \OCP\IAppConfig | \PHPUnit_Framework_MockObject_MockObject */ diff --git a/tests/lib/app/platformrepository.php b/tests/lib/App/PlatformRepositoryTest.php index 3d8849ce8ab..783f8f473ff 100644 --- a/tests/lib/app/platformrepository.php +++ b/tests/lib/App/PlatformRepositoryTest.php @@ -11,7 +11,7 @@ namespace Test\App; use OC; -class PlatformRepository extends \Test\TestCase { +class PlatformRepositoryTest extends \Test\TestCase { /** * @dataProvider providesVersions diff --git a/tests/lib/appconfig.php b/tests/lib/AppConfigTest.php index 64f0f80e045..520dbf66d36 100644 --- a/tests/lib/appconfig.php +++ b/tests/lib/AppConfigTest.php @@ -7,18 +7,16 @@ * See the COPYING-README file. */ -namespace Test\Lib; - -use Test\TestCase; +namespace Test; /** - * Class AppConfig + * Class AppConfigTest * * @group DB * - * @package Test\Lib + * @package Test */ -class AppConfig extends TestCase { +class AppConfigTest extends TestCase { /** @var \OCP\IAppConfig */ protected $appConfig; diff --git a/tests/lib/appframework/AppTest.php b/tests/lib/AppFramework/AppTest.php index 3d41d6590aa..7288e686d52 100644 --- a/tests/lib/appframework/AppTest.php +++ b/tests/lib/AppFramework/AppTest.php @@ -22,8 +22,9 @@ */ -namespace OC\AppFramework; +namespace Test\AppFramework; +use OC\AppFramework\App; use OCP\AppFramework\Http\Response; diff --git a/tests/lib/appframework/controller/ApiControllerTest.php b/tests/lib/AppFramework/Controller/ApiControllerTest.php index 137e5950f67..783eecf93e5 100644 --- a/tests/lib/appframework/controller/ApiControllerTest.php +++ b/tests/lib/AppFramework/Controller/ApiControllerTest.php @@ -22,9 +22,10 @@ */ -namespace OCP\AppFramework; +namespace Test\AppFramework\Controller; use OC\AppFramework\Http\Request; +use OCP\AppFramework\ApiController; class ChildApiController extends ApiController {}; diff --git a/tests/lib/appframework/controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php index 1493c0c3175..521799a46ce 100644 --- a/tests/lib/appframework/controller/ControllerTest.php +++ b/tests/lib/AppFramework/Controller/ControllerTest.php @@ -22,9 +22,10 @@ */ -namespace OCP\AppFramework; +namespace Test\AppFramework\Controller; use OC\AppFramework\Http\Request; +use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\Http\DataResponse; diff --git a/tests/lib/appframework/controller/OCSControllerTest.php b/tests/lib/AppFramework/Controller/OCSControllerTest.php index 92b092cf0e9..f69740d4496 100644 --- a/tests/lib/appframework/controller/OCSControllerTest.php +++ b/tests/lib/AppFramework/Controller/OCSControllerTest.php @@ -22,10 +22,11 @@ */ -namespace OCP\AppFramework; +namespace Test\AppFramework\Controller; use OC\AppFramework\Http\Request; use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\OCSController; class ChildOCSController extends OCSController {} diff --git a/tests/lib/appframework/db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php index 161e11d8030..e1a3d7533be 100644 --- a/tests/lib/appframework/db/EntityTest.php +++ b/tests/lib/AppFramework/Db/EntityTest.php @@ -21,7 +21,10 @@ * */ -namespace OCP\AppFramework\Db; +namespace Test\AppFramework\Db; + + +use OCP\AppFramework\Db\Entity; /** diff --git a/tests/lib/appframework/db/mappertest.php b/tests/lib/AppFramework/Db/MapperTest.php index 108e4eee28e..108e4eee28e 100644 --- a/tests/lib/appframework/db/mappertest.php +++ b/tests/lib/AppFramework/Db/MapperTest.php diff --git a/tests/lib/appframework/db/mappertestutility.php b/tests/lib/AppFramework/Db/MapperTestUtility.php index 69f0ad4eb67..69f0ad4eb67 100644 --- a/tests/lib/appframework/db/mappertestutility.php +++ b/tests/lib/AppFramework/Db/MapperTestUtility.php diff --git a/tests/lib/appframework/dependencyinjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php index fc15b5a44ee..5aa000fa25a 100644 --- a/tests/lib/appframework/dependencyinjection/DIContainerTest.php +++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php @@ -24,10 +24,10 @@ */ -namespace OC\AppFramework\DependencyInjection; +namespace Test\AppFramework\DependencyInjection; -use \OC\AppFramework\Http\Request; +use \OC\AppFramework\Http\Request; class DIContainerTest extends \Test\TestCase { diff --git a/tests/lib/appframework/http/ContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php index adf03185e9f..82f2b3873b7 100644 --- a/tests/lib/appframework/http/ContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php @@ -7,7 +7,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http; use OCP\AppFramework\Http\ContentSecurityPolicy; diff --git a/tests/lib/appframework/http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php index e3d5689d54c..cde553cdf5f 100644 --- a/tests/lib/appframework/http/DataResponseTest.php +++ b/tests/lib/AppFramework/Http/DataResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; diff --git a/tests/lib/appframework/http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 02c86df8e72..6df6f7fa7fe 100644 --- a/tests/lib/appframework/http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -22,8 +22,10 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; +use OC\AppFramework\Http\Dispatcher; +use OC\AppFramework\Http\Request; use OC\AppFramework\Utility\ControllerMethodReflector; use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; diff --git a/tests/lib/appframework/http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php index 5e5db2c55ec..07c932b2725 100644 --- a/tests/lib/appframework/http/DownloadResponseTest.php +++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php @@ -22,9 +22,11 @@ */ -namespace OCP\AppFramework\Http; +namespace Test\AppFramework\Http; +use OCP\AppFramework\Http\DownloadResponse; + class ChildDownloadResponse extends DownloadResponse { }; diff --git a/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php index 0d0f92de819..248c3d808d2 100644 --- a/tests/lib/appframework/http/EmptyContentSecurityPolicyTest.php +++ b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php @@ -7,7 +7,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http; use OCP\AppFramework\Http\EmptyContentSecurityPolicy; diff --git a/tests/lib/appframework/http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php index 4bcc8305db4..66256d1a86f 100644 --- a/tests/lib/appframework/http/HttpTest.php +++ b/tests/lib/AppFramework/Http/HttpTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OC\AppFramework\Http; diff --git a/tests/lib/appframework/http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php index a98f5fc894a..23a55e7eee8 100644 --- a/tests/lib/appframework/http/JSONResponseTest.php +++ b/tests/lib/AppFramework/Http/JSONResponseTest.php @@ -24,7 +24,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; diff --git a/tests/lib/appframework/http/OCSResponseTest.php b/tests/lib/AppFramework/Http/OCSResponseTest.php index 1ca3e330bad..adac66a231c 100644 --- a/tests/lib/appframework/http/OCSResponseTest.php +++ b/tests/lib/AppFramework/Http/OCSResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\OCSResponse; diff --git a/tests/lib/appframework/http/RedirectResponseTest.php b/tests/lib/AppFramework/Http/RedirectResponseTest.php index 723f6600c55..5ef82a1221d 100644 --- a/tests/lib/appframework/http/RedirectResponseTest.php +++ b/tests/lib/AppFramework/Http/RedirectResponseTest.php @@ -22,9 +22,10 @@ */ -namespace OCP\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http; +use OCP\AppFramework\Http\RedirectResponse; class RedirectResponseTest extends \Test\TestCase { diff --git a/tests/lib/appframework/http/requeststream.php b/tests/lib/AppFramework/Http/RequestStream.php index e1bf5c2c6bb..8f6dffd4e91 100644 --- a/tests/lib/appframework/http/requeststream.php +++ b/tests/lib/AppFramework/Http/RequestStream.php @@ -1,4 +1,7 @@ <?php + +namespace Test\AppFramework\Http; + /** * Copy of http://dk1.php.net/manual/en/stream.streamwrapper.example-1.php * Used to simulate php://input for Request tests diff --git a/tests/lib/appframework/http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 3f1d09c2a93..ddc2403d866 100644 --- a/tests/lib/appframework/http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -8,8 +8,9 @@ * See the COPYING-README file. */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; +use OC\AppFramework\Http\Request; use OC\Security\CSRF\CsrfToken; use OC\Security\CSRF\CsrfTokenManager; use OCP\Security\ISecureRandom; @@ -33,11 +34,10 @@ class RequestTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - require_once __DIR__ . '/requeststream.php'; if (in_array('fakeinput', stream_get_wrappers())) { stream_wrapper_unregister('fakeinput'); } - stream_wrapper_register('fakeinput', 'RequestStream'); + stream_wrapper_register('fakeinput', 'Test\AppFramework\Http\RequestStream'); $this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(); $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index f845f02d984..0c582f8f6ea 100644 --- a/tests/lib/appframework/http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\Response; diff --git a/tests/lib/appframework/http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php index 4c47ecfbd6c..1f761d6b89c 100644 --- a/tests/lib/appframework/http/StreamResponseTest.php +++ b/tests/lib/AppFramework/Http/StreamResponseTest.php @@ -22,10 +22,11 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\StreamResponse; +use OCP\AppFramework\Http\IOutput; use OCP\AppFramework\Http; diff --git a/tests/lib/appframework/http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php index 2ec57f8979a..87fb6864f78 100644 --- a/tests/lib/appframework/http/TemplateResponseTest.php +++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework\Http; +namespace Test\AppFramework\Http; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http; diff --git a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php index a8731525798..f81aca106d6 100644 --- a/tests/lib/appframework/middleware/MiddlewareDispatcherTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework; +namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\MiddlewareDispatcher; diff --git a/tests/lib/appframework/middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php index 33f04e1383d..013403a9a4a 100644 --- a/tests/lib/appframework/middleware/MiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php @@ -22,7 +22,7 @@ */ -namespace OC\AppFramework; +namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OCP\AppFramework\Middleware; diff --git a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index cf5f97a046f..8e53c9202cf 100644 --- a/tests/lib/appframework/middleware/security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -10,9 +10,10 @@ */ -namespace OC\AppFramework\Middleware\Security; +namespace Test\AppFramework\Middleware\Security; use OC\AppFramework\Http\Request; +use OC\AppFramework\Middleware\Security\CORSMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; use OCP\AppFramework\Http; diff --git a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index f70308dc731..8cdba76d835 100644 --- a/tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -22,7 +22,7 @@ -namespace OC\AppFramework\Middleware\Security; +namespace Test\AppFramework\Middleware\Security; use OC\AppFramework\Http; use OC\AppFramework\Http\Request; @@ -31,6 +31,7 @@ use OC\AppFramework\Middleware\Security\Exceptions\CrossSiteRequestForgeryExcept use OC\AppFramework\Middleware\Security\Exceptions\NotAdminException; use OC\AppFramework\Middleware\Security\Exceptions\NotLoggedInException; use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; +use OC\AppFramework\Middleware\Security\SecurityMiddleware; use OC\AppFramework\Utility\ControllerMethodReflector; use OC\Security\CSP\ContentSecurityPolicy; use OCP\AppFramework\Http\RedirectResponse; diff --git a/tests/lib/appframework/middleware/sessionmiddlewaretest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php index 11c1600f515..17fcc1904c1 100644 --- a/tests/lib/appframework/middleware/sessionmiddlewaretest.php +++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php @@ -10,7 +10,7 @@ */ -namespace OC\AppFramework\Middleware\Security; +namespace Test\AppFramework\Middleware; use OC\AppFramework\Http\Request; use OC\AppFramework\Middleware\SessionMiddleware; diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php index 3ceab1aac48..326c156af98 100644 --- a/tests/lib/appframework/routing/RoutingTest.php +++ b/tests/lib/AppFramework/Routing/RoutingTest.php @@ -1,8 +1,10 @@ <?php -namespace OC\AppFramework\Routing; +namespace Test\AppFramework\Routing; use OC\AppFramework\DependencyInjection\DIContainer; +use OC\AppFramework\Routing\RouteActionHandler; +use OC\AppFramework\Routing\RouteConfig; class RoutingTest extends \Test\TestCase { diff --git a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index c643c362a9c..92d767e9987 100644 --- a/tests/lib/appframework/utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -22,9 +22,11 @@ */ -namespace OC\AppFramework\Utility; +namespace Test\AppFramework\Utility; +use OC\AppFramework\Utility\ControllerMethodReflector; + class BaseController { /** @@ -66,7 +68,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadAnnotation(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotation' ); @@ -81,7 +83,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadAnnotationNoLowercase(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotationNoLowercase' ); @@ -97,7 +99,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeIntAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeIntAnnotations' ); @@ -117,7 +119,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeIntAnnotationsScalarTypes(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments3' ); @@ -135,7 +137,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeDoubleAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeDoubleAnnotations' ); @@ -149,7 +151,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReadTypeWhitespaceAnnotations(){ $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeWhitespaceAnnotations' ); @@ -161,7 +163,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReflectParameters() { $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments' ); @@ -173,7 +175,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testReflectParameters2() { $reader = new ControllerMethodReflector(); $reader->reflect( - '\OC\AppFramework\Utility\ControllerMethodReflectorTest', + '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments2' ); @@ -183,7 +185,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testInheritance() { $reader = new ControllerMethodReflector(); - $reader->reflect('OC\AppFramework\Utility\EndController', 'test'); + $reader->reflect('Test\AppFramework\Utility\EndController', 'test'); $this->assertTrue($reader->hasAnnotation('Annotation')); } @@ -191,7 +193,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testInheritanceOverride() { $reader = new ControllerMethodReflector(); - $reader->reflect('OC\AppFramework\Utility\EndController', 'test2'); + $reader->reflect('Test\AppFramework\Utility\EndController', 'test2'); $this->assertTrue($reader->hasAnnotation('NoAnnotation')); $this->assertFalse($reader->hasAnnotation('Annotation')); @@ -200,7 +202,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { public function testInheritanceOverrideNoDocblock() { $reader = new ControllerMethodReflector(); - $reader->reflect('OC\AppFramework\Utility\EndController', 'test3'); + $reader->reflect('Test\AppFramework\Utility\EndController', 'test3'); $this->assertFalse($reader->hasAnnotation('Annotation')); } diff --git a/tests/lib/appframework/utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php index e21e0ca13f2..e21e0ca13f2 100644 --- a/tests/lib/appframework/utility/SimpleContainerTest.php +++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php diff --git a/tests/lib/app.php b/tests/lib/AppTest.php index e7255ad955a..2e5b6f74ab7 100644 --- a/tests/lib/app.php +++ b/tests/lib/AppTest.php @@ -7,12 +7,15 @@ * See the COPYING-README file. */ +namespace Test; +use OCP\IAppConfig; + /** - * Class Test_App + * Class AppTest * * @group DB */ -class Test_App extends \Test\TestCase { +class AppTest extends \Test\TestCase { const TEST_USER1 = 'user1'; const TEST_USER2 = 'user2'; @@ -267,7 +270,7 @@ class Test_App extends \Test\TestCase { * @dataProvider appVersionsProvider */ public function testIsAppCompatible($ocVersion, $appInfo, $expectedResult) { - $this->assertEquals($expectedResult, OC_App::isAppCompatible($ocVersion, $appInfo)); + $this->assertEquals($expectedResult, \OC_App::isAppCompatible($ocVersion, $appInfo)); } /** @@ -280,7 +283,7 @@ class Test_App extends \Test\TestCase { 'requiremin' => '6', 'requiremax' => '6', ); - $this->assertTrue(OC_App::isAppCompatible($ocVersion, $appInfo)); + $this->assertTrue(\OC_App::isAppCompatible($ocVersion, $appInfo)); } /** @@ -478,9 +481,9 @@ class Test_App extends \Test\TestCase { /** * Register an app config mock for testing purposes. * - * @param $appConfig app config mock + * @param IAppConfig $appConfig app config mock */ - private function registerAppConfig($appConfig) { + private function registerAppConfig(IAppConfig $appConfig) { \OC::$server->registerService('AppConfig', function ($c) use ($appConfig) { return $appConfig; }); diff --git a/tests/lib/archive/tar.php b/tests/lib/Archive/TARTest.php index 2d20bb4c3b1..998ce201e72 100644 --- a/tests/lib/archive/tar.php +++ b/tests/lib/Archive/TARTest.php @@ -6,23 +6,26 @@ * See the COPYING-README file. */ +namespace Test\Archive; + + use OC\Archive\TAR; -class Test_Archive_TAR extends Test_Archive { +class TARTest extends TestBase { protected function setUp() { parent::setUp(); - if (OC_Util::runningOnWindows()) { + if (\OC_Util::runningOnWindows()) { $this->markTestSkipped('[Windows] tar archives are not supported on Windows'); } } protected function getExisting() { - $dir = OC::$SERVERROOT . '/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; return new TAR($dir . '/data.tar.gz'); } protected function getNew() { - return new TAR(OCP\Files::tmpFile('.tar.gz')); + return new TAR(\OCP\Files::tmpFile('.tar.gz')); } } diff --git a/tests/lib/archive.php b/tests/lib/Archive/TestBase.php index 690b4378b88..5bf4d9d43ea 100644 --- a/tests/lib/archive.php +++ b/tests/lib/Archive/TestBase.php @@ -6,20 +6,23 @@ * See the COPYING-README file. */ -abstract class Test_Archive extends \Test\TestCase { +namespace Test\Archive; + + +abstract class TestBase extends \Test\TestCase { /** - * @var OC_Archive + * @var \OC\Archive\Archive */ protected $instance; /** * get the existing test archive - * @return OC_Archive + * @return \OC\Archive\Archive */ abstract protected function getExisting(); /** * get a new archive for write testing - * @return OC_Archive + * @return \OC\Archive\Archive */ abstract protected function getNew(); @@ -51,17 +54,17 @@ abstract class Test_Archive extends \Test\TestCase { public function testContent() { $this->instance=$this->getExisting(); - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $textFile=$dir.'/lorem.txt'; $this->assertEquals(file_get_contents($textFile), $this->instance->getFile('lorem.txt')); - $tmpFile=OCP\Files::tmpFile('.txt'); + $tmpFile=\OCP\Files::tmpFile('.txt'); $this->instance->extractFile('lorem.txt', $tmpFile); $this->assertEquals(file_get_contents($textFile), file_get_contents($tmpFile)); } public function testWrite() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $textFile=$dir.'/lorem.txt'; $this->instance=$this->getNew(); $this->assertEquals(0, count($this->instance->getFiles())); @@ -76,7 +79,7 @@ abstract class Test_Archive extends \Test\TestCase { } public function testReadStream() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getExisting(); $fh=$this->instance->getStream('lorem.txt', 'r'); $this->assertTrue((bool)$fh); @@ -85,11 +88,11 @@ abstract class Test_Archive extends \Test\TestCase { $this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content); } public function testWriteStream() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getNew(); $fh=$this->instance->getStream('lorem.txt', 'w'); $source=fopen($dir.'/lorem.txt', 'r'); - OCP\Files::streamCopy($source, $fh); + \OCP\Files::streamCopy($source, $fh); fclose($source); fclose($fh); $this->assertTrue($this->instance->fileExists('lorem.txt')); @@ -107,18 +110,18 @@ abstract class Test_Archive extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('/test/')); } public function testExtract() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getExisting(); - $tmpDir=OCP\Files::tmpFolder(); + $tmpDir=\OCP\Files::tmpFolder(); $this->instance->extract($tmpDir); $this->assertEquals(true, file_exists($tmpDir.'lorem.txt')); $this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt')); $this->assertEquals(true, file_exists($tmpDir.'logo-wide.png')); $this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt')); - OCP\Files::rmdirr($tmpDir); + \OCP\Files::rmdirr($tmpDir); } public function testMoveRemove() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $textFile=$dir.'/lorem.txt'; $this->instance=$this->getNew(); $this->instance->addFile('lorem.txt', $textFile); @@ -131,7 +134,7 @@ abstract class Test_Archive extends \Test\TestCase { $this->assertFalse($this->instance->fileExists('target.txt')); } public function testRecursive() { - $dir=OC::$SERVERROOT.'/tests/data'; + $dir=\OC::$SERVERROOT.'/tests/data'; $this->instance=$this->getNew(); $this->instance->addRecursive('/dir', $dir); $this->assertTrue($this->instance->fileExists('/dir/lorem.txt')); diff --git a/tests/lib/archive/zip.php b/tests/lib/Archive/ZIPTest.php index 2f4c9cace1d..8d639e0d686 100644 --- a/tests/lib/archive/zip.php +++ b/tests/lib/Archive/ZIPTest.php @@ -6,23 +6,26 @@ * See the COPYING-README file. */ +namespace Test\Archive; + + use OC\Archive\ZIP; -class Test_Archive_ZIP extends Test_Archive { +class ZIPTest extends TestBase { protected function setUp() { parent::setUp(); - if (OC_Util::runningOnWindows()) { + if (\OC_Util::runningOnWindows()) { $this->markTestSkipped('[Windows] '); } } protected function getExisting() { - $dir = OC::$SERVERROOT . '/tests/data'; + $dir = \OC::$SERVERROOT . '/tests/data'; return new ZIP($dir . '/data.zip'); } protected function getNew() { - return new ZIP(OCP\Files::tmpFile('.zip')); + return new ZIP(\OCP\Files::tmpFile('.zip')); } } diff --git a/tests/lib/authentication/token/defaulttokencleanupjobtest.php b/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php index c9082c08b30..c9082c08b30 100644 --- a/tests/lib/authentication/token/defaulttokencleanupjobtest.php +++ b/tests/lib/Authentication/Token/DefaultTokenCleanupJobTest.php diff --git a/tests/lib/authentication/token/defaulttokenmappertest.php b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php index 9a21e143fb4..e17149a5c1b 100644 --- a/tests/lib/authentication/token/defaulttokenmappertest.php +++ b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php @@ -141,4 +141,22 @@ class DefaultTokenMapperTest extends TestCase { $this->mapper->getToken($token); } + public function testGetTokenByUser() { + $user = $this->getMock('\OCP\IUser'); + $user->expects($this->once()) + ->method('getUID') + ->will($this->returnValue('user1')); + + $this->assertCount(2, $this->mapper->getTokenByUser($user)); + } + + public function testGetTokenByUserNotFound() { + $user = $this->getMock('\OCP\IUser'); + $user->expects($this->once()) + ->method('getUID') + ->will($this->returnValue('user1000')); + + $this->assertCount(0, $this->mapper->getTokenByUser($user)); + } + } diff --git a/tests/lib/authentication/token/defaulttokenprovidertest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php index 1902227a4fa..eeb249cfa8a 100644 --- a/tests/lib/authentication/token/defaulttokenprovidertest.php +++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php @@ -103,6 +103,16 @@ class DefaultTokenProviderTest extends TestCase { $this->assertEquals($this->time, $tk->getLastActivity()); } + + public function testGetTokenByUser() { + $user = $this->getMock('\OCP\IUser'); + $this->mapper->expects($this->once()) + ->method('getTokenByUser') + ->with($user) + ->will($this->returnValue(['token'])); + + $this->assertEquals(['token'], $this->tokenProvider->getTokenByUser($user)); + } public function testGetPassword() { $token = 'token1234'; diff --git a/tests/lib/autoloader.php b/tests/lib/AutoLoaderTest.php index adea702eca9..38ba29bc085 100644 --- a/tests/lib/autoloader.php +++ b/tests/lib/AutoLoaderTest.php @@ -8,7 +8,7 @@ namespace Test; -class AutoLoader extends TestCase { +class AutoLoaderTest extends TestCase { /** * @var \OC\Autoloader $loader */ @@ -19,34 +19,16 @@ class AutoLoader extends TestCase { $this->loader = new \OC\AutoLoader([]); } - public function testLeadingSlashOnClassName() { - $this->assertEquals([ - \OC::$SERVERROOT . '/lib/public/files/storage/local.php', - ], $this->loader->findClass('\OCP\Files\Storage\Local')); - } - - public function testNoLeadingSlashOnClassName() { - $this->assertEquals([ - \OC::$SERVERROOT . '/lib/public/files/storage/local.php', - ], $this->loader->findClass('OCP\Files\Storage\Local')); - } - public function testLegacyPath() { $this->assertEquals([ \OC::$SERVERROOT . '/lib/private/legacy/files.php', ], $this->loader->findClass('OC_Files')); } - public function testLoadTestNamespace() { + public function testLoadTestTestCase() { $this->assertEquals([ - \OC::$SERVERROOT . '/tests/lib/foo/bar.php' - ], $this->loader->findClass('Test\Foo\Bar')); - } - - public function testLoadTest() { - $this->assertEquals([ - \OC::$SERVERROOT . '/tests/lib/foo/bar.php' - ], $this->loader->findClass('Test_Foo_Bar')); + \OC::$SERVERROOT . '/tests/lib/TestCase.php' + ], $this->loader->findClass('Test\TestCase')); } public function testLoadCore() { @@ -56,9 +38,7 @@ class AutoLoader extends TestCase { } public function testLoadPublicNamespace() { - $this->assertEquals([ - \OC::$SERVERROOT . '/lib/public/foo/bar.php', - ], $this->loader->findClass('OCP\Foo\Bar')); + $this->assertEquals([], $this->loader->findClass('OCP\Foo\Bar')); } public function testLoadAppNamespace() { diff --git a/tests/lib/avatarmanagertest.php b/tests/lib/AvatarManagerTest.php index f5cdd99176d..2dd6ff34923 100644 --- a/tests/lib/avatarmanagertest.php +++ b/tests/lib/AvatarManagerTest.php @@ -18,6 +18,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + +namespace Test; + use OC\AvatarManager; use Test\Traits\UserTrait; use Test\Traits\MountProviderTrait; @@ -48,7 +51,7 @@ class AvatarManagerTest extends \Test\TestCase { } /** - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage user does not exist */ public function testGetAvatarInvalidUser() { diff --git a/tests/lib/avatartest.php b/tests/lib/AvatarTest.php index b0ab4cb8b5c..0a00f5d5614 100644 --- a/tests/lib/avatartest.php +++ b/tests/lib/AvatarTest.php @@ -1,5 +1,4 @@ <?php - /** * Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it> * This file is licensed under the Affero General Public License version 3 or @@ -7,23 +6,25 @@ * See the COPYING-README file. */ +namespace Test; + use OCP\Files\Folder; class AvatarTest extends \Test\TestCase { - /** @var Folder | PHPUnit_Framework_MockObject_MockObject */ + /** @var Folder | \PHPUnit_Framework_MockObject_MockObject */ private $folder; /** @var \OC\Avatar */ private $avatar; - /** @var \OC\User\User | PHPUnit_Framework_MockObject_MockObject $user */ + /** @var \OC\User\User | \PHPUnit_Framework_MockObject_MockObject $user */ private $user; public function setUp() { parent::setUp(); $this->folder = $this->getMock('\OCP\Files\Folder'); - /** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject $l */ + /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */ $l = $this->getMock('\OCP\IL10N'); $l->method('t')->will($this->returnArgument(0)); $this->user = $this->getMockBuilder('\OC\User\User')->disableOriginalConstructor()->getMock(); @@ -41,7 +42,7 @@ class AvatarTest extends \Test\TestCase { ['avatar.128.jpg', true], ])); - $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $file = $this->getMock('\OCP\Files\File'); $file->method('getContent')->willReturn($expected->data()); @@ -56,7 +57,7 @@ class AvatarTest extends \Test\TestCase { ['avatar.jpg', true], ])); - $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $file = $this->getMock('\OCP\Files\File'); $file->method('getContent')->willReturn($expected->data()); @@ -72,8 +73,8 @@ class AvatarTest extends \Test\TestCase { ['avatar.32.png', false], ])); - $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); - $expected2 = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $expected2 = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $expected2->resize(32); $file = $this->getMock('\OCP\Files\File'); @@ -157,7 +158,7 @@ class AvatarTest extends \Test\TestCase { ->with('avatar.png') ->willReturn($newFile); - $image = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); + $image = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png'); $newFile->expects($this->once()) ->method('putContent') ->with($image->data()); diff --git a/tests/lib/backgroundjob/dummyjoblist.php b/tests/lib/BackgroundJob/DummyJobList.php index 6cc690fd553..6cc690fd553 100644 --- a/tests/lib/backgroundjob/dummyjoblist.php +++ b/tests/lib/BackgroundJob/DummyJobList.php diff --git a/tests/lib/backgroundjob/joblist.php b/tests/lib/BackgroundJob/JobListTest.php index fcc3c440818..b8dcb735a26 100644 --- a/tests/lib/backgroundjob/joblist.php +++ b/tests/lib/BackgroundJob/JobListTest.php @@ -9,7 +9,7 @@ namespace Test\BackgroundJob; use OCP\BackgroundJob\IJob; -use OCP\IDBConnection; +use OCP\DB\QueryBuilder\IQueryBuilder; use Test\TestCase; /** @@ -18,24 +18,35 @@ use Test\TestCase; * @group DB * @package Test\BackgroundJob */ -class JobList extends TestCase { +class JobListTest extends TestCase { /** @var \OC\BackgroundJob\JobList */ protected $instance; + /** @var \OCP\IDBConnection */ + protected $connection; + /** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */ protected $config; + /** @var \OCP\AppFramework\Utility\ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $timeFactory; + protected function setUp() { parent::setUp(); - $connection = \OC::$server->getDatabaseConnection(); - $this->clearJobsList($connection); - $this->config = $this->getMock('\OCP\IConfig'); - $this->instance = new \OC\BackgroundJob\JobList($connection, $this->config); + $this->connection = \OC::$server->getDatabaseConnection(); + $this->clearJobsList(); + $this->config = $this->getMock('OCP\IConfig'); + $this->timeFactory = $this->getMock('OCP\AppFramework\Utility\ITimeFactory'); + $this->instance = new \OC\BackgroundJob\JobList( + $this->connection, + $this->config, + $this->timeFactory + ); } - protected function clearJobsList(IDBConnection $connection) { - $query = $connection->getQueryBuilder(); + protected function clearJobsList() { + $query = $this->connection->getQueryBuilder(); $query->delete('jobs'); $query->execute(); } @@ -131,8 +142,6 @@ class JobList extends TestCase { $this->instance->add($job, $argument); $this->assertFalse($this->instance->has($job, 10)); - - $this->instance->remove($job, $argument); } public function testGetLastJob() { @@ -144,50 +153,65 @@ class JobList extends TestCase { $this->assertEquals(15, $this->instance->getLastJob()); } + protected function createTempJob($class, $argument, $reservedTime = 0, $lastChecked = 0) { + if ($lastChecked === 0) { + $lastChecked = time(); + } + + $query = $this->connection->getQueryBuilder(); + $query->insert('jobs') + ->values([ + 'class' => $query->createNamedParameter($class), + 'argument' => $query->createNamedParameter($argument), + 'last_run' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT), + 'last_checked' => $query->createNamedParameter($lastChecked, IQueryBuilder::PARAM_INT), + 'reserved_at' => $query->createNamedParameter($reservedTime, IQueryBuilder::PARAM_INT), + ]); + $query->execute(); + } + public function testGetNext() { $job = new TestJob(); - $this->instance->add($job, 1); - $this->instance->add($job, 2); + $this->createTempJob(get_class($job), 1, 0, 12345); + $this->createTempJob(get_class($job), 2, 0, 12346); $jobs = $this->getAllSorted(); + $savedJob1 = $jobs[0]; - $savedJob1 = $jobs[count($jobs) - 2]; - $savedJob2 = $jobs[count($jobs) - 1]; - - $this->config->expects($this->once()) - ->method('getAppValue') - ->with('backgroundjob', 'lastjob', 0) - ->will($this->returnValue($savedJob2->getId())); - + $this->timeFactory->expects($this->atLeastOnce()) + ->method('getTime') + ->willReturn(123456789); $nextJob = $this->instance->getNext(); $this->assertEquals($savedJob1, $nextJob); - - $this->instance->remove($job, 1); - $this->instance->remove($job, 2); } - public function testGetNextWrapAround() { + public function testGetNextSkipReserved() { $job = new TestJob(); - $this->instance->add($job, 1); - $this->instance->add($job, 2); + $this->createTempJob(get_class($job), 1, 123456789, 12345); + $this->createTempJob(get_class($job), 2, 0, 12346); - $jobs = $this->getAllSorted(); + $this->timeFactory->expects($this->atLeastOnce()) + ->method('getTime') + ->willReturn(123456789); + $nextJob = $this->instance->getNext(); - $savedJob1 = $jobs[count($jobs) - 2]; - $savedJob2 = $jobs[count($jobs) - 1]; + $this->assertEquals(get_class($job), get_class($nextJob)); + $this->assertEquals(2, $nextJob->getArgument()); + } - $this->config->expects($this->once()) - ->method('getAppValue') - ->with('backgroundjob', 'lastjob', 0) - ->will($this->returnValue($savedJob1->getId())); + public function testGetNextSkipNonExisting() { + $job = new TestJob(); + $this->createTempJob('\OC\Non\Existing\Class', 1, 0, 12345); + $this->createTempJob(get_class($job), 2, 0, 12346); + $this->timeFactory->expects($this->atLeastOnce()) + ->method('getTime') + ->willReturn(123456789); $nextJob = $this->instance->getNext(); - $this->assertEquals($savedJob2, $nextJob); - - $this->instance->remove($job, 1); - $this->instance->remove($job, 2); + $this->assertEquals(get_class($job), get_class($nextJob)); + $this->assertEquals(2, $nextJob->getArgument()); } /** @@ -203,8 +227,6 @@ class JobList extends TestCase { $addedJob = $jobs[count($jobs) - 1]; $this->assertEquals($addedJob, $this->instance->getById($addedJob->getId())); - - $this->instance->remove($job, $argument); } public function testSetLastRun() { @@ -223,33 +245,5 @@ class JobList extends TestCase { $this->assertGreaterThanOrEqual($timeStart, $addedJob->getLastRun()); $this->assertLessThanOrEqual($timeEnd, $addedJob->getLastRun()); - - $this->instance->remove($job); - } - - public function testGetNextNonExisting() { - $job = new TestJob(); - $this->instance->add($job, 1); - $this->instance->add('\OC\Non\Existing\Class'); - $this->instance->add($job, 2); - - $jobs = $this->getAllSorted(); - - $savedJob1 = $jobs[count($jobs) - 2]; - $savedJob2 = $jobs[count($jobs) - 1]; - - $this->config->expects($this->any()) - ->method('getAppValue') - ->with('backgroundjob', 'lastjob', 0) - ->will($this->returnValue($savedJob1->getId())); - - $this->instance->getNext(); - - $nextJob = $this->instance->getNext(); - - $this->assertEquals($savedJob2, $nextJob); - - $this->instance->remove($job, 1); - $this->instance->remove($job, 2); } } diff --git a/tests/lib/backgroundjob/job.php b/tests/lib/BackgroundJob/JobTest.php index 12413e2c52a..7923eef11ef 100644 --- a/tests/lib/backgroundjob/job.php +++ b/tests/lib/BackgroundJob/JobTest.php @@ -8,7 +8,7 @@ namespace Test\BackgroundJob; -class Job extends \Test\TestCase { +class JobTest extends \Test\TestCase { private $run = false; protected function setUp() { diff --git a/tests/lib/backgroundjob/queuedjob.php b/tests/lib/BackgroundJob/QueuedJobTest.php index 8d3cd6f907b..a3e9cc296a0 100644 --- a/tests/lib/backgroundjob/queuedjob.php +++ b/tests/lib/BackgroundJob/QueuedJobTest.php @@ -12,7 +12,7 @@ class TestQueuedJob extends \OC\BackgroundJob\QueuedJob { private $testCase; /** - * @param QueuedJob $testCase + * @param QueuedJobTest $testCase */ public function __construct($testCase) { $this->testCase = $testCase; @@ -23,7 +23,7 @@ class TestQueuedJob extends \OC\BackgroundJob\QueuedJob { } } -class QueuedJob extends \Test\TestCase { +class QueuedJobTest extends \Test\TestCase { /** * @var DummyJobList $jobList */ diff --git a/tests/lib/backgroundjob/testjob.php b/tests/lib/BackgroundJob/TestJob.php index 23fc4268d1a..a5ab4454550 100644 --- a/tests/lib/backgroundjob/testjob.php +++ b/tests/lib/BackgroundJob/TestJob.php @@ -18,7 +18,7 @@ class TestJob extends \OC\BackgroundJob\Job { private $callback; /** - * @param Job $testCase + * @param JobTest $testCase * @param callable $callback */ public function __construct($testCase = null, $callback = null) { diff --git a/tests/lib/backgroundjob/timedjob.php b/tests/lib/BackgroundJob/TimedJobTest.php index 7d9bfe979af..5652a5c9901 100644 --- a/tests/lib/backgroundjob/timedjob.php +++ b/tests/lib/BackgroundJob/TimedJobTest.php @@ -12,7 +12,7 @@ class TestTimedJob extends \OC\BackgroundJob\TimedJob { private $testCase; /** - * @param TimedJob $testCase + * @param TimedJobTest $testCase */ public function __construct($testCase) { $this->setInterval(10); @@ -24,7 +24,7 @@ class TestTimedJob extends \OC\BackgroundJob\TimedJob { } } -class TimedJob extends \Test\TestCase { +class TimedJobTest extends \Test\TestCase { /** * @var DummyJobList $jobList */ diff --git a/tests/lib/cache/cappedmemorycache.php b/tests/lib/Cache/CappedMemoryCacheTest.php index a8fb273b80a..27e5df4e265 100644 --- a/tests/lib/cache/cappedmemorycache.php +++ b/tests/lib/Cache/CappedMemoryCacheTest.php @@ -23,13 +23,13 @@ namespace Test\Cache; /** - * Class FileCache + * Class CappedMemoryCacheTest * * @group DB * * @package Test\Cache */ -class CappedMemoryCache extends \Test_Cache { +class CappedMemoryCacheTest extends TestCache { public function setUp() { parent::setUp(); $this->instance = new \OC\Cache\CappedMemoryCache(); diff --git a/tests/lib/cache/file.php b/tests/lib/Cache/FileCacheTest.php index 92b784bf8ea..d2725bf9033 100644 --- a/tests/lib/cache/file.php +++ b/tests/lib/Cache/FileCacheTest.php @@ -23,13 +23,13 @@ namespace Test\Cache; /** - * Class FileCache + * Class FileCacheTest * * @group DB * * @package Test\Cache */ -class FileCache extends \Test_Cache { +class FileCacheTest extends TestCache { /** * @var string * */ diff --git a/tests/lib/cache.php b/tests/lib/Cache/TestCache.php index a91f37467d2..75ff65207ee 100644 --- a/tests/lib/cache.php +++ b/tests/lib/Cache/TestCache.php @@ -6,7 +6,9 @@ * See the COPYING-README file. */ -abstract class Test_Cache extends \Test\TestCase { +namespace Test\Cache; + +abstract class TestCache extends \Test\TestCase { /** * @var \OCP\ICache cache; */ diff --git a/tests/lib/capabilitiesmanager.php b/tests/lib/CapabilitiesManagerTest.php index b5dac80ee51..d4dd52d07f1 100644 --- a/tests/lib/capabilitiesmanager.php +++ b/tests/lib/CapabilitiesManagerTest.php @@ -21,8 +21,6 @@ namespace Test; -use OC\CapabilitiesManager; - class CapabilitiesManagerTest extends TestCase { /** diff --git a/tests/lib/command/asyncbus.php b/tests/lib/Command/AsyncBusTest.php index 183eaa29c37..8c1713f1260 100644 --- a/tests/lib/command/asyncbus.php +++ b/tests/lib/Command/AsyncBusTest.php @@ -17,7 +17,7 @@ use Test\TestCase; class SimpleCommand implements ICommand { public function handle() { - AsyncBus::$lastCommand = 'SimpleCommand'; + AsyncBusTest::$lastCommand = 'SimpleCommand'; } } @@ -29,7 +29,7 @@ class StateFullCommand implements ICommand { } public function handle() { - AsyncBus::$lastCommand = $this->state; + AsyncBusTest::$lastCommand = $this->state; } } @@ -37,18 +37,18 @@ class FilesystemCommand implements ICommand { use FileAccess; public function handle() { - AsyncBus::$lastCommand = 'FileAccess'; + AsyncBusTest::$lastCommand = 'FileAccess'; } } function basicFunction() { - AsyncBus::$lastCommand = 'function'; + AsyncBusTest::$lastCommand = 'function'; } // clean class to prevent phpunit putting closure in $this class ThisClosureTest { private function privateMethod() { - AsyncBus::$lastCommand = 'closure-this'; + AsyncBusTest::$lastCommand = 'closure-this'; } public function test(IBus $bus) { @@ -58,7 +58,7 @@ class ThisClosureTest { } } -class AsyncBus extends TestCase { +class AsyncBusTest extends TestCase { /** * Basic way to check output from a command * @@ -101,7 +101,7 @@ class AsyncBus extends TestCase { } public function testStaticCallable() { - $this->bus->push(['\Test\Command\AsyncBus', 'DummyCommand']); + $this->bus->push(['\Test\Command\AsyncBusTest', 'DummyCommand']); $this->runJobs(); $this->assertEquals('static', self::$lastCommand); } @@ -121,7 +121,7 @@ class AsyncBus extends TestCase { public function testClosure() { $this->bus->push(function () { - AsyncBus::$lastCommand = 'closure'; + AsyncBusTest::$lastCommand = 'closure'; }); $this->runJobs(); $this->assertEquals('closure', self::$lastCommand); diff --git a/tests/lib/command/background.php b/tests/lib/Command/BackgroundJobsTest.php index 7e992480530..6292d5d0e97 100644 --- a/tests/lib/command/background.php +++ b/tests/lib/Command/BackgroundJobsTest.php @@ -33,7 +33,7 @@ use OC\Core\Command\Background\Cron; use OC\Core\Command\Background\WebCron; use OC\Core\Command\Background\Ajax; -class BackgroundJobs extends TestCase { +class BackgroundJobsTest extends TestCase { public function testCronCommand() { $config = \OC::$server->getConfig(); diff --git a/tests/lib/command/integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php index 44a644c45df..44a644c45df 100644 --- a/tests/lib/command/integrity/SignAppTest.php +++ b/tests/lib/Command/Integrity/SignAppTest.php diff --git a/tests/lib/command/integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php index ff1f6b23a95..ff1f6b23a95 100644 --- a/tests/lib/command/integrity/SignCoreTest.php +++ b/tests/lib/Command/Integrity/SignCoreTest.php diff --git a/tests/lib/comments/comment.php b/tests/lib/Comments/CommentTest.php index 9b3f2ab166e..b55c345f71f 100644 --- a/tests/lib/comments/comment.php +++ b/tests/lib/Comments/CommentTest.php @@ -5,8 +5,7 @@ namespace Test\Comments; use OCP\Comments\IComment; use Test\TestCase; -class Test_Comments_Comment extends TestCase -{ +class CommentTest extends TestCase { public function testSettersValidInput() { $comment = new \OC\Comments\Comment(); diff --git a/tests/lib/comments/fakefactory.php b/tests/lib/Comments/FakeFactory.php index ff8dfd3a259..ff8dfd3a259 100644 --- a/tests/lib/comments/fakefactory.php +++ b/tests/lib/Comments/FakeFactory.php diff --git a/tests/lib/comments/fakemanager.php b/tests/lib/Comments/FakeManager.php index 7186529e718..7186529e718 100644 --- a/tests/lib/comments/fakemanager.php +++ b/tests/lib/Comments/FakeManager.php diff --git a/tests/lib/comments/manager.php b/tests/lib/Comments/ManagerTest.php index c55f4728883..90a8399eb2b 100644 --- a/tests/lib/comments/manager.php +++ b/tests/lib/Comments/ManagerTest.php @@ -6,12 +6,11 @@ use OCP\Comments\ICommentsManager; use Test\TestCase; /** - * Class Test_Comments_Manager + * Class ManagerTest * * @group DB */ -class Test_Comments_Manager extends TestCase -{ +class ManagerTest extends TestCase { public function setUp() { parent::setUp(); diff --git a/tests/lib/configtests.php b/tests/lib/ConfigTest.php index c0251e693c6..74dcdc192ce 100644 --- a/tests/lib/configtests.php +++ b/tests/lib/ConfigTest.php @@ -8,7 +8,7 @@ namespace Test; -class ConfigTests extends TestCase { +class ConfigTest extends TestCase { const TESTCONTENT = '<?php $CONFIG=array("foo"=>"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);'; /** @var array */ diff --git a/tests/lib/contactsmanager.php b/tests/lib/ContactsManagerTest.php index 39e44cc6302..89a9cb95b97 100644 --- a/tests/lib/contactsmanager.php +++ b/tests/lib/ContactsManagerTest.php @@ -1,7 +1,8 @@ <?php +namespace Test; -class Test_ContactsManager extends \Test\TestCase { +class ContactsManagerTest extends \Test\TestCase { /** @var \OC\ContactsManager */ private $cm; @@ -206,4 +207,4 @@ class Test_ContactsManager extends \Test\TestCase { $this->assertTrue($result); } -}
\ No newline at end of file +} diff --git a/tests/lib/db/connection.php b/tests/lib/DB/ConnectionTest.php index 4022bee511e..b9c55c23339 100644 --- a/tests/lib/db/connection.php +++ b/tests/lib/DB/ConnectionTest.php @@ -20,7 +20,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder; * * @package Test\DB */ -class Connection extends \Test\TestCase { +class ConnectionTest extends \Test\TestCase { /** * @var \OCP\IDBConnection */ diff --git a/tests/lib/dbschema.php b/tests/lib/DB/DBSchemaTest.php index 11eacbf397f..284fc532c2a 100644 --- a/tests/lib/dbschema.php +++ b/tests/lib/DB/DBSchemaTest.php @@ -1,5 +1,4 @@ <?php - /** * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl> * This file is licensed under the Affero General Public License version 3 or @@ -7,14 +6,17 @@ * See the COPYING-README file. */ +namespace Test\DB; + +use OC_DB; use OCP\Security\ISecureRandom; /** - * Class Test_DBSchema + * Class DBSchemaTest * * @group DB */ -class Test_DBSchema extends \Test\TestCase { +class DBSchemaTest extends \Test\TestCase { protected $schema_file = 'static://test_db_scheme'; protected $schema_file2 = 'static://test_db_scheme2'; protected $table1; @@ -23,8 +25,8 @@ class Test_DBSchema extends \Test\TestCase { protected function setUp() { parent::setUp(); - $dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml'; - $dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml'; + $dbfile = \OC::$SERVERROOT.'/tests/data/db_structure.xml'; + $dbfile2 = \OC::$SERVERROOT.'/tests/data/db_structure2.xml'; $r = '_' . \OC::$server->getSecureRandom()-> generate(4, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS) . '_'; diff --git a/tests/lib/db.php b/tests/lib/DB/LegacyDBTest.php index 88c9ee75b3b..7aeeb3dd1f9 100644 --- a/tests/lib/db.php +++ b/tests/lib/DB/LegacyDBTest.php @@ -6,12 +6,16 @@ * See the COPYING-README file. */ +namespace Test\DB; + +use OC_DB; + /** - * Class Test_DB + * Class LegacyDBTest * * @group DB */ -class Test_DB extends \Test\TestCase { +class LegacyDBTest extends \Test\TestCase { protected $backupGlobals = FALSE; protected static $schema_file = 'static://test_db_scheme'; @@ -45,7 +49,7 @@ class Test_DB extends \Test\TestCase { protected function setUp() { parent::setUp(); - $dbFile = OC::$SERVERROOT.'/tests/data/db_structure.xml'; + $dbFile = \OC::$SERVERROOT.'/tests/data/db_structure.xml'; $r = $this->getUniqueID('_', 4).'_'; $content = file_get_contents( $dbFile ); diff --git a/tests/lib/db/mdb2schemamanager.php b/tests/lib/DB/MDB2SchemaManagerTest.php index fd412bdec2d..93078b4f722 100644 --- a/tests/lib/db/mdb2schemamanager.php +++ b/tests/lib/DB/MDB2SchemaManagerTest.php @@ -18,7 +18,7 @@ use Doctrine\DBAL\Platforms\OraclePlatform; * * @package Test\DB */ -class MDB2SchemaManager extends \Test\TestCase { +class MDB2SchemaManagerTest extends \Test\TestCase { protected function tearDown() { // do not drop the table for Oracle as it will create a bogus transaction diff --git a/tests/lib/db/mdb2schemareader.php b/tests/lib/DB/MDB2SchemaReaderTest.php index 7939c782e80..22c0ba28569 100644 --- a/tests/lib/db/mdb2schemareader.php +++ b/tests/lib/DB/MDB2SchemaReaderTest.php @@ -11,7 +11,7 @@ namespace Test\DB; use Doctrine\DBAL\Platforms\MySqlPlatform; -class MDB2SchemaReader extends \Test\TestCase { +class MDB2SchemaReaderTest extends \Test\TestCase { /** * @var \OC\DB\MDB2SchemaReader $reader */ diff --git a/tests/lib/db/migrator.php b/tests/lib/DB/MigratorTest.php index 84a98c1e338..e4f45c4bb86 100644 --- a/tests/lib/db/migrator.php +++ b/tests/lib/DB/MigratorTest.php @@ -16,13 +16,13 @@ use \Doctrine\DBAL\Schema\SchemaConfig; use OCP\IConfig; /** - * Class Migrator + * Class MigratorTest * * @group DB * * @package Test\DB */ -class Migrator extends \Test\TestCase { +class MigratorTest extends \Test\TestCase { /** * @var \Doctrine\DBAL\Connection $connection */ diff --git a/tests/lib/db/mysqlmigration.php b/tests/lib/DB/MySqlMigrationTest.php index 51e8801dc3b..cdc7ef47784 100644 --- a/tests/lib/db/mysqlmigration.php +++ b/tests/lib/DB/MySqlMigrationTest.php @@ -6,12 +6,14 @@ * See the COPYING-README file. */ +namespace Test\DB; + /** - * Class TestMySqlMigration + * Class MySqlMigration * * @group DB */ -class TestMySqlMigration extends \Test\TestCase { +class MySqlMigrationTest extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ private $connection; diff --git a/tests/lib/db/querybuilder/expressionbuildertest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php index 4122f300c86..4122f300c86 100644 --- a/tests/lib/db/querybuilder/expressionbuildertest.php +++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php diff --git a/tests/lib/db/querybuilder/querybuildertest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index de8f84ac345..de8f84ac345 100644 --- a/tests/lib/db/querybuilder/querybuildertest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php diff --git a/tests/lib/db/querybuilder/quotehelpertest.php b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php index b83d9eed2df..b83d9eed2df 100644 --- a/tests/lib/db/querybuilder/quotehelpertest.php +++ b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php diff --git a/tests/lib/db/sqlitemigration.php b/tests/lib/DB/SqliteMigrationTest.php index f23f4d4ee86..76002e1afce 100644 --- a/tests/lib/db/sqlitemigration.php +++ b/tests/lib/DB/SqliteMigrationTest.php @@ -6,12 +6,14 @@ * See the COPYING-README file. */ +namespace Test\DB; + /** - * Class TestSqliteMigration + * Class SqliteMigration * * @group DB */ -class TestSqliteMigration extends \Test\TestCase { +class SqliteMigrationTest extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ private $connection; diff --git a/tests/lib/db/testschema.xml b/tests/lib/DB/testschema.xml index dfca920a0ef..dfca920a0ef 100644 --- a/tests/lib/db/testschema.xml +++ b/tests/lib/DB/testschema.xml diff --git a/tests/lib/db/ts-autoincrement-after.xml b/tests/lib/DB/ts-autoincrement-after.xml index d4445f1e247..d4445f1e247 100644 --- a/tests/lib/db/ts-autoincrement-after.xml +++ b/tests/lib/DB/ts-autoincrement-after.xml diff --git a/tests/lib/db/ts-autoincrement-before.xml b/tests/lib/DB/ts-autoincrement-before.xml index 412739e9a71..412739e9a71 100644 --- a/tests/lib/db/ts-autoincrement-before.xml +++ b/tests/lib/DB/ts-autoincrement-before.xml diff --git a/tests/lib/datetimeformatter.php b/tests/lib/DateTimeFormatterTest.php index bf1ef3b84dc..0d185128e27 100644 --- a/tests/lib/datetimeformatter.php +++ b/tests/lib/DateTimeFormatterTest.php @@ -8,7 +8,7 @@ namespace Test; -class DateTimeFormatter extends TestCase { +class DateTimeFormatterTest extends TestCase { /** @var \OC\DateTimeFormatter */ protected $formatter; static protected $oneMinute = 60; diff --git a/tests/lib/encryption/decryptalltest.php b/tests/lib/Encryption/DecryptAllTest.php index 85fbe3e0ed9..85fbe3e0ed9 100644 --- a/tests/lib/encryption/decryptalltest.php +++ b/tests/lib/Encryption/DecryptAllTest.php diff --git a/tests/lib/encryption/encryptionwrappertest.php b/tests/lib/Encryption/EncryptionWrapperTest.php index 909187ae43b..909187ae43b 100644 --- a/tests/lib/encryption/encryptionwrappertest.php +++ b/tests/lib/Encryption/EncryptionWrapperTest.php diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/Encryption/Keys/StorageTest.php index b5b91f886a3..b5b91f886a3 100644 --- a/tests/lib/encryption/keys/storage.php +++ b/tests/lib/Encryption/Keys/StorageTest.php diff --git a/tests/lib/encryption/managertest.php b/tests/lib/Encryption/ManagerTest.php index 3dcfc949a18..3dcfc949a18 100644 --- a/tests/lib/encryption/managertest.php +++ b/tests/lib/Encryption/ManagerTest.php diff --git a/tests/lib/encryption/updatetest.php b/tests/lib/Encryption/UpdateTest.php index b222bc42d7a..b222bc42d7a 100644 --- a/tests/lib/encryption/updatetest.php +++ b/tests/lib/Encryption/UpdateTest.php diff --git a/tests/lib/encryption/utiltest.php b/tests/lib/Encryption/UtilTest.php index ec316a9f05a..ec316a9f05a 100644 --- a/tests/lib/encryption/utiltest.php +++ b/tests/lib/Encryption/UtilTest.php diff --git a/tests/lib/errorHandler.php b/tests/lib/ErrorHandlerTest.php index 726529e83f4..aece7f146f6 100644 --- a/tests/lib/errorHandler.php +++ b/tests/lib/ErrorHandlerTest.php @@ -20,7 +20,9 @@ * */ -class Test_ErrorHandler extends \Test\TestCase { +namespace Test; + +class ErrorHandlerTest extends \Test\TestCase { /** * provide username, password combinations for testRemovePassword diff --git a/tests/lib/filechunking.php b/tests/lib/FileChunkingTest.php index 2f3f411275d..66888285d23 100644 --- a/tests/lib/filechunking.php +++ b/tests/lib/FileChunkingTest.php @@ -20,7 +20,7 @@ */ namespace Test; -class FileChunking extends \Test\TestCase { +class FileChunkingTest extends \Test\TestCase { public function dataIsComplete() { return [ diff --git a/tests/lib/files/cache/cache.php b/tests/lib/Files/Cache/CacheTest.php index 54aa7ad789a..615bb32f62c 100644 --- a/tests/lib/files/cache/cache.php +++ b/tests/lib/Files/Cache/CacheTest.php @@ -8,7 +8,6 @@ namespace Test\Files\Cache; -use PHPUnit_Framework_MockObject_MockObject; class LongId extends \OC\Files\Storage\Temporary { public function getId() { @@ -17,13 +16,13 @@ class LongId extends \OC\Files\Storage\Temporary { } /** - * Class Cache + * Class CacheTest * * @group DB * * @package Test\Files\Cache */ -class Cache extends \Test\TestCase { +class CacheTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Temporary $storage ; */ @@ -491,7 +490,7 @@ class Cache extends \Test\TestCase { $folderWith0308 = "\x53\x63\x68\x6f\xcc\x88\x6e"; /** - * @var \OC\Files\Cache\Cache | PHPUnit_Framework_MockObject_MockObject $cacheMock + * @var \OC\Files\Cache\Cache | \PHPUnit_Framework_MockObject_MockObject $cacheMock */ $cacheMock = $this->getMock('\OC\Files\Cache\Cache', array('normalize'), array($this->storage), '', true); diff --git a/tests/lib/files/cache/homecache.php b/tests/lib/Files/Cache/HomeCacheTest.php index e133d0afc55..a144b8cabb8 100644 --- a/tests/lib/files/cache/homecache.php +++ b/tests/lib/Files/Cache/HomeCacheTest.php @@ -44,13 +44,13 @@ class DummyUser extends \OC\User\User { } /** - * Class HomeCache + * Class HomeCacheTest * * @group DB * * @package Test\Files\Cache */ -class HomeCache extends \Test\TestCase { +class HomeCacheTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Home $storage */ diff --git a/tests/lib/files/cache/movefromcachetraittest.php b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php index 614c259d996..3d4a55c0722 100644 --- a/tests/lib/files/cache/movefromcachetraittest.php +++ b/tests/lib/Files/Cache/MoveFromCacheTraitTest.php @@ -15,11 +15,11 @@ class FallBackCrossCacheMoveCache extends \OC\Files\Cache\Cache { } /** - * Class Cache + * Class MoveFromCacheTraitTest * * @group DB */ -class MoveFromCacheTraitTest extends Cache { +class MoveFromCacheTraitTest extends CacheTest { protected function setUp() { parent::setUp(); diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/Files/Cache/ScannerTest.php index b1eb3f589e8..4a93f3ee014 100644 --- a/tests/lib/files/cache/scanner.php +++ b/tests/lib/Files/Cache/ScannerTest.php @@ -10,13 +10,13 @@ namespace Test\Files\Cache; use OC\Files\Cache\CacheEntry; /** - * Class Scanner + * Class ScannerTest * * @group DB * * @package Test\Files\Cache */ -class Scanner extends \Test\TestCase { +class ScannerTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage $storage */ diff --git a/tests/lib/files/cache/updaterlegacy.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php index 09688afd465..7d247968ca9 100644 --- a/tests/lib/files/cache/updaterlegacy.php +++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php @@ -13,13 +13,13 @@ use OC\Files\Storage\Temporary; use OC\Files\View; /** - * Class UpdaterLegacy + * Class UpdaterLegacyTest * * @group DB * * @package Test\Files\Cache */ -class UpdaterLegacy extends \Test\TestCase { +class UpdaterLegacyTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage $storage */ diff --git a/tests/lib/files/cache/updater.php b/tests/lib/Files/Cache/UpdaterTest.php index cdffac464dc..54fb3f3fc97 100644 --- a/tests/lib/files/cache/updater.php +++ b/tests/lib/Files/Cache/UpdaterTest.php @@ -13,13 +13,13 @@ use OC\Files\Storage\Temporary; use OC\Files\View; /** - * Class Updater + * Class UpdaterTest * * @group DB * * @package Test\Files\Cache */ -class Updater extends \Test\TestCase { +class UpdaterTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage */ diff --git a/tests/lib/files/cache/watcher.php b/tests/lib/Files/Cache/WatcherTest.php index cb90e92b477..3834b5591ff 100644 --- a/tests/lib/files/cache/watcher.php +++ b/tests/lib/Files/Cache/WatcherTest.php @@ -9,13 +9,13 @@ namespace Test\Files\Cache; /** - * Class Watcher + * Class WatcherTest * * @group DB * * @package Test\Files\Cache */ -class Watcher extends \Test\TestCase { +class WatcherTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage[] $storages diff --git a/tests/lib/files/cache/wrapper/cachejail.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index 9ddf3e9c61c..6ef6716f721 100644 --- a/tests/lib/files/cache/wrapper/cachejail.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -8,7 +8,7 @@ namespace Test\Files\Cache\Wrapper; -use Test\Files\Cache\Cache; +use Test\Files\Cache\CacheTest; /** * Class CacheJail @@ -17,7 +17,7 @@ use Test\Files\Cache\Cache; * * @package Test\Files\Cache\Wrapper */ -class CacheJail extends Cache { +class CacheJailTest extends CacheTest { /** * @var \OC\Files\Cache\Cache $sourceCache */ diff --git a/tests/lib/files/cache/wrapper/cachepermissionsmask.php b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php index a4cc7edba37..c12b35867ff 100644 --- a/tests/lib/files/cache/wrapper/cachepermissionsmask.php +++ b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php @@ -9,7 +9,7 @@ namespace Test\Files\Cache\Wrapper; use OCP\Constants; -use Test\Files\Cache\Cache; +use Test\Files\Cache\CacheTest; /** * Class CachePermissionsMask @@ -18,7 +18,7 @@ use Test\Files\Cache\Cache; * * @package Test\Files\Cache\Wrapper */ -class CachePermissionsMask extends Cache { +class CachePermissionsMaskTest extends CacheTest { /** * @var \OC\Files\Cache\Cache $sourceCache */ diff --git a/tests/lib/files/config/usermountcache.php b/tests/lib/Files/Config/UserMountCacheTest.php index 070c2f6176d..e7554fc36d9 100644 --- a/tests/lib/files/config/usermountcache.php +++ b/tests/lib/Files/Config/UserMountCacheTest.php @@ -21,7 +21,7 @@ use Test\Util\User\Dummy; /** * @group DB */ -class UserMountCache extends TestCase { +class UserMountCacheTest extends TestCase { /** * @var IDBConnection */ diff --git a/tests/lib/files/etagtest.php b/tests/lib/Files/EtagTest.php index d8e44000f9c..d8e44000f9c 100644 --- a/tests/lib/files/etagtest.php +++ b/tests/lib/Files/EtagTest.php diff --git a/tests/lib/files/filesystem.php b/tests/lib/Files/FilesystemTest.php index b5a3e147259..a4a4345d2f9 100644 --- a/tests/lib/files/filesystem.php +++ b/tests/lib/Files/FilesystemTest.php @@ -52,13 +52,13 @@ class DummyMountProvider implements IMountProvider { } /** - * Class Filesystem + * Class FilesystemTest * * @group DB * * @package Test\Files */ -class Filesystem extends \Test\TestCase { +class FilesystemTest extends \Test\TestCase { const TEST_FILESYSTEM_USER1 = "test-filesystem-user1"; const TEST_FILESYSTEM_USER2 = "test-filesystem-user1"; diff --git a/tests/lib/files/mount/manager.php b/tests/lib/Files/Mount/ManagerTest.php index 78322b47d50..46ae597f56b 100644 --- a/tests/lib/files/mount/manager.php +++ b/tests/lib/Files/Mount/ManagerTest.php @@ -16,7 +16,7 @@ class LongId extends Temporary { } } -class Manager extends \Test\TestCase { +class ManagerTest extends \Test\TestCase { /** * @var \OC\Files\Mount\Manager */ diff --git a/tests/lib/files/mount/mountpoint.php b/tests/lib/Files/Mount/MountPointTest.php index 29610e6058d..392f10c7170 100644 --- a/tests/lib/files/mount/mountpoint.php +++ b/tests/lib/Files/Mount/MountPointTest.php @@ -8,7 +8,7 @@ namespace Test\Files\Mount; -class MountPoint extends \Test\TestCase { +class MountPointTest extends \Test\TestCase { public function testGetStorage() { $storage = $this->getMock('\OCP\Files\Storage'); @@ -23,7 +23,7 @@ class MountPoint extends \Test\TestCase { $mountPoint = new \OC\Files\Mount\MountPoint( // just use this because a real class is needed - '\Test\Files\Mount\MountPoint', + '\Test\Files\Mount\MountPointTest', '/mountpoint', null, $loader @@ -50,7 +50,7 @@ class MountPoint extends \Test\TestCase { $mountPoint = new \OC\Files\Mount\MountPoint( // just use this because a real class is needed - '\Test\Files\Mount\MountPoint', + '\Test\Files\Mount\MountPointTest', '/mountpoint', null, $loader diff --git a/tests/lib/files/mount/mount.php b/tests/lib/Files/Mount/MountTest.php index 584766de836..f21095f2fa5 100644 --- a/tests/lib/files/mount/mount.php +++ b/tests/lib/Files/Mount/MountTest.php @@ -12,7 +12,7 @@ namespace Test\Files\Mount; use OC\Files\Storage\StorageFactory; use OC\Files\Storage\Wrapper\Wrapper; -class Mount extends \Test\TestCase { +class MountTest extends \Test\TestCase { public function testFromStorageObject() { $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary') ->disableOriginalConstructor() diff --git a/tests/lib/files/node/file.php b/tests/lib/Files/Node/FileTest.php index ccc777c499f..180c7b12ce4 100644 --- a/tests/lib/files/node/file.php +++ b/tests/lib/Files/Node/FileTest.php @@ -13,7 +13,7 @@ use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OC\Files\View; -class File extends \Test\TestCase { +class FileTest extends \Test\TestCase { private $user; protected function setUp() { diff --git a/tests/lib/files/node/folder.php b/tests/lib/Files/Node/FolderTest.php index f6d488d6590..7ce9fff1419 100644 --- a/tests/lib/files/node/folder.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -17,13 +17,13 @@ use OCP\Files\NotPermittedException; use OC\Files\View; /** - * Class Folder + * Class FolderTest * * @group DB * * @package Test\Files\Node */ -class Folder extends \Test\TestCase { +class FolderTest extends \Test\TestCase { private $user; protected function setUp() { diff --git a/tests/lib/files/node/hookconnector.php b/tests/lib/Files/Node/HookConnectorTest.php index e2a5e190687..7245dd37593 100644 --- a/tests/lib/files/node/hookconnector.php +++ b/tests/lib/Files/Node/HookConnectorTest.php @@ -18,13 +18,13 @@ use Test\Traits\MountProviderTrait; use Test\Traits\UserTrait; /** - * Class HookConnector + * Class HookConnectorTest * * @group DB * * @package Test\Files\Node */ -class HookConnector extends TestCase { +class HookConnectorTest extends TestCase { use UserTrait; use MountProviderTrait; diff --git a/tests/lib/files/node/integration.php b/tests/lib/Files/Node/IntegrationTest.php index addc7e98f48..f52e0623e14 100644 --- a/tests/lib/files/node/integration.php +++ b/tests/lib/Files/Node/IntegrationTest.php @@ -14,13 +14,13 @@ use OC\Files\View; use OC\User\User; /** - * Class IntegrationTests + * Class IntegrationTest * * @group DB * * @package Test\Files\Node */ -class IntegrationTests extends \Test\TestCase { +class IntegrationTest extends \Test\TestCase { /** * @var \OC\Files\Node\Root $root */ diff --git a/tests/lib/files/node/node.php b/tests/lib/Files/Node/NodeTest.php index a1693b034fa..a9575507b4f 100644 --- a/tests/lib/files/node/node.php +++ b/tests/lib/Files/Node/NodeTest.php @@ -10,7 +10,7 @@ namespace Test\Files\Node; use OC\Files\FileInfo; -class Node extends \Test\TestCase { +class NodeTest extends \Test\TestCase { private $user; protected function setUp() { diff --git a/tests/lib/files/node/root.php b/tests/lib/Files/Node/RootTest.php index 9c77959869d..1b4824cba76 100644 --- a/tests/lib/files/node/root.php +++ b/tests/lib/Files/Node/RootTest.php @@ -15,7 +15,7 @@ use OC\Files\Mount\Manager; /** * @group DB */ -class Root extends \Test\TestCase { +class RootTest extends \Test\TestCase { private $user; protected function setUp() { diff --git a/tests/lib/files/objectstore/noopscanner.php b/tests/lib/Files/ObjectStore/NoopScannerTest.php index f860c03cb18..16bd325a8df 100644 --- a/tests/lib/files/objectstore/noopscanner.php +++ b/tests/lib/Files/ObjectStore/NoopScannerTest.php @@ -9,9 +9,9 @@ * later. * See the COPYING-README file. */ -namespace Test\Files\Cache; +namespace Test\Files\ObjectStore; -class NoopScanner extends \Test\TestCase { +class NoopScannerTest extends \Test\TestCase { /** @var \OC\Files\Storage\Storage $storage */ private $storage; diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/Files/ObjectStore/SwiftTest.php index a63f5844145..9f69e040f87 100644 --- a/tests/lib/files/objectstore/swift.php +++ b/tests/lib/Files/ObjectStore/SwiftTest.php @@ -18,22 +18,22 @@ * */ -namespace OCA\ObjectStore\Tests\Unit; +namespace Test\Files\ObjectStore; use OC\Files\ObjectStore\ObjectStoreStorage; -use OC\Files\ObjectStore\Swift as ObjectStoreToTest; +use OC\Files\ObjectStore\Swift; /** - * Class Swift + * Class SwiftTest * * @group DB * - * @package OCA\ObjectStore\Tests\Unit + * @package Test\Files\Cache\ObjectStore */ -class Swift extends \Test\Files\Storage\Storage { +class SwiftTest extends \Test\Files\Storage\Storage { /** - * @var ObjectStoreToTest + * @var Swift */ private $objectStorage; @@ -63,7 +63,7 @@ class Swift extends \Test\Files\Storage\Storage { \OC_User::setUserId('test'); $config = \OC::$server->getConfig()->getSystemValue('objectstore'); - $this->objectStorage = new ObjectStoreToTest($config['arguments']); + $this->objectStorage = new Swift($config['arguments']); $config['objectstore'] = $this->objectStorage; $this->instance = new ObjectStoreStorage($config); } diff --git a/tests/lib/files/pathverificationtest.php b/tests/lib/Files/PathVerificationTest.php index db393ce5e51..9ce9416455f 100644 --- a/tests/lib/files/pathverificationtest.php +++ b/tests/lib/Files/PathVerificationTest.php @@ -11,13 +11,13 @@ use OC\Files\Storage\Local; use OC\Files\View; /** - * Class PathVerification + * Class PathVerificationTest * * @group DB * * @package Test\Files */ -class PathVerification extends \Test\TestCase { +class PathVerificationTest extends \Test\TestCase { /** * @var \OC\Files\View diff --git a/tests/lib/files/storage/commontest.php b/tests/lib/Files/Storage/CommonTest.php index 38faa9b0b21..38faa9b0b21 100644 --- a/tests/lib/files/storage/commontest.php +++ b/tests/lib/Files/Storage/CommonTest.php diff --git a/tests/lib/files/storage/copydirectory.php b/tests/lib/Files/Storage/CopyDirectoryTest.php index bc066268cda..74b8148aa36 100644 --- a/tests/lib/files/storage/copydirectory.php +++ b/tests/lib/Files/Storage/CopyDirectoryTest.php @@ -37,13 +37,13 @@ class CopyDirectoryStorage extends StorageNoRecursiveCopy { } /** - * Class CopyDirectory + * Class CopyDirectoryTest * * @group DB * * @package Test\Files\Storage */ -class CopyDirectory extends Storage { +class CopyDirectoryTest extends Storage { protected function setUp() { parent::setUp(); diff --git a/tests/lib/files/storage/homestoragequota.php b/tests/lib/Files/Storage/HomeStorageQuotaTest.php index 9a3c6b151fc..68fa4bb0bbb 100644 --- a/tests/lib/files/storage/homestoragequota.php +++ b/tests/lib/Files/Storage/HomeStorageQuotaTest.php @@ -22,11 +22,11 @@ namespace Test\Files\Storage; /** - * Class HomeStorageQuota + * Class HomeStorageQuotaTest * * @group DB */ -class HomeStorageQuota extends \Test\TestCase { +class HomeStorageQuotaTest extends \Test\TestCase { /** * Tests that the home storage is not wrapped when no quota exists. */ diff --git a/tests/lib/files/storage/home.php b/tests/lib/Files/Storage/HomeTest.php index 1ed3b137cd4..d9a1b11849e 100644 --- a/tests/lib/files/storage/home.php +++ b/tests/lib/Files/Storage/HomeTest.php @@ -54,7 +54,7 @@ class DummyUser extends User { * * @package Test\Files\Storage */ -class Home extends Storage { +class HomeTest extends Storage { /** * @var string tmpDir */ diff --git a/tests/lib/files/storage/local.php b/tests/lib/Files/Storage/LocalTest.php index 4cc6c6a842c..7b8ae6a24b2 100644 --- a/tests/lib/files/storage/local.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -23,13 +23,13 @@ namespace Test\Files\Storage; /** - * Class Local + * Class LocalTest * * @group DB * * @package Test\Files\Storage */ -class Local extends Storage { +class LocalTest extends Storage { /** * @var string tmpDir */ diff --git a/tests/lib/files/storage/storage.php b/tests/lib/Files/Storage/Storage.php index ed2ea87f9d9..ed2ea87f9d9 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/Files/Storage/Storage.php diff --git a/tests/lib/files/storage/storagefactory.php b/tests/lib/Files/Storage/StorageFactoryTest.php index fcdff577dd5..d3dc036ab42 100644 --- a/tests/lib/files/storage/storagefactory.php +++ b/tests/lib/Files/Storage/StorageFactoryTest.php @@ -25,7 +25,7 @@ class DummyWrapper extends Wrapper { } } -class StorageFactory extends TestCase { +class StorageFactoryTest extends TestCase { public function testSimpleWrapper() { $instance = new \OC\Files\Storage\StorageFactory(); $mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance); diff --git a/tests/lib/files/storage/wrapper/availability.php b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php index 99d6f7dbe5c..5ea7f8403ce 100644 --- a/tests/lib/files/storage/wrapper/availability.php +++ b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php @@ -18,9 +18,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + namespace Test\Files\Storage\Wrapper; -class Availability extends \Test\TestCase { +class AvailabilityTest extends \Test\TestCase { protected function getWrapperInstance() { $storage = $this->getMockBuilder('\OC\Files\Storage\Temporary') ->disableOriginalConstructor() diff --git a/tests/lib/files/storage/wrapper/encryption.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php index 21f7d9f09b9..e9ebf2f3bdf 100644 --- a/tests/lib/files/storage/wrapper/encryption.php +++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php @@ -8,7 +8,7 @@ use OC\Files\View; use OC\User\Manager; use Test\Files\Storage\Storage; -class Encryption extends Storage { +class EncryptionTest extends Storage { /** * block size will always be 8192 for a PHP stream diff --git a/tests/lib/files/storage/wrapper/jail.php b/tests/lib/Files/Storage/Wrapper/JailTest.php index 9b16bc5a321..b03eb0bcc63 100644 --- a/tests/lib/files/storage/wrapper/jail.php +++ b/tests/lib/Files/Storage/Wrapper/JailTest.php @@ -8,7 +8,7 @@ namespace Test\Files\Storage\Wrapper; -class Jail extends \Test\Files\Storage\Storage { +class JailTest extends \Test\Files\Storage\Storage { /** * @var \OC\Files\Storage\Temporary diff --git a/tests/lib/files/storage/wrapper/permissionsmask.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php index 7e8c387677c..c3421553643 100644 --- a/tests/lib/files/storage/wrapper/permissionsmask.php +++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php @@ -10,7 +10,7 @@ namespace Test\Files\Storage\Wrapper; use OCP\Constants; -class PermissionsMask extends \Test\Files\Storage\Storage { +class PermissionsMaskTest extends \Test\Files\Storage\Storage { /** * @var \OC\Files\Storage\Temporary diff --git a/tests/lib/files/storage/wrapper/quota.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php index d087a3eef33..2e9f68b3c56 100644 --- a/tests/lib/files/storage/wrapper/quota.php +++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php @@ -14,13 +14,13 @@ use OC\Files\Cache\CacheEntry; \OC::$loader->load('\OC\Files\Filesystem'); /** - * Class Quota + * Class QuotaTest * * @group DB * * @package Test\Files\Storage\Wrapper */ -class Quota extends \Test\Files\Storage\Storage { +class QuotaTest extends \Test\Files\Storage\Storage { /** * @var string tmpDir */ diff --git a/tests/lib/files/storage/wrapper/wrapper.php b/tests/lib/Files/Storage/Wrapper/WrapperTest.php index a5a678cb9f7..942ff27fc35 100644 --- a/tests/lib/files/storage/wrapper/wrapper.php +++ b/tests/lib/Files/Storage/Wrapper/WrapperTest.php @@ -8,7 +8,7 @@ namespace Test\Files\Storage\Wrapper; -class Wrapper extends \Test\Files\Storage\Storage { +class WrapperTest extends \Test\Files\Storage\Storage { /** * @var string tmpDir */ diff --git a/tests/lib/files/stream/dummyencryptionwrapper.php b/tests/lib/Files/Stream/DummyEncryptionWrapper.php index bb512d99c66..bb512d99c66 100644 --- a/tests/lib/files/stream/dummyencryptionwrapper.php +++ b/tests/lib/Files/Stream/DummyEncryptionWrapper.php diff --git a/tests/lib/files/stream/encryption.php b/tests/lib/Files/Stream/EncryptionTest.php index 20a4100d2ff..45204e48d09 100644 --- a/tests/lib/files/stream/encryption.php +++ b/tests/lib/Files/Stream/EncryptionTest.php @@ -4,7 +4,7 @@ namespace Test\Files\Stream; use OC\Files\View; -class Encryption extends \Test\TestCase { +class EncryptionTest extends \Test\TestCase { /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit_Framework_MockObject_MockObject */ private $encryptionModule; diff --git a/tests/lib/files/stream/quota.php b/tests/lib/Files/Stream/QuotaTest.php index 28584cf82db..d084f0c769c 100644 --- a/tests/lib/files/stream/quota.php +++ b/tests/lib/Files/Stream/QuotaTest.php @@ -8,7 +8,7 @@ namespace Test\Files\Stream; -class Quota extends \Test\TestCase { +class QuotaTest extends \Test\TestCase { protected function tearDown() { \OC\Files\Stream\Quota::clear(); parent::tearDown(); diff --git a/tests/lib/files/stream/staticstream.php b/tests/lib/Files/Stream/StaticStreamTest.php index 416a4670efd..309291a3a5b 100644 --- a/tests/lib/files/stream/staticstream.php +++ b/tests/lib/Files/Stream/StaticStreamTest.php @@ -8,7 +8,7 @@ namespace Test\Files\Stream; -class StaticStream extends \Test\TestCase { +class StaticStreamTest extends \Test\TestCase { private $sourceFile; private $sourceText; diff --git a/tests/lib/files/type/detection.php b/tests/lib/Files/Type/DetectionTest.php index 5800f4eb8e3..5800f4eb8e3 100644 --- a/tests/lib/files/type/detection.php +++ b/tests/lib/Files/Type/DetectionTest.php diff --git a/tests/lib/files/type/loadertest.php b/tests/lib/Files/Type/LoaderTest.php index 7f87afd2f4d..a77d672f667 100644 --- a/tests/lib/files/type/loadertest.php +++ b/tests/lib/Files/Type/LoaderTest.php @@ -19,7 +19,7 @@ * */ -namespace OC\Files\Type; +namespace Test\Files\Type; use \OC\Files\Type\Loader; use \OCP\IDBConnection; diff --git a/tests/lib/files/utils/scanner.php b/tests/lib/Files/Utils/ScannerTest.php index 1220c57e962..0c8e41c24c7 100644 --- a/tests/lib/files/utils/scanner.php +++ b/tests/lib/Files/Utils/ScannerTest.php @@ -33,13 +33,13 @@ class TestScanner extends \OC\Files\Utils\Scanner { } /** - * Class Scanner + * Class ScannerTest * * @group DB * * @package Test\Files\Utils */ -class Scanner extends \Test\TestCase { +class ScannerTest extends \Test\TestCase { /** * @var \Test\Util\User\Dummy */ diff --git a/tests/lib/files/view.php b/tests/lib/Files/ViewTest.php index 86413c61aa1..2c27bb64a70 100644 --- a/tests/lib/files/view.php +++ b/tests/lib/Files/ViewTest.php @@ -41,13 +41,13 @@ class TemporaryNoLocal extends \OC\Files\Storage\Temporary { } /** - * Class View + * Class ViewTest * * @group DB * * @package Test\Files */ -class View extends \Test\TestCase { +class ViewTest extends \Test\TestCase { /** * @var \OC\Files\Storage\Storage[] $storages */ @@ -1508,7 +1508,7 @@ class View extends \Test\TestCase { $defaultView = new \OC\Files\View('/foo/files'); $defaultRootValue->setValue($defaultView); $view = new \OC\Files\View($root); - $result = \Test_Helper::invokePrivate($view, 'shouldEmitHooks', [$path]); + $result = $this->invokePrivate($view, 'shouldEmitHooks', [$path]); $defaultRootValue->setValue($oldRoot); $this->assertEquals($shouldEmit, $result); } @@ -1872,7 +1872,7 @@ class View extends \Test\TestCase { $this->assertEquals(ILockingProvider::LOCK_SHARED, $lockTypePre, 'File locked properly during pre-hook'); $this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeDuring, 'File locked properly during operation'); - $this->assertNull(null, $lockTypePost, 'No post hook, no lock check possible'); + $this->assertNull($lockTypePost, 'No post hook, no lock check possible'); $this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeDuring, 'File still locked after fopen'); diff --git a/tests/lib/files.php b/tests/lib/FilesTest.php index 6808b3e9f64..b2a68c2a31b 100644 --- a/tests/lib/files.php +++ b/tests/lib/FilesTest.php @@ -22,7 +22,7 @@ namespace Test; -class Files extends \Test\TestCase { +class FilesTest extends \Test\TestCase { const UPLOAD_LIMIT_DEFAULT_STR = '513M'; const UPLOAD_LIMIT_SETTING_STR = '2M'; diff --git a/tests/lib/group/backend.php b/tests/lib/Group/Backend.php index 3b06a3eb3a9..eb17e9bded7 100644 --- a/tests/lib/group/backend.php +++ b/tests/lib/Group/Backend.php @@ -24,12 +24,14 @@ * */ +namespace Test\Group; + /** - * Class Test_Group_Backend + * Class Backend * * @group DB */ -abstract class Test_Group_Backend extends \Test\TestCase { +abstract class Backend extends \Test\TestCase { /** * @var \OC\Group\Backend $backend */ diff --git a/tests/lib/group/database.php b/tests/lib/Group/DatabaseTest.php index aae9f8bf1de..395a442c5e3 100644 --- a/tests/lib/group/database.php +++ b/tests/lib/Group/DatabaseTest.php @@ -23,12 +23,14 @@ * */ +namespace Test\Group; + /** - * Class Test_Group_Database + * Class Database * * @group DB */ -class Test_Group_Database extends Test_Group_Backend { +class DatabaseTest extends Backend { private $groups = array(); /** diff --git a/tests/lib/group/dummy.php b/tests/lib/Group/Dummy.php index eaa299c39af..5504cd63a0a 100644 --- a/tests/lib/group/dummy.php +++ b/tests/lib/Group/Dummy.php @@ -20,12 +20,14 @@ * */ +namespace Test\Group; + /** - * Class Test_Group_Dummy + * Class Dummy * * @group DB */ -class Test_Group_Dummy extends Test_Group_Backend { +class Dummy extends Backend { protected function setUp() { parent::setUp(); $this->backend=new \Test\Util\Group\Dummy(); diff --git a/tests/lib/group/group.php b/tests/lib/Group/GroupTest.php index bf834ab2348..5ab8e41e4af 100644 --- a/tests/lib/group/group.php +++ b/tests/lib/Group/GroupTest.php @@ -11,7 +11,7 @@ namespace Test\Group; use OC\User\User; -class Group extends \Test\TestCase { +class GroupTest extends \Test\TestCase { /** * @return \OC\User\Manager | \OC\User\Manager */ diff --git a/tests/lib/group.php b/tests/lib/Group/LegacyGroupTest.php index d3ac6d8d69e..12bcfdddf15 100644 --- a/tests/lib/group.php +++ b/tests/lib/Group/LegacyGroupTest.php @@ -22,7 +22,12 @@ * */ -class Test_Group extends \Test\TestCase { +namespace Test\Group; + +use OC_Group; +use OC_User; + +class LegacyGroupTest extends \Test\TestCase { protected function setUp() { parent::setUp(); OC_Group::clearBackends(); diff --git a/tests/lib/group/manager.php b/tests/lib/Group/ManagerTest.php index 751f0d0ebd5..907f2b59452 100644 --- a/tests/lib/group/manager.php +++ b/tests/lib/Group/ManagerTest.php @@ -11,7 +11,7 @@ namespace Test\Group; use OC\User\User; -class Manager extends \Test\TestCase { +class ManagerTest extends \Test\TestCase { public function testGet() { /** * @var \PHPUnit_Framework_MockObject_MockObject | \OC\Group\Backend $backend diff --git a/tests/lib/group/metadata.php b/tests/lib/Group/MetaDataTest.php index 233463c71eb..593bbcb48db 100644 --- a/tests/lib/group/metadata.php +++ b/tests/lib/Group/MetaDataTest.php @@ -22,7 +22,7 @@ namespace Test\Group; -class Test_MetaData extends \Test\TestCase { +class MetaDataTest extends \Test\TestCase { /** @var \OC\Group\Manager */ private $groupManager; /** @var \OCP\IUserSession */ diff --git a/tests/lib/httphelper.php b/tests/lib/HTTPHelperTest.php index 1d0981ba51b..6d9c4788735 100644 --- a/tests/lib/httphelper.php +++ b/tests/lib/HTTPHelperTest.php @@ -6,7 +6,9 @@ * See the COPYING-README file. */ -class TestHTTPHelper extends \Test\TestCase { +namespace Test; + +class HTTPHelperTest extends \Test\TestCase { /** @var \OCP\IConfig*/ private $config; diff --git a/tests/lib/helperstorage.php b/tests/lib/HelperStorageTest.php index 3109b509549..e841dbfce18 100644 --- a/tests/lib/helperstorage.php +++ b/tests/lib/HelperStorageTest.php @@ -6,12 +6,14 @@ * See the COPYING-README file. */ +namespace Test; + /** * Test the storage functions of OC_Helper * * @group DB */ -class Test_Helper_Storage extends \Test\TestCase { +class HelperStorageTest extends \Test\TestCase { /** @var string */ private $user; /** @var \OC\Files\Storage\Storage */ diff --git a/tests/lib/hookhelper.php b/tests/lib/HookHelper.php index f1cce831477..f1cce831477 100644 --- a/tests/lib/hookhelper.php +++ b/tests/lib/HookHelper.php diff --git a/tests/lib/hooks/basicemitter.php b/tests/lib/Hooks/BasicEmitterTest.php index 899d3ecd3b3..2e6bd8100e3 100644 --- a/tests/lib/hooks/basicemitter.php +++ b/tests/lib/Hooks/BasicEmitterTest.php @@ -31,7 +31,7 @@ class DummyEmitter extends \OC\Hooks\BasicEmitter { class EmittedException extends \Exception { } -class BasicEmitter extends \Test\TestCase { +class BasicEmitterTest extends \Test\TestCase { /** * @var \OC\Hooks\Emitter $emitter */ @@ -64,7 +64,7 @@ class BasicEmitter extends \Test\TestCase { * @expectedException \Test\Hooks\EmittedException */ public function testStaticCallback() { - $this->emitter->listen('Test', 'test', array('\Test\Hooks\BasicEmitter', 'staticCallBack')); + $this->emitter->listen('Test', 'test', array('\Test\Hooks\BasicEmitterTest', 'staticCallBack')); $this->emitter->emitEvent('Test', 'test'); } diff --git a/tests/lib/hooks/forwardingemitter.php b/tests/lib/Hooks/ForwardingEmitterTest.php index 5e8e252d3e3..ea8ee5c4121 100644 --- a/tests/lib/hooks/forwardingemitter.php +++ b/tests/lib/Hooks/ForwardingEmitterTest.php @@ -29,7 +29,7 @@ class DummyForwardingEmitter extends \OC\Hooks\ForwardingEmitter { * * @package OC\Hooks */ -class ForwardingEmitter extends BasicEmitter { +class ForwardingEmitterTest extends BasicEmitterTest { public function testSingleForward() { $baseEmitter = new PublicEmitter(); $forwardingEmitter = new DummyForwardingEmitter(); diff --git a/tests/lib/hooks/legacyemitter.php b/tests/lib/Hooks/LegacyEmitterTest.php index f030afbc090..60a29f23245 100644 --- a/tests/lib/hooks/legacyemitter.php +++ b/tests/lib/Hooks/LegacyEmitterTest.php @@ -21,7 +21,7 @@ class DummyLegacyEmitter extends \OC\Hooks\LegacyEmitter { } } -class LegacyEmitter extends BasicEmitter { +class LegacyEmitterTest extends BasicEmitterTest { //we can't use exceptions here since OC_Hooks catches all exceptions private static $emitted = false; @@ -44,13 +44,13 @@ class LegacyEmitter extends BasicEmitter { } public function testLegacyHook() { - \OC_Hook::connect('Test', 'test', '\Test\Hooks\LegacyEmitter', 'staticLegacyCallBack'); + \OC_Hook::connect('Test', 'test', '\Test\Hooks\LegacyEmitterTest', 'staticLegacyCallBack'); $this->emitter->emitEvent('Test', 'test'); $this->assertEquals(true, self::$emitted); } public function testLegacyArguments() { - \OC_Hook::connect('Test', 'test', '\Test\Hooks\LegacyEmitter', 'staticLegacyArgumentsCallBack'); + \OC_Hook::connect('Test', 'test', '\Test\Hooks\LegacyEmitterTest', 'staticLegacyArgumentsCallBack'); $this->emitter->emitEvent('Test', 'test', array('foo' => 'foo', 'bar' => 'bar')); $this->assertEquals(true, self::$emitted); } diff --git a/tests/lib/http/client/clientservicetest.php b/tests/lib/Http/Client/ClientServiceTest.php index 6d7acea0be7..3c406f30111 100644 --- a/tests/lib/http/client/clientservicetest.php +++ b/tests/lib/Http/Client/ClientServiceTest.php @@ -6,9 +6,11 @@ * See the COPYING-README file. */ -namespace OC\Http\Client; +namespace Test\Http\Client; use GuzzleHttp\Client as GuzzleClient; +use OC\Http\Client\Client; +use OC\Http\Client\ClientService; /** * Class ClientServiceTest diff --git a/tests/lib/http/client/clienttest.php b/tests/lib/Http/Client/ClientTest.php index c76fe0532a7..705e1eeddea 100644 --- a/tests/lib/http/client/clienttest.php +++ b/tests/lib/Http/Client/ClientTest.php @@ -6,9 +6,10 @@ * See the COPYING-README file. */ -namespace OC\Http\Client; +namespace Test\Http\Client; use GuzzleHttp\Message\Response; +use OC\Http\Client\Client; use OCP\IConfig; /** diff --git a/tests/lib/http/client/responsetest.php b/tests/lib/Http/Client/ResponseTest.php index d9b181a8e28..685f34a0baf 100644 --- a/tests/lib/http/client/responsetest.php +++ b/tests/lib/Http/Client/ResponseTest.php @@ -6,10 +6,11 @@ * See the COPYING-README file. */ -namespace OC\Http\Client; +namespace Test\Http\Client; use Guzzle\Stream\Stream; use GuzzleHttp\Message\Response as GuzzleResponse; +use OC\Http\Client\Response; /** * Class ResponseTest diff --git a/tests/lib/image.php b/tests/lib/ImageTest.php index e74c75b48cf..9dba7e3739b 100644 --- a/tests/lib/image.php +++ b/tests/lib/ImageTest.php @@ -6,7 +6,11 @@ * See the COPYING-README file. */ -class Test_Image extends \Test\TestCase { +namespace Test; + +use OC; + +class ImageTest extends \Test\TestCase { public static function tearDownAfterClass() { @unlink(OC::$SERVERROOT.'/tests/data/testimage2.png'); @unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg'); diff --git a/tests/lib/integritycheck/checkertest.php b/tests/lib/IntegrityCheck/CheckerTest.php index 0910c543a7a..6e6095668b0 100644 --- a/tests/lib/integritycheck/checkertest.php +++ b/tests/lib/IntegrityCheck/CheckerTest.php @@ -23,7 +23,6 @@ namespace Test\IntegrityCheck; use OC\IntegrityCheck\Checker; use OC\Memcache\NullCache; -use OCP\ICache; use phpseclib\Crypt\RSA; use phpseclib\File\X509; use Test\TestCase; diff --git a/tests/lib/integritycheck/helpers/AppLocatorTest.php b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php index d0083298b22..d0083298b22 100644 --- a/tests/lib/integritycheck/helpers/AppLocatorTest.php +++ b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php diff --git a/tests/lib/integritycheck/helpers/EnvironmentHelperTest.php b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php index a1d1f671b07..9dc9214a779 100644 --- a/tests/lib/integritycheck/helpers/EnvironmentHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php @@ -19,7 +19,7 @@ * */ -namespace Test\IntegrityCheck\Factories; +namespace Test\IntegrityCheck\Helpers; use OC\IntegrityCheck\Helpers\EnvironmentHelper; use Test\TestCase; diff --git a/tests/lib/integritycheck/helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php index 740b14e61c4..740b14e61c4 100644 --- a/tests/lib/integritycheck/helpers/FileAccessHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php diff --git a/tests/lib/l10n/factorytest.php b/tests/lib/L10N/FactoryTest.php index 98bb5ec13c9..98bb5ec13c9 100644 --- a/tests/lib/l10n/factorytest.php +++ b/tests/lib/L10N/FactoryTest.php diff --git a/tests/lib/l10n/l10nlegacytest.php b/tests/lib/L10N/L10nLegacyTest.php index 1df22ba36bd..1df22ba36bd 100644 --- a/tests/lib/l10n/l10nlegacytest.php +++ b/tests/lib/L10N/L10nLegacyTest.php diff --git a/tests/lib/l10n/l10ntest.php b/tests/lib/L10N/L10nTest.php index 227e07056a8..227e07056a8 100644 --- a/tests/lib/l10n/l10ntest.php +++ b/tests/lib/L10N/L10nTest.php diff --git a/tests/lib/largefilehelpergetfilesize.php b/tests/lib/LargeFileHelperGetFileSizeTest.php index 57bc2381966..ac81a31819f 100644 --- a/tests/lib/largefilehelpergetfilesize.php +++ b/tests/lib/LargeFileHelperGetFileSizeTest.php @@ -12,7 +12,7 @@ namespace Test; * Tests whether LargeFileHelper is able to determine file size at all. * Large files are not considered yet. */ -class LargeFileHelperGetFileSize extends TestCase { +class LargeFileHelperGetFileSizeTest extends TestCase { /** @var string */ protected $filename; /** @var int */ diff --git a/tests/lib/largefilehelper.php b/tests/lib/LargeFileHelperTest.php index 1267a8c5833..7d155ff8b44 100644 --- a/tests/lib/largefilehelper.php +++ b/tests/lib/LargeFileHelperTest.php @@ -8,7 +8,7 @@ namespace Test; -class LargeFileHelper extends TestCase { +class LargeFileHelperTest extends TestCase { protected $helper; protected function setUp() { diff --git a/tests/lib/helper.php b/tests/lib/LegacyHelperTest.php index 89a981e6e23..d8b1a82c271 100644 --- a/tests/lib/helper.php +++ b/tests/lib/LegacyHelperTest.php @@ -6,7 +6,11 @@ * See the COPYING-README file. */ -class Test_Helper extends \Test\TestCase { +namespace Test; + +use OC_Helper; + +class LegacyHelperTest extends \Test\TestCase { /** * @dataProvider humanFileSizeProvider diff --git a/tests/lib/lock/dblockingprovider.php b/tests/lib/Lock/DBLockingProviderTest.php index 743dbf85613..a7c3f463155 100644 --- a/tests/lib/lock/dblockingprovider.php +++ b/tests/lib/Lock/DBLockingProviderTest.php @@ -30,7 +30,7 @@ use OCP\Lock\ILockingProvider; * * @package Test\Lock */ -class DBLockingProvider extends LockingProvider { +class DBLockingProviderTest extends LockingProvider { /** * @var \OC\Lock\DBLockingProvider */ diff --git a/tests/lib/lock/lockingprovider.php b/tests/lib/Lock/LockingProvider.php index 49742baa561..49742baa561 100644 --- a/tests/lib/lock/lockingprovider.php +++ b/tests/lib/Lock/LockingProvider.php diff --git a/tests/lib/lock/memcachelockingprovider.php b/tests/lib/Lock/MemcacheLockingProviderTest.php index 40478b22939..baf99dbb2bb 100644 --- a/tests/lib/lock/memcachelockingprovider.php +++ b/tests/lib/Lock/MemcacheLockingProviderTest.php @@ -23,7 +23,7 @@ namespace Test\Lock; use OC\Memcache\ArrayCache; -class MemcacheLockingProvider extends LockingProvider { +class MemcacheLockingProviderTest extends LockingProvider { /** * @var \OCP\IMemcache diff --git a/tests/lib/log/owncloud.php b/tests/lib/Log/OwncloudTest.php index e19063a83f5..e19063a83f5 100644 --- a/tests/lib/log/owncloud.php +++ b/tests/lib/Log/OwncloudTest.php diff --git a/tests/lib/logger.php b/tests/lib/LoggerTest.php index e6a0abfbf28..4eb04b00f58 100644 --- a/tests/lib/logger.php +++ b/tests/lib/LoggerTest.php @@ -10,7 +10,7 @@ namespace Test; use OC\Log; -class Logger extends TestCase { +class LoggerTest extends TestCase { /** * @var \OCP\ILogger */ @@ -25,7 +25,7 @@ class Logger extends TestCase { '\OC\SystemConfig') ->disableOriginalConstructor() ->getMock(); - $this->logger = new Log('Test\Logger', $this->config); + $this->logger = new Log('Test\LoggerTest', $this->config); } public function testInterpolation() { diff --git a/tests/lib/mail/mailer.php b/tests/lib/Mail/MailerTest.php index 8023cda820e..c63ceb5982a 100644 --- a/tests/lib/mail/mailer.php +++ b/tests/lib/Mail/MailerTest.php @@ -6,11 +6,13 @@ * See the COPYING-README file. */ -namespace Test; +namespace Test\Mail; + use OC\Mail\Mailer; use OCP\IConfig; use OC_Defaults; use OCP\ILogger; +use Test\TestCase; class MailerTest extends TestCase { /** @var IConfig */ diff --git a/tests/lib/mail/message.php b/tests/lib/Mail/MessageTest.php index 339677c0a7c..691168ce24c 100644 --- a/tests/lib/mail/message.php +++ b/tests/lib/Mail/MessageTest.php @@ -6,10 +6,11 @@ * See the COPYING-README file. */ -namespace Test; +namespace Test\Mail; use OC\Mail\Message; use Swift_Message; +use Test\TestCase; class MessageTest extends TestCase { /** @var Swift_Message */ diff --git a/tests/lib/memcache/apc.php b/tests/lib/Memcache/APCTest.php index fdb785b9dc5..4bd7e62b94a 100644 --- a/tests/lib/memcache/apc.php +++ b/tests/lib/Memcache/APCTest.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -class APC extends Cache { +class APCTest extends Cache { protected function setUp() { parent::setUp(); diff --git a/tests/lib/memcache/apcu.php b/tests/lib/Memcache/APCuTest.php index afcaa99bfbe..73fd5a12880 100644 --- a/tests/lib/memcache/apcu.php +++ b/tests/lib/Memcache/APCuTest.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -class APCu extends Cache { +class APCuTest extends Cache { protected function setUp() { parent::setUp(); diff --git a/tests/lib/memcache/arraycache.php b/tests/lib/Memcache/ArrayCacheTest.php index 1db673da2a8..3ae8c116a01 100644 --- a/tests/lib/memcache/arraycache.php +++ b/tests/lib/Memcache/ArrayCacheTest.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -class ArrayCache extends Cache { +class ArrayCacheTest extends Cache { protected function setUp() { parent::setUp(); $this->instance = new \OC\Memcache\ArrayCache(''); diff --git a/tests/lib/memcache/cache.php b/tests/lib/Memcache/Cache.php index 725b0fbbf57..8d6a231dd8d 100644 --- a/tests/lib/memcache/cache.php +++ b/tests/lib/Memcache/Cache.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -abstract class Cache extends \Test_Cache { +abstract class Cache extends \Test\Cache\TestCache { /** * @var \OCP\IMemcache cache; */ diff --git a/tests/lib/memcache/castrait.php b/tests/lib/Memcache/CasTraitTest.php index 17f412bb638..2f0ef939aa7 100644 --- a/tests/lib/memcache/castrait.php +++ b/tests/lib/Memcache/CasTraitTest.php @@ -23,7 +23,7 @@ namespace Test\Memcache; use Test\TestCase; -class CasTrait extends TestCase { +class CasTraitTest extends TestCase { /** * @return \OC\Memcache\CasTrait */ diff --git a/tests/lib/memcache/factory.php b/tests/lib/Memcache/FactoryTest.php index 33a27a42113..8607ea7de9b 100644 --- a/tests/lib/memcache/factory.php +++ b/tests/lib/Memcache/FactoryTest.php @@ -56,7 +56,7 @@ class Test_Factory_Unavailable_Cache2 { } } -class Test_Factory extends \Test\TestCase { +class FactoryTest extends \Test\TestCase { const AVAILABLE1 = '\\Test\\Memcache\\Test_Factory_Available_Cache1'; const AVAILABLE2 = '\\Test\\Memcache\\Test_Factory_Available_Cache2'; const UNAVAILABLE1 = '\\Test\\Memcache\\Test_Factory_Unavailable_Cache1'; diff --git a/tests/lib/memcache/memcached.php b/tests/lib/Memcache/MemcachedTest.php index 3ea9216029a..865d8594bbb 100644 --- a/tests/lib/memcache/memcached.php +++ b/tests/lib/Memcache/MemcachedTest.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -class Memcached extends Cache { +class MemcachedTest extends Cache { static public function setUpBeforeClass() { parent::setUpBeforeClass(); diff --git a/tests/lib/memcache/redis.php b/tests/lib/Memcache/RedisTest.php index 2e3c5d735fe..094954d4a1a 100644 --- a/tests/lib/memcache/redis.php +++ b/tests/lib/Memcache/RedisTest.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -class Redis extends Cache { +class RedisTest extends Cache { static public function setUpBeforeClass() { parent::setUpBeforeClass(); diff --git a/tests/lib/memcache/xcache.php b/tests/lib/Memcache/XCacheTest.php index 36efe0b220a..af720115d01 100644 --- a/tests/lib/memcache/xcache.php +++ b/tests/lib/Memcache/XCacheTest.php @@ -9,7 +9,7 @@ namespace Test\Memcache; -class XCache extends Cache { +class XCacheTest extends Cache { protected function setUp() { parent::setUp(); diff --git a/tests/lib/migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php index e092f6c2e8b..e092f6c2e8b 100644 --- a/tests/lib/migration/BackgroundRepairTest.php +++ b/tests/lib/Migration/BackgroundRepairTest.php diff --git a/tests/lib/naturalsort.php b/tests/lib/NaturalSortTest.php index 8fcbc6f5fd3..50c2d0be9f0 100644 --- a/tests/lib/naturalsort.php +++ b/tests/lib/NaturalSortTest.php @@ -6,7 +6,9 @@ * See the COPYING-README file. */ -class Test_NaturalSort extends \Test\TestCase { +namespace Test; + +class NaturalSortTest extends \Test\TestCase { /** * @dataProvider naturalSortDataProvider diff --git a/tests/lib/navigationmanagertest.php b/tests/lib/NavigationManagerTest.php index 96708786e39..96708786e39 100644 --- a/tests/lib/navigationmanagertest.php +++ b/tests/lib/NavigationManagerTest.php diff --git a/tests/lib/notification/actiontest.php b/tests/lib/Notification/ActionTest.php index 74c995280c9..74c995280c9 100644 --- a/tests/lib/notification/actiontest.php +++ b/tests/lib/Notification/ActionTest.php diff --git a/tests/lib/notification/managertest.php b/tests/lib/Notification/ManagerTest.php index 4410781bc31..4410781bc31 100644 --- a/tests/lib/notification/managertest.php +++ b/tests/lib/Notification/ManagerTest.php diff --git a/tests/lib/notification/notificationtest.php b/tests/lib/Notification/NotificationTest.php index c6ededf0142..c6ededf0142 100644 --- a/tests/lib/notification/notificationtest.php +++ b/tests/lib/Notification/NotificationTest.php diff --git a/tests/ocs/response.php b/tests/lib/OCS/MapStatusCodeTest.php index 919915a7c78..27ebfe209f7 100644 --- a/tests/ocs/response.php +++ b/tests/lib/OCS/MapStatusCodeTest.php @@ -1,6 +1,4 @@ <?php -use OCP\AppFramework\Http; - /** * @author Thomas Müller <thomas.mueller@tmit.eu> * @@ -21,13 +19,17 @@ use OCP\AppFramework\Http; * */ -class OcsResponseTest extends \Test\TestCase { +namespace Test\OCS; + +use OCP\AppFramework\Http; + +class MapStatusCodeTest extends \Test\TestCase { /** * @dataProvider providesStatusCodes */ public function testStatusCodeMapper($expected, $sc) { - $result = OC_API::mapStatusCodes($sc); + $result = \OC_API::mapStatusCodes($sc); $this->assertEquals($expected, $result); } diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/OCS/PrivatedataTest.php index ce153bf07d6..0b3b23b8804 100644 --- a/tests/lib/ocs/privatedata.php +++ b/tests/lib/OCS/PrivatedataTest.php @@ -20,12 +20,16 @@ * */ +namespace Test\OCS; + +use OC_OCS_Privatedata; + /** - * Class Test_OC_OCS_Privatedata + * Class PrivatedataTest * * @group DB */ -class Test_OC_OCS_Privatedata extends \Test\TestCase { +class PrivatedataTest extends \Test\TestCase { private $appKey; protected function setUp() { diff --git a/tests/ocs-provider/provider.php b/tests/lib/OCS/ProviderTest.php index 17f557b16b5..399fd3933d9 100644 --- a/tests/ocs-provider/provider.php +++ b/tests/lib/OCS/ProviderTest.php @@ -19,7 +19,11 @@ * */ -class OcsProviderTest extends \Test\TestCase { +namespace Test\OCS; + +use OC\OCS\Provider; + +class ProviderTest extends \Test\TestCase { /** @var \OCP\IRequest */ private $request; /** @var \OCP\App\IAppManager */ @@ -30,8 +34,6 @@ class OcsProviderTest extends \Test\TestCase { public function setUp() { parent::setUp(); - require_once '../ocs-provider/provider.php'; - $this->request = $this->getMockBuilder('\\OCP\\IRequest')->getMock(); $this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager')->getMock(); $this->ocsProvider = new Provider('ocs_provider', $this->request, $this->appManager); diff --git a/tests/lib/ocsclienttest.php b/tests/lib/OCSClientTest.php index 7555562d124..4ae6fb62e0e 100644 --- a/tests/lib/ocsclienttest.php +++ b/tests/lib/OCSClientTest.php @@ -19,6 +19,8 @@ * */ +namespace Test; + use OC\OCSClient; use OCP\Http\Client\IClientService; use OCP\IConfig; diff --git a/tests/lib/preview/bitmap.php b/tests/lib/Preview/BitmapTest.php index 1e135ceb083..32d6ce896e4 100644 --- a/tests/lib/preview/bitmap.php +++ b/tests/lib/Preview/BitmapTest.php @@ -22,13 +22,13 @@ namespace Test\Preview; /** - * Class Bitmap + * Class BitmapTest * * @group DB * * @package Test\Preview */ -class Bitmap extends Provider { +class BitmapTest extends Provider { public function setUp() { parent::setUp(); diff --git a/tests/lib/preview/image.php b/tests/lib/Preview/ImageTest.php index 6c82ff85723..a55433a2682 100644 --- a/tests/lib/preview/image.php +++ b/tests/lib/Preview/ImageTest.php @@ -22,13 +22,13 @@ namespace Test\Preview; /** - * Class Image + * Class ImageTest * * @group DB * * @package Test\Preview */ -class Image extends Provider { +class ImageTest extends Provider { public function setUp() { parent::setUp(); diff --git a/tests/lib/preview/mp3.php b/tests/lib/Preview/MP3Test.php index f6875a88ebd..576eea20b8b 100644 --- a/tests/lib/preview/mp3.php +++ b/tests/lib/Preview/MP3Test.php @@ -22,13 +22,13 @@ namespace Test\Preview; /** - * Class MP3 + * Class MP3Test * * @group DB * * @package Test\Preview */ -class MP3 extends Provider { +class MP3Test extends Provider { public function setUp() { parent::setUp(); diff --git a/tests/lib/preview/movie.php b/tests/lib/Preview/MovieTest.php index 0ad8c13fc63..0c174a40ca6 100644 --- a/tests/lib/preview/movie.php +++ b/tests/lib/Preview/MovieTest.php @@ -22,13 +22,13 @@ namespace Test\Preview; /** - * Class Movie + * Class MovieTest * * @group DB * * @package Test\Preview */ -class Movie extends Provider { +class MovieTest extends Provider { public function setUp() { $avconvBinary = \OC_Helper::findBinaryPath('avconv'); diff --git a/tests/lib/preview/office.php b/tests/lib/Preview/OfficeTest.php index 83eb5e2cecb..15d66352c18 100644 --- a/tests/lib/preview/office.php +++ b/tests/lib/Preview/OfficeTest.php @@ -22,13 +22,13 @@ namespace Test\Preview; /** - * Class Office + * Class OfficeTest * * @group DB * * @package Test\Preview */ -class Office extends Provider { +class OfficeTest extends Provider { public function setUp() { $libreofficeBinary = \OC_Helper::findBinaryPath('libreoffice'); diff --git a/tests/lib/preview/provider.php b/tests/lib/Preview/Provider.php index 5377f30df82..5377f30df82 100644 --- a/tests/lib/preview/provider.php +++ b/tests/lib/Preview/Provider.php diff --git a/tests/lib/preview/svg.php b/tests/lib/Preview/SVGTest.php index ef5f4cff80f..39bf3f1dfc9 100644 --- a/tests/lib/preview/svg.php +++ b/tests/lib/Preview/SVGTest.php @@ -22,13 +22,13 @@ namespace Test\Preview; /** - * Class SVG + * Class SVGTest * * @group DB * * @package Test\Preview */ -class SVG extends Provider { +class SVGTest extends Provider { public function setUp() { $checkImagick = new \Imagick(); diff --git a/tests/lib/preview/txt.php b/tests/lib/Preview/TXTTest.php index 219b850be95..dfa0b920e16 100644 --- a/tests/lib/preview/txt.php +++ b/tests/lib/Preview/TXTTest.php @@ -22,13 +22,13 @@ namespace Test\Preview; /** - * Class TXT + * Class TXTTest * * @group DB * * @package Test\Preview */ -class TXT extends Provider { +class TXTTest extends Provider { public function setUp() { parent::setUp(); diff --git a/tests/lib/preview.php b/tests/lib/PreviewTest.php index bc6f849cbe8..6ca88253468 100644 --- a/tests/lib/preview.php +++ b/tests/lib/PreviewTest.php @@ -29,13 +29,13 @@ use Test\Traits\MountProviderTrait; use Test\Traits\UserTrait; /** - * Class Preview + * Class PreviewTest * * @group DB * * @package Test */ -class Preview extends TestCase { +class PreviewTest extends TestCase { use UserTrait; use MountProviderTrait; diff --git a/tests/lib/public/contacts.php b/tests/lib/PublicNamespace/ContactsTest.php index 151e98d3905..8b07c4831b6 100644 --- a/tests/lib/public/contacts.php +++ b/tests/lib/PublicNamespace/ContactsTest.php @@ -19,15 +19,17 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -class Test_Contacts extends \Test\TestCase { +namespace Test\PublicNamespace; + +class ContactsTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - OCP\Contacts::clear(); + \OCP\Contacts::clear(); } public function testDisabledIfEmpty() { // pretty simple - $this->assertFalse(OCP\Contacts::isEnabled()); + $this->assertFalse(\OCP\Contacts::isEnabled()); } public function testEnabledAfterRegister() { @@ -41,19 +43,19 @@ class Test_Contacts extends \Test\TestCase { ->method('getKey'); // not enabled before register - $this->assertFalse(OCP\Contacts::isEnabled()); + $this->assertFalse(\OCP\Contacts::isEnabled()); // register the address book - OCP\Contacts::registerAddressBook($stub); + \OCP\Contacts::registerAddressBook($stub); // contacts api shall be enabled - $this->assertTrue(OCP\Contacts::isEnabled()); + $this->assertTrue(\OCP\Contacts::isEnabled()); // unregister the address book - OCP\Contacts::unregisterAddressBook($stub); + \OCP\Contacts::unregisterAddressBook($stub); // not enabled after register - $this->assertFalse(OCP\Contacts::isEnabled()); + $this->assertFalse(\OCP\Contacts::isEnabled()); } public function testAddressBookEnumeration() { @@ -69,8 +71,8 @@ class Test_Contacts extends \Test\TestCase { ->will($this->returnValue('A very simple Addressbook')); // register the address book - OCP\Contacts::registerAddressBook($stub); - $all_books = OCP\Contacts::getAddressBooks(); + \OCP\Contacts::registerAddressBook($stub); + $all_books = \OCP\Contacts::getAddressBooks(); $this->assertEquals(1, count($all_books)); $this->assertEquals('A very simple Addressbook', $all_books['SIMPLE_ADDRESS_BOOK']); @@ -101,15 +103,15 @@ class Test_Contacts extends \Test\TestCase { $stub2->expects($this->any())->method('search')->will($this->returnValue($searchResult2)); // register the address books - OCP\Contacts::registerAddressBook($stub1); - OCP\Contacts::registerAddressBook($stub2); - $all_books = OCP\Contacts::getAddressBooks(); + \OCP\Contacts::registerAddressBook($stub1); + \OCP\Contacts::registerAddressBook($stub2); + $all_books = \OCP\Contacts::getAddressBooks(); // assert the count - doesn't hurt $this->assertEquals(2, count($all_books)); // perform the search - $result = OCP\Contacts::search('x', array()); + $result = \OCP\Contacts::search('x', array()); // we expect 4 hits $this->assertEquals(4, count($result)); diff --git a/tests/lib/public/ocpconfig.php b/tests/lib/PublicNamespace/OCPConfigTest.php index 947d2b3c9ef..44fd234735e 100644 --- a/tests/lib/public/ocpconfig.php +++ b/tests/lib/PublicNamespace/OCPConfigTest.php @@ -19,7 +19,9 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -class Test_OCPConfig extends \Test\TestCase { +namespace Test\PublicNamespace; + +class OCPConfigTest extends \Test\TestCase { public function testSetAppValueIfSetToNull() { diff --git a/tests/lib/public/util.php b/tests/lib/PublicNamespace/UtilTest.php index ebc4f70079b..31d1f9fb0ee 100644 --- a/tests/lib/public/util.php +++ b/tests/lib/PublicNamespace/UtilTest.php @@ -19,10 +19,13 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -class Test_Public_Util extends \Test\TestCase { +namespace Test\PublicNamespace; + + +class UtilTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - OCP\Contacts::clear(); + \OCP\Contacts::clear(); } /** diff --git a/tests/lib/repair/cleantags.php b/tests/lib/Repair/CleanTagsTest.php index 214e2a17c94..804fa4f66c9 100644 --- a/tests/lib/repair/cleantags.php +++ b/tests/lib/Repair/CleanTagsTest.php @@ -17,7 +17,7 @@ use OCP\Migration\IOutput; * * @see \OC\Repair\CleanTags */ -class CleanTags extends \Test\TestCase { +class CleanTagsTest extends \Test\TestCase { /** @var \OC\Repair\CleanTags */ protected $repair; diff --git a/tests/lib/repair/dropoldjobs.php b/tests/lib/Repair/DropOldJobsTest.php index c8a4aa3f1c2..d83ecbe59c4 100644 --- a/tests/lib/repair/dropoldjobs.php +++ b/tests/lib/Repair/DropOldJobsTest.php @@ -18,7 +18,7 @@ use OCP\Migration\IOutput; * * @see \OC\Repair\DropOldTables */ -class DropOldJobs extends \Test\TestCase { +class DropOldJobsTest extends \Test\TestCase { /** @var IJobList */ protected $jobList; diff --git a/tests/lib/repair/dropoldtables.php b/tests/lib/Repair/DropOldTablesTest.php index d2e1d7c3449..1f5a4c15295 100644 --- a/tests/lib/repair/dropoldtables.php +++ b/tests/lib/Repair/DropOldTablesTest.php @@ -16,7 +16,7 @@ use OCP\Migration\IOutput; * * @see \OC\Repair\DropOldTables */ -class DropOldTables extends \Test\TestCase { +class DropOldTablesTest extends \Test\TestCase { /** @var \OCP\IDBConnection */ protected $connection; diff --git a/tests/lib/repair/oldgroupmembershipsharestest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php index cc04a80eef9..cc04a80eef9 100644 --- a/tests/lib/repair/oldgroupmembershipsharestest.php +++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php diff --git a/tests/lib/repair/removegetetagentriestest.php b/tests/lib/Repair/RemoveGetETagEntriesTest.php index c00923228d0..c00923228d0 100644 --- a/tests/lib/repair/removegetetagentriestest.php +++ b/tests/lib/Repair/RemoveGetETagEntriesTest.php diff --git a/tests/lib/repair/repaircollation.php b/tests/lib/Repair/RepairCollationTest.php index 4efa8ccc552..2e304a74abc 100644 --- a/tests/lib/repair/repaircollation.php +++ b/tests/lib/Repair/RepairCollationTest.php @@ -1,4 +1,7 @@ <?php + +namespace Test\Repair; + use OCP\Migration\IOutput; /** @@ -25,7 +28,7 @@ class TestCollationRepair extends \OC\Repair\Collation { * * @see \OC\Repair\RepairMimeTypes */ -class TestRepairCollation extends \Test\TestCase { +class RepairCollationTest extends \Test\TestCase { /** * @var TestCollationRepair diff --git a/tests/lib/repair/repairinnodb.php b/tests/lib/Repair/RepairInnoDBTest.php index 9b02bc46e29..1258dad73f5 100644 --- a/tests/lib/repair/repairinnodb.php +++ b/tests/lib/Repair/RepairInnoDBTest.php @@ -16,7 +16,7 @@ use OCP\Migration\IRepairStep; * * @see \OC\Repair\RepairMimeTypes */ -class RepairInnoDB extends \Test\TestCase { +class RepairInnoDBTest extends \Test\TestCase { /** @var IRepairStep */ private $repair; diff --git a/tests/lib/repair/repairinvalidsharestest.php b/tests/lib/Repair/RepairInvalidSharesTest.php index a1e871bcc80..a1e871bcc80 100644 --- a/tests/lib/repair/repairinvalidsharestest.php +++ b/tests/lib/Repair/RepairInvalidSharesTest.php diff --git a/tests/lib/repair/repairlegacystorage.php b/tests/lib/Repair/RepairLegacyStoragesTest.php index 5b560458e76..aa51fe06a35 100644 --- a/tests/lib/repair/repairlegacystorage.php +++ b/tests/lib/Repair/RepairLegacyStoragesTest.php @@ -21,7 +21,7 @@ use Test\TestCase; * * @see \OC\Repair\RepairLegacyStorages */ -class RepairLegacyStorages extends TestCase { +class RepairLegacyStoragesTest extends TestCase { /** @var \OCP\IDBConnection */ private $connection; /** @var \OCP\IConfig */ diff --git a/tests/lib/repair/repairmimetypes.php b/tests/lib/Repair/RepairMimeTypesTest.php index d8ef95e9546..6a42b016938 100644 --- a/tests/lib/repair/repairmimetypes.php +++ b/tests/lib/Repair/RepairMimeTypesTest.php @@ -21,7 +21,7 @@ use OCP\Migration\IRepairStep; * * @see \OC\Repair\RepairMimeTypes */ -class RepairMimeTypes extends \Test\TestCase { +class RepairMimeTypesTest extends \Test\TestCase { /** @var IRepairStep */ private $repair; diff --git a/tests/lib/repair/repairsharepropagation.php b/tests/lib/Repair/RepairSharePropagationTest.php index 34b47397a53..07db3c84f28 100644 --- a/tests/lib/repair/repairsharepropagation.php +++ b/tests/lib/Repair/RepairSharePropagationTest.php @@ -11,7 +11,7 @@ namespace Test\Repair; use OC\Repair\SharePropagation; use OCP\Migration\IOutput; -class RepairSharePropagation extends \Test\TestCase { +class RepairSharePropagationTest extends \Test\TestCase { public function keyProvider() { return [ [['1', '2'], ['1', '2']], diff --git a/tests/lib/repair/repairsqliteautoincrement.php b/tests/lib/Repair/RepairSqliteAutoincrementTest.php index 581857ebfc9..22186283779 100644 --- a/tests/lib/repair/repairsqliteautoincrement.php +++ b/tests/lib/Repair/RepairSqliteAutoincrementTest.php @@ -14,7 +14,7 @@ use OCP\Migration\IOutput; * * @group DB */ -class RepairSqliteAutoincrement extends \Test\TestCase { +class RepairSqliteAutoincrementTest extends \Test\TestCase { /** * @var \OC\Repair\SqliteAutoincrement diff --git a/tests/lib/repair/updateoutdatedocsids.php b/tests/lib/Repair/UpdateOutdatedOcsIdsTest.php index 06e2cb1d610..eb80e63a202 100644 --- a/tests/lib/repair/updateoutdatedocsids.php +++ b/tests/lib/Repair/UpdateOutdatedOcsIdsTest.php @@ -29,7 +29,7 @@ use Test\TestCase; * * @package Test\Repair */ -class UpdateOutdatedOcsIds extends TestCase { +class UpdateOutdatedOcsIdsTest extends TestCase { /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ private $config; /** @var \OC\Repair\UpdateOutdatedOcsIds */ diff --git a/tests/lib/repair/fixtures/dropoldtables.xml b/tests/lib/Repair/fixtures/dropoldtables.xml index 6c42a8f90a7..6c42a8f90a7 100644 --- a/tests/lib/repair/fixtures/dropoldtables.xml +++ b/tests/lib/Repair/fixtures/dropoldtables.xml diff --git a/tests/lib/RepairTest.php b/tests/lib/RepairStepTest.php index 9ae1318eb32..3f7a0ce064b 100644 --- a/tests/lib/RepairTest.php +++ b/tests/lib/RepairStepTest.php @@ -11,7 +11,7 @@ namespace Test; use OCP\Migration\IRepairStep; use Symfony\Component\EventDispatcher\EventDispatcher; -class TestRepairStep implements IRepairStep { +class RepairStepTest implements IRepairStep { private $warning; public function __construct($warning = false) { diff --git a/tests/lib/security/csp/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php index 975c35d3780..d463e7c648c 100644 --- a/tests/lib/security/csp/ContentSecurityPolicyManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php @@ -19,6 +19,9 @@ * */ +namespace Test\Security\CSP; + + use OC\Security\CSP\ContentSecurityPolicyManager; class ContentSecurityPolicyManagerTest extends \Test\TestCase { diff --git a/tests/lib/security/csrf/CsrfTokenGeneratorTest.php b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php index be7434f514f..28b85c3951f 100644 --- a/tests/lib/security/csrf/CsrfTokenGeneratorTest.php +++ b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php @@ -19,6 +19,8 @@ * */ +namespace Test\Security\CSRF; + class CsrfTokenGeneratorTest extends \Test\TestCase { /** @var \OCP\Security\ISecureRandom */ private $random; diff --git a/tests/lib/security/csrf/CsrfTokenManagerTest.php b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php index 145fc03c51e..ab19a43e91e 100644 --- a/tests/lib/security/csrf/CsrfTokenManagerTest.php +++ b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php @@ -19,6 +19,8 @@ * */ +namespace Test\Security\CSRF; + class CsrfTokenManagerTest extends \Test\TestCase { /** @var \OC\Security\CSRF\CsrfTokenManager */ private $csrfTokenManager; diff --git a/tests/lib/security/csrf/CsrfTokenTest.php b/tests/lib/Security/CSRF/CsrfTokenTest.php index 62e6ad112e7..da640ce5052 100644 --- a/tests/lib/security/csrf/CsrfTokenTest.php +++ b/tests/lib/Security/CSRF/CsrfTokenTest.php @@ -19,6 +19,8 @@ * */ +namespace Test\Security\CSRF; + class CsrfTokenTest extends \Test\TestCase { public function testGetEncryptedValue() { $csrfToken = new \OC\Security\CSRF\CsrfToken('MyCsrfToken'); diff --git a/tests/lib/security/csrf/tokenstorage/SessionStorageTest.php b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php index 3a83f6a8c00..550fa49e1b2 100644 --- a/tests/lib/security/csrf/tokenstorage/SessionStorageTest.php +++ b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php @@ -19,6 +19,8 @@ * */ +namespace Test\Security\CSRF\TokenStorage; + class SessionStorageTest extends \Test\TestCase { /** @var \OCP\ISession */ private $session; diff --git a/tests/lib/security/certificatemanager.php b/tests/lib/Security/CertificateManagerTest.php index e9ccea39efe..43206569cf4 100644 --- a/tests/lib/security/certificatemanager.php +++ b/tests/lib/Security/CertificateManagerTest.php @@ -6,6 +6,8 @@ * See the COPYING-README file. */ +namespace Test\Security; + use \OC\Security\CertificateManager; /** diff --git a/tests/lib/security/certificate.php b/tests/lib/Security/CertificateTest.php index 82e91c71733..6f7d7d4a37f 100644 --- a/tests/lib/security/certificate.php +++ b/tests/lib/Security/CertificateTest.php @@ -19,6 +19,8 @@ * */ +namespace Test\Security; + use \OC\Security\Certificate; class CertificateTest extends \Test\TestCase { @@ -74,18 +76,18 @@ class CertificateTest extends \Test\TestCase { } public function testGetIssueDate() { - $expected = new DateTime('2015-08-27 20:03:42 GMT'); + $expected = new \DateTime('2015-08-27 20:03:42 GMT'); $this->assertEquals($expected->getTimestamp(), $this->goodCertificate->getIssueDate()->getTimestamp()); - $expected = new DateTime('2015-08-27 20:19:13 GMT'); + $expected = new \DateTime('2015-08-27 20:19:13 GMT'); $this->assertEquals($expected->getTimestamp(), $this->invalidCertificate->getIssueDate()->getTimestamp()); } public function testGetExpireDate() { - $expected = new DateTime('2025-08-24 20:03:42 GMT'); + $expected = new \DateTime('2025-08-24 20:03:42 GMT'); $this->assertEquals($expected->getTimestamp(), $this->goodCertificate->getExpireDate()->getTimestamp()); - $expected = new DateTime('2025-08-24 20:19:13 GMT'); + $expected = new \DateTime('2025-08-24 20:19:13 GMT'); $this->assertEquals($expected->getTimestamp(), $this->invalidCertificate->getExpireDate()->getTimestamp()); - $expected = new DateTime('2014-08-28 09:12:43 GMT'); + $expected = new \DateTime('2014-08-28 09:12:43 GMT'); $this->assertEquals($expected->getTimestamp(), $this->expiredCertificate->getExpireDate()->getTimestamp()); } diff --git a/tests/lib/security/credentialsmanager.php b/tests/lib/Security/CredentialsManagerTest.php index 72f061e05bb..7eb4e4d7b1a 100644 --- a/tests/lib/security/credentialsmanager.php +++ b/tests/lib/Security/CredentialsManagerTest.php @@ -19,6 +19,8 @@ * */ +namespace Test\Security; + use \OCP\Security\ICrypto; use \OCP\IDBConnection; use \OC\Security\CredentialsManager; diff --git a/tests/lib/security/crypto.php b/tests/lib/Security/CryptoTest.php index 1571cf89248..356d504f4b3 100644 --- a/tests/lib/security/crypto.php +++ b/tests/lib/Security/CryptoTest.php @@ -6,6 +6,8 @@ * See the COPYING-README file. */ +namespace Test\Security; + use \OC\Security\Crypto; class CryptoTest extends \Test\TestCase { diff --git a/tests/lib/security/hasher.php b/tests/lib/Security/HasherTest.php index a6f7df5b79f..913f4d703e8 100644 --- a/tests/lib/security/hasher.php +++ b/tests/lib/Security/HasherTest.php @@ -6,6 +6,8 @@ * See the COPYING-README file. */ +namespace Test\Security; + use OC\Security\Hasher; /** diff --git a/tests/lib/security/securerandom.php b/tests/lib/Security/SecureRandomTest.php index 526066d92ee..40431c89795 100644 --- a/tests/lib/security/securerandom.php +++ b/tests/lib/Security/SecureRandomTest.php @@ -6,6 +6,8 @@ * See the COPYING-README file. */ +namespace Test\Security; + use \OC\Security\SecureRandom; class SecureRandomTest extends \Test\TestCase { diff --git a/tests/lib/security/trusteddomainhelper.php b/tests/lib/Security/TrustedDomainHelperTest.php index 3581211ce61..dfd51167cca 100644 --- a/tests/lib/security/trusteddomainhelper.php +++ b/tests/lib/Security/TrustedDomainHelperTest.php @@ -6,6 +6,8 @@ * See the COPYING-README file. */ +namespace Test\Security; + use \OC\Security\TrustedDomainHelper; use OCP\IConfig; diff --git a/tests/lib/server.php b/tests/lib/ServerTest.php index fe3c6fd5ee8..534f3f8cfd5 100644 --- a/tests/lib/server.php +++ b/tests/lib/ServerTest.php @@ -31,7 +31,7 @@ namespace Test; * * @package Test */ -class Server extends \Test\TestCase { +class ServerTest extends \Test\TestCase { /** @var \OC\Server */ protected $server; diff --git a/tests/lib/session/cryptosessiondatatest.php b/tests/lib/Session/CryptoSessionDataTest.php index ee6bcbf11c1..ee6bcbf11c1 100644 --- a/tests/lib/session/cryptosessiondatatest.php +++ b/tests/lib/Session/CryptoSessionDataTest.php diff --git a/tests/lib/session/cryptowrappingtest.php b/tests/lib/Session/CryptoWrappingTest.php index e1fadbf933f..e1fadbf933f 100644 --- a/tests/lib/session/cryptowrappingtest.php +++ b/tests/lib/Session/CryptoWrappingTest.php diff --git a/tests/lib/session/memory.php b/tests/lib/Session/MemoryTest.php index dbf2737fb3f..d92d7b90e5e 100644 --- a/tests/lib/session/memory.php +++ b/tests/lib/Session/MemoryTest.php @@ -9,7 +9,7 @@ namespace Test\Session; -class Memory extends Session { +class MemoryTest extends Session { protected function setUp() { parent::setUp(); @@ -17,7 +17,7 @@ class Memory extends Session { } /** - * @expectedException OCP\Session\Exceptions\SessionNotAvailableException + * @expectedException \OCP\Session\Exceptions\SessionNotAvailableException */ public function testThrowsExceptionOnGetId() { $this->instance->getId(); diff --git a/tests/lib/session/session.php b/tests/lib/Session/Session.php index a1ed01b2ec8..a1ed01b2ec8 100644 --- a/tests/lib/session/session.php +++ b/tests/lib/Session/Session.php diff --git a/tests/lib/setup.php b/tests/lib/SetupTest.php index bc78c14008f..e2723efd76a 100644 --- a/tests/lib/setup.php +++ b/tests/lib/SetupTest.php @@ -6,23 +6,25 @@ * See the COPYING-README file. */ +namespace Test; + use OCP\IConfig; -class Test_OC_Setup extends \Test\TestCase { +class SetupTest extends \Test\TestCase { - /** @var IConfig | PHPUnit_Framework_MockObject_MockObject */ + /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ protected $config; - /** @var \bantu\IniGetWrapper\IniGetWrapper | PHPUnit_Framework_MockObject_MockObject */ + /** @var \bantu\IniGetWrapper\IniGetWrapper | \PHPUnit_Framework_MockObject_MockObject */ private $iniWrapper; - /** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject */ private $l10n; - /** @var \OC_Defaults | PHPUnit_Framework_MockObject_MockObject */ + /** @var \OC_Defaults | \PHPUnit_Framework_MockObject_MockObject */ private $defaults; - /** @var \OC\Setup | PHPUnit_Framework_MockObject_MockObject */ + /** @var \OC\Setup | \PHPUnit_Framework_MockObject_MockObject */ protected $setupClass; - /** @var \OCP\ILogger | PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\ILogger | \PHPUnit_Framework_MockObject_MockObject */ protected $logger; - /** @var \OCP\Security\ISecureRandom | PHPUnit_Framework_MockObject_MockObject */ + /** @var \OCP\Security\ISecureRandom | \PHPUnit_Framework_MockObject_MockObject */ protected $random; protected function setUp() { diff --git a/tests/lib/share/backend.php b/tests/lib/Share/Backend.php index 9c0d7fcb020..c5007d1583b 100644 --- a/tests/lib/share/backend.php +++ b/tests/lib/Share/Backend.php @@ -19,7 +19,9 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -class Test_Share_Backend implements OCP\Share_Backend { +namespace Test\Share; + +class Backend implements \OCP\Share_Backend { const FORMAT_SOURCE = 0; const FORMAT_TARGET = 1; diff --git a/tests/lib/share/helper.php b/tests/lib/Share/HelperTest.php index eaa29c8cb90..02118bf0e2e 100644 --- a/tests/lib/share/helper.php +++ b/tests/lib/Share/HelperTest.php @@ -19,11 +19,13 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ +namespace Test\Share; + /** * @group DB - * Class Test_Share_Helper + * Class Helper */ -class Test_Share_Helper extends \Test\TestCase { +class HelperTest extends \Test\TestCase { public function expireDateProvider() { return array( diff --git a/tests/lib/share/MailNotificationsTest.php b/tests/lib/Share/MailNotificationsTest.php index f160fed57ae..0c951d11f88 100644 --- a/tests/lib/share/MailNotificationsTest.php +++ b/tests/lib/Share/MailNotificationsTest.php @@ -19,6 +19,8 @@ * */ +namespace Test\Share; + use OC\Share\MailNotifications; use OCP\IL10N; use OCP\IUser; @@ -33,15 +35,15 @@ use OCP\IURLGenerator; class MailNotificationsTest extends \Test\TestCase { /** @var IL10N */ private $l10n; - /** @var IMailer | PHPUnit_Framework_MockObject_MockObject */ + /** @var IMailer | \PHPUnit_Framework_MockObject_MockObject */ private $mailer; /** @var ILogger */ private $logger; - /** @var Defaults | PHPUnit_Framework_MockObject_MockObject */ + /** @var Defaults | \PHPUnit_Framework_MockObject_MockObject */ private $defaults; - /** @var IUser | PHPUnit_Framework_MockObject_MockObject */ + /** @var IUser | \PHPUnit_Framework_MockObject_MockObject */ private $user; - /** @var IURLGenerator | PHPUnit_Framework_MockObject_MockObject */ + /** @var IURLGenerator | \PHPUnit_Framework_MockObject_MockObject */ private $urlGenerator; @@ -209,7 +211,7 @@ class MailNotificationsTest extends \Test\TestCase { public function testSendInternalShareMail() { $this->setupMailerMock('TestUser shared »welcome.txt« with you', ['recipient@owncloud.com' => 'Recipient'], false); - /** @var MailNotifications | PHPUnit_Framework_MockObject_MockObject $mailNotifications */ + /** @var MailNotifications | \PHPUnit_Framework_MockObject_MockObject $mailNotifications */ $mailNotifications = $this->getMock('OC\Share\MailNotifications',['getItemSharedWithUser'], [ $this->user, $this->l10n, @@ -286,7 +288,7 @@ class MailNotificationsTest extends \Test\TestCase { ->expects($this->once()) ->method('send') ->with($message) - ->will($this->throwException(new Exception('Some Exception Message'))); + ->will($this->throwException(new \Exception('Some Exception Message'))); } } } diff --git a/tests/lib/share/searchresultsorter.php b/tests/lib/Share/SearchResultSorterTest.php index d91110f7a9a..7feccdd82f5 100644 --- a/tests/lib/share/searchresultsorter.php +++ b/tests/lib/Share/SearchResultSorterTest.php @@ -19,7 +19,9 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -class Test_Share_Search extends \Test\TestCase { +namespace Test\Share; + +class SearchResultSorterTest extends \Test\TestCase { public function testSort() { $search = 'lin'; $sorter = new \OC\Share\SearchResultSorter($search, 'foobar'); diff --git a/tests/lib/share/share.php b/tests/lib/Share/ShareTest.php index a07e90effc3..339193e7ff2 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/Share/ShareTest.php @@ -19,12 +19,14 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ +namespace Test\Share; + /** * Class Test_Share * * @group DB */ -class Test_Share extends \Test\TestCase { +class ShareTest extends \Test\TestCase { protected $itemType; protected $userBackend; @@ -45,8 +47,8 @@ class Test_Share extends \Test\TestCase { protected function setUp() { parent::setUp(); - OC_User::clearBackends(); - OC_User::useBackend('dummy'); + \OC_User::clearBackends(); + \OC_User::useBackend('dummy'); $this->user1 = $this->getUniqueID('user1_'); $this->user2 = $this->getUniqueID('user2_'); $this->user3 = $this->getUniqueID('user3_'); @@ -61,24 +63,24 @@ class Test_Share extends \Test\TestCase { \OC::$server->getUserManager()->createUser($this->user5, 'pass'); \OC::$server->getUserManager()->createUser($this->user6, 'pass'); // no group \OC::$server->getUserManager()->createUser($this->groupAndUser, 'pass'); - OC_User::setUserId($this->user1); - OC_Group::clearBackends(); - OC_Group::useBackend(new \Test\Util\Group\Dummy()); + \OC_User::setUserId($this->user1); + \OC_Group::clearBackends(); + \OC_Group::useBackend(new \Test\Util\Group\Dummy()); $this->group1 = $this->getUniqueID('group1_'); $this->group2 = $this->getUniqueID('group2_'); - OC_Group::createGroup($this->group1); - OC_Group::createGroup($this->group2); - OC_Group::createGroup($this->groupAndUser); - OC_Group::addToGroup($this->user1, $this->group1); - OC_Group::addToGroup($this->user2, $this->group1); - OC_Group::addToGroup($this->user3, $this->group1); - OC_Group::addToGroup($this->user2, $this->group2); - OC_Group::addToGroup($this->user4, $this->group2); - OC_Group::addToGroup($this->user2, $this->groupAndUser); - OC_Group::addToGroup($this->user3, $this->groupAndUser); - OCP\Share::registerBackend('test', 'Test_Share_Backend'); - OC_Hook::clear('OCP\\Share'); - OC::registerShareHooks(); + \OC_Group::createGroup($this->group1); + \OC_Group::createGroup($this->group2); + \OC_Group::createGroup($this->groupAndUser); + \OC_Group::addToGroup($this->user1, $this->group1); + \OC_Group::addToGroup($this->user2, $this->group1); + \OC_Group::addToGroup($this->user3, $this->group1); + \OC_Group::addToGroup($this->user2, $this->group2); + \OC_Group::addToGroup($this->user4, $this->group2); + \OC_Group::addToGroup($this->user2, $this->groupAndUser); + \OC_Group::addToGroup($this->user3, $this->groupAndUser); + \OCP\Share::registerBackend('test', 'Test\Share\Backend'); + \OC_Hook::clear('OCP\\Share'); + \OC::registerShareHooks(); $this->resharing = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes'); \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes'); @@ -90,7 +92,7 @@ class Test_Share extends \Test\TestCase { } protected function tearDown() { - $query = OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?'); + $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?'); $query->execute(array('test')); \OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', $this->resharing); @@ -109,9 +111,9 @@ class Test_Share extends \Test\TestCase { $user = \OC::$server->getUserManager()->get($this->groupAndUser); if ($user !== null) { $user->delete(); } - OC_Group::deleteGroup($this->group1); - OC_Group::deleteGroup($this->group2); - OC_Group::deleteGroup($this->groupAndUser); + \OC_Group::deleteGroup($this->group1); + \OC_Group::deleteGroup($this->group2); + \OC_Group::deleteGroup($this->groupAndUser); $this->logout(); parent::tearDown(); @@ -126,8 +128,8 @@ class Test_Share extends \Test\TestCase { public function testShareInvalidShareType() { $message = 'Share type foobar is not valid for test.txt'; try { - OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, \OCP\Constants::PERMISSION_READ); - } catch (Exception $exception) { + \OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, \OCP\Constants::PERMISSION_READ); + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } } @@ -135,72 +137,72 @@ class Test_Share extends \Test\TestCase { public function testInvalidItemType() { $message = 'Sharing backend for foobar not found'; try { - OCP\Share::shareItem('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('foobar', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } try { - OCP\Share::getItemsSharedWith('foobar'); + \OCP\Share::getItemsSharedWith('foobar'); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } try { - OCP\Share::getItemSharedWith('foobar', 'test.txt'); + \OCP\Share::getItemSharedWith('foobar', 'test.txt'); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } try { - OCP\Share::getItemSharedWithBySource('foobar', 'test.txt'); + \OCP\Share::getItemSharedWithBySource('foobar', 'test.txt'); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } try { - OCP\Share::getItemShared('foobar', 'test.txt'); + \OCP\Share::getItemShared('foobar', 'test.txt'); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } try { - OCP\Share::unshare('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2); + \OCP\Share::unshare('foobar', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } try { - OCP\Share::setPermissions('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_UPDATE); + \OCP\Share::setPermissions('foobar', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_UPDATE); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } } protected function shareUserOneTestFileWithUserTwo() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->assertTrue( - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), 'Failed asserting that user 1 successfully shared text.txt with user 2.' ); $this->assertContains( 'test.txt', - OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that test.txt is a shared file of user 1.' ); - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); $this->assertContains( 'test.txt', - OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that user 2 has access to test.txt after initial sharing.' ); } protected function shareUserTestFileAsLink() { - OC_User::setUserId($this->user1); - $result = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); + \OC_User::setUserId($this->user1); + $result = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); $this->assertTrue(is_string($result)); } @@ -209,21 +211,21 @@ class Test_Share extends \Test\TestCase { * @param string $receiver */ protected function shareUserTestFileWithUser($sharer, $receiver) { - OC_User::setUserId($sharer); + \OC_User::setUserId($sharer); $this->assertTrue( - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $receiver, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $receiver, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), 'Failed asserting that ' . $sharer . ' successfully shared text.txt with ' . $receiver . '.' ); $this->assertContains( 'test.txt', - OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that test.txt is a shared file of ' . $sharer . '.' ); - OC_User::setUserId($receiver); + \OC_User::setUserId($receiver); $this->assertContains( 'test.txt', - OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that ' . $receiver . ' has access to test.txt after initial sharing.' ); } @@ -232,23 +234,23 @@ class Test_Share extends \Test\TestCase { // Invalid shares $message = 'Sharing test.txt failed, because you can not share with yourself'; try { - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } $message = 'Sharing test.txt failed, because the user foobar does not exist'; try { - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, 'foobar', \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, 'foobar', \OCP\Constants::PERMISSION_READ); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } $message = 'Sharing foobar failed, because the sharing backend for test could not find its source'; try { - OCP\Share::shareItem('test', 'foobar', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('test', 'foobar', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } @@ -256,140 +258,140 @@ class Test_Share extends \Test\TestCase { $this->shareUserOneTestFileWithUserTwo(); // Attempt to share again - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $message = 'Sharing test.txt failed, because this item is already shared with '.$this->user2; try { - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } // Attempt to share back - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); $message = 'Sharing failed, because the user '.$this->user1.' is the original sharer'; try { - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } // Unshare - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2)); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2)); // Attempt reshare without share permission - $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); - OC_User::setUserId($this->user2); + $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); + \OC_User::setUserId($this->user2); $message = 'Sharing test.txt failed, because resharing is not allowed'; try { - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } // Owner grants share and update permission - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE)); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE)); // Attempt reshare with escalated permissions - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); $message = 'Sharing test.txt failed, because the permissions exceed permissions granted to '.$this->user2; try { - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } // Valid reshare - $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE)); - $this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE)); - OC_User::setUserId($this->user3); - $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE)); - $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); + $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE)); + $this->assertEquals(array('test.txt'), \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE)); + \OC_User::setUserId($this->user3); + $this->assertEquals(array('test.txt'), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE)); + $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS)); // Attempt to escalate permissions - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); $message = 'Setting permissions for test.txt failed, because the permissions exceed permissions granted to '.$this->user2; try { - OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE); + \OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE); $this->fail('Exception was expected: '.$message); - } catch (Exception $exception) { + } catch (\Exception $exception) { $this->assertEquals($message, $exception->getMessage()); } // Remove update permission - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE)); - OC_User::setUserId($this->user2); - $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); - OC_User::setUserId($this->user3); - $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE)); + \OC_User::setUserId($this->user2); + $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS)); + \OC_User::setUserId($this->user3); + $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS)); // Remove share permission - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); - OC_User::setUserId($this->user2); - $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); - OC_User::setUserId($this->user3); - $this->assertSame(array(), OCP\Share::getItemSharedWith('test', 'test.txt')); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); + \OC_User::setUserId($this->user2); + $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS)); + \OC_User::setUserId($this->user3); + $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt')); // Reshare again, and then have owner unshare - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE)); - OC_User::setUserId($this->user2); - $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ)); - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2)); - OC_User::setUserId($this->user2); - $this->assertSame(array(), OCP\Share::getItemSharedWith('test', 'test.txt')); - OC_User::setUserId($this->user3); - $this->assertSame(array(), OCP\Share::getItemSharedWith('test', 'test.txt')); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE)); + \OC_User::setUserId($this->user2); + $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ)); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2)); + \OC_User::setUserId($this->user2); + $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt')); + \OC_User::setUserId($this->user3); + $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt')); // Attempt target conflict - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); - OC_User::setUserId($this->user3); - $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); + \OC_User::setUserId($this->user3); + $this->assertTrue(\OCP\Share::shareItem('test', 'share.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); - OC_User::setUserId($this->user2); - $to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET); + \OC_User::setUserId($this->user2); + $to_test = \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET); $this->assertEquals(2, count($to_test)); $this->assertTrue(in_array('test.txt', $to_test)); $this->assertTrue(in_array('test1.txt', $to_test)); // Unshare from self - $this->assertTrue(OCP\Share::unshareFromSelf('test', 'test.txt')); - $this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); + $this->assertTrue(\OCP\Share::unshareFromSelf('test', 'test.txt')); + $this->assertEquals(array('test1.txt'), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET)); // Unshare from self via source - $this->assertTrue(OCP\Share::unshareFromSelf('test', 'share.txt', true)); - $this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); + $this->assertTrue(\OCP\Share::unshareFromSelf('test', 'share.txt', true)); + $this->assertEquals(array(), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET)); - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); - OC_User::setUserId($this->user3); - $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); + \OC_User::setUserId($this->user3); + $this->assertTrue(\OCP\Share::shareItem('test', 'share.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ)); - OC_User::setUserId($this->user2); - $to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET); + \OC_User::setUserId($this->user2); + $to_test = \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET); $this->assertEquals(2, count($to_test)); $this->assertTrue(in_array('test.txt', $to_test)); $this->assertTrue(in_array('test1.txt', $to_test)); // Remove user - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $user = \OC::$server->getUserManager()->get($this->user1); if ($user !== null) { $user->delete(); } - OC_User::setUserId($this->user2); - $this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); + \OC_User::setUserId($this->user2); + $this->assertEquals(array('test1.txt'), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET)); } public function testShareWithUserExpirationExpired() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->shareUserOneTestFileWithUserTwo(); $this->shareUserTestFileAsLink(); @@ -402,14 +404,14 @@ class Test_Share extends \Test\TestCase { $query->bindValue(5, \OCP\Share::SHARE_TYPE_LINK); $query->execute(); - $shares = OCP\Share::getItemsShared('test'); + $shares = \OCP\Share::getItemsShared('test'); $this->assertSame(1, count($shares)); $share = reset($shares); $this->assertSame(\OCP\Share::SHARE_TYPE_USER, $share['share_type']); } public function testGetShareFromOutsideFilesFolder() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $view = new \OC\Files\View('/' . $this->user1 . '/'); $view->mkdir('files/test'); $view->mkdir('files/test/sub'); @@ -422,41 +424,41 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), 'Failed asserting that user 1 successfully shared "test/sub" with user 2.' ); - $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE); + $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE); $this->assertNotEmpty($result); - $result = OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2); + $result = \OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2); $this->assertNotEmpty($result); - $result = OCP\Share::getItemsSharedWithUser('folder', $this->user2); + $result = \OCP\Share::getItemsSharedWithUser('folder', $this->user2); $this->assertNotEmpty($result); // move to trash (keeps file id) $view->rename('files/test', 'files_trashbin/files/test'); - $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE); + $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE); $this->assertEmpty($result, 'Share must not be returned for files outside of "files"'); - $result = OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2); + $result = \OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2); $this->assertEmpty($result, 'Share must not be returned for files outside of "files"'); - $result = OCP\Share::getItemsSharedWithUser('folder', $this->user2); + $result = \OCP\Share::getItemsSharedWithUser('folder', $this->user2); $this->assertEmpty($result, 'Share must not be returned for files outside of "files"'); } public function testSetExpireDateInPast() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->shareUserOneTestFileWithUserTwo(); $this->shareUserTestFileAsLink(); $setExpireDateFailed = false; try { $this->assertTrue( - OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInPast, ''), + \OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInPast, ''), 'Failed asserting that user 1 successfully set an expiration date for the test.txt share.' ); } catch (\Exception $e) { @@ -467,17 +469,17 @@ class Test_Share extends \Test\TestCase { } public function testShareWithUserExpirationValid() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->shareUserOneTestFileWithUserTwo(); $this->shareUserTestFileAsLink(); $this->assertTrue( - OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''), + \OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''), 'Failed asserting that user 1 successfully set an expiration date for the test.txt share.' ); - $shares = OCP\Share::getItemsShared('test'); + $shares = \OCP\Share::getItemsShared('test'); $this->assertSame(2, count($shares)); } @@ -488,14 +490,14 @@ class Test_Share extends \Test\TestCase { */ public function testShareWithUserAndUserIsExcludedFromResharing() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->assertTrue( - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL), + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL), 'Failed asserting that user 1 successfully shared text.txt with user 4.' ); $this->assertContains( 'test.txt', - OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that test.txt is a shared file of user 1.' ); @@ -503,9 +505,9 @@ class Test_Share extends \Test\TestCase { \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', $this->group2); \OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', "yes"); - OC_User::setUserId($this->user4); + \OC_User::setUserId($this->user4); - $share = OCP\Share::getItemSharedWith('test', 'test.txt'); + $share = \OCP\Share::getItemSharedWith('test', 'test.txt'); $this->assertSame(\OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_SHARE, $share['permissions'], 'Failed asserting that user 4 is excluded from re-sharing'); @@ -516,7 +518,7 @@ class Test_Share extends \Test\TestCase { } public function testSharingAFolderThatIsSharedWithAGroupOfTheOwner() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $view = new \OC\Files\View('/' . $this->user1 . '/'); $view->mkdir('files/test'); $view->mkdir('files/test/sub1'); @@ -527,11 +529,11 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE), 'Failed asserting that user 1 successfully shared "test/sub1" with group 1.' ); - $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE); + $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE); $this->assertNotEmpty($result); $this->assertEquals(\OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE, $result['permissions']); @@ -540,17 +542,17 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ), 'Failed asserting that user 1 successfully shared "test/sub1/sub2" with user 4.' ); - $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE); + $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE); $this->assertNotEmpty($result); $this->assertEquals(\OCP\Constants::PERMISSION_READ, $result['permissions']); } public function testSharingAFileInsideAFolderThatIsAlreadyShared() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $view = new \OC\Files\View('/' . $this->user1 . '/'); $view->mkdir('files/test'); $view->mkdir('files/test/sub1'); @@ -565,12 +567,12 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); $this->assertTrue( - OCP\Share::shareItem('folder', $folderId, OCP\Share::SHARE_TYPE_GROUP, $this->group2, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_UPDATE), + \OCP\Share::shareItem('folder', $folderId, \OCP\Share::SHARE_TYPE_GROUP, $this->group2, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_UPDATE), 'Failed asserting that user 1 successfully shared "test/sub1" with group 2.' ); $this->assertTrue( - OCP\Share::shareItem('file', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), + \OCP\Share::shareItem('file', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), 'Failed asserting that user 1 successfully shared "test/sub1/file.txt" with user 2.' ); @@ -585,28 +587,28 @@ class Test_Share extends \Test\TestCase { } protected function shareUserOneTestFileWithGroupOne() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->assertTrue( - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ), + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ), 'Failed asserting that user 1 successfully shared text.txt with group 1.' ); $this->assertContains( 'test.txt', - OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that test.txt is a shared file of user 1.' ); - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); $this->assertContains( 'test.txt', - OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that user 2 has access to test.txt after initial sharing.' ); - OC_User::setUserId($this->user3); + \OC_User::setUserId($this->user3); $this->assertContains( 'test.txt', - OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), 'Failed asserting that user 3 has access to test.txt after initial sharing.' ); } @@ -616,11 +618,11 @@ class Test_Share extends \Test\TestCase { * child entries */ public function testShareWithGroupThenUnshare() { - OC_User::setUserId($this->user5); - OCP\Share::shareItem( + \OC_User::setUserId($this->user5); + \OCP\Share::shareItem( 'test', 'test.txt', - OCP\Share::SHARE_TYPE_GROUP, + \OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_ALL ); @@ -628,30 +630,30 @@ class Test_Share extends \Test\TestCase { $targetUsers = array($this->user1, $this->user2, $this->user3); foreach($targetUsers as $targetUser) { - OC_User::setUserId($targetUser); - $items = OCP\Share::getItemsSharedWithUser( + \OC_User::setUserId($targetUser); + $items = \OCP\Share::getItemsSharedWithUser( 'test', $targetUser, - Test_Share_Backend::FORMAT_TARGET + Backend::FORMAT_TARGET ); $this->assertEquals(1, count($items)); } - OC_User::setUserId($this->user5); - OCP\Share::unshare( + \OC_User::setUserId($this->user5); + \OCP\Share::unshare( 'test', 'test.txt', - OCP\Share::SHARE_TYPE_GROUP, + \OCP\Share::SHARE_TYPE_GROUP, $this->group1 ); // verify that all were deleted foreach($targetUsers as $targetUser) { - OC_User::setUserId($targetUser); - $items = OCP\Share::getItemsSharedWithUser( + \OC_User::setUserId($targetUser); + $items = \OCP\Share::getItemsSharedWithUser( 'test', $targetUser, - Test_Share_Backend::FORMAT_TARGET + Backend::FORMAT_TARGET ); $this->assertEquals(0, count($items)); } @@ -661,33 +663,33 @@ class Test_Share extends \Test\TestCase { $this->shareUserTestFileWithUser($this->user1, $this->groupAndUser); - OC_User::setUserId($this->groupAndUser); + \OC_User::setUserId($this->groupAndUser); - $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + $this->assertEquals(array('test.txt'), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), '"groupAndUser"-User does not see the file but it was shared with him'); - OC_User::setUserId($this->user2); - $this->assertEquals(array(), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OC_User::setUserId($this->user2); + $this->assertEquals(array(), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), 'User2 sees test.txt but it was only shared with the user "groupAndUser" and not with group'); - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt')); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::unshareAll('test', 'test.txt')); $this->assertTrue( - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->groupAndUser, \OCP\Constants::PERMISSION_READ), + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_GROUP, $this->groupAndUser, \OCP\Constants::PERMISSION_READ), 'Failed asserting that user 1 successfully shared text.txt with group 1.' ); - OC_User::setUserId($this->groupAndUser); - $this->assertEquals(array(), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OC_User::setUserId($this->groupAndUser); + $this->assertEquals(array(), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), '"groupAndUser"-User sees test.txt but it was only shared with the group "groupAndUser" and not with the user'); - OC_User::setUserId($this->user2); - $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE), + \OC_User::setUserId($this->user2); + $this->assertEquals(array('test.txt'), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE), 'User2 does not see test.txt but it was shared with the group "groupAndUser"'); - OC_User::setUserId($this->user1); - $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt')); + \OC_User::setUserId($this->user1); + $this->assertTrue(\OCP\Share::unshareAll('test', 'test.txt')); } @@ -696,7 +698,7 @@ class Test_Share extends \Test\TestCase { * @return array */ protected function getShareByValidToken($token) { - $row = OCP\Share::getShareByToken($token); + $row = \OCP\Share::getShareByToken($token); $this->assertInternalType( 'array', $row, @@ -706,21 +708,21 @@ class Test_Share extends \Test\TestCase { } public function testGetItemSharedWithUser() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); //add dummy values to the share table $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' .' `item_type`, `item_source`, `item_target`, `share_type`,' .' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)'); - $args = array('test', 99, 'target1', OCP\Share::SHARE_TYPE_USER, $this->user2, $this->user1); + $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2, $this->user1); $query->execute($args); - $args = array('test', 99, 'target2', OCP\Share::SHARE_TYPE_USER, $this->user4, $this->user1); + $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4, $this->user1); $query->execute($args); - $args = array('test', 99, 'target3', OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user2); + $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user2); $query->execute($args); - $args = array('test', 99, 'target4', OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user4); + $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user4); $query->execute($args); - $args = array('test', 99, 'target4', OCP\Share::SHARE_TYPE_USER, $this->user6, $this->user4); + $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6, $this->user4); $query->execute($args); @@ -746,19 +748,19 @@ class Test_Share extends \Test\TestCase { } public function testGetItemSharedWithUserFromGroupShare() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); //add dummy values to the share table $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (' .' `item_type`, `item_source`, `item_target`, `share_type`,' .' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)'); - $args = array('test', 99, 'target1', OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user1); + $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user1); $query->execute($args); - $args = array('test', 99, 'target2', OCP\Share::SHARE_TYPE_GROUP, $this->group2, $this->user1); + $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2, $this->user1); $query->execute($args); - $args = array('test', 99, 'target3', OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user2); + $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user2); $query->execute($args); - $args = array('test', 99, 'target4', OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user4); + $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user4); $query->execute($args); // user2 is in group1 and group2 @@ -794,7 +796,7 @@ class Test_Share extends \Test\TestCase { } public function testGetShareSubItemsWhenUserNotInGroup() { - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ); $result = \OCP\Share::getItemsSharedWithUser('test', $this->user2); $this->assertCount(1, $result); @@ -831,8 +833,8 @@ class Test_Share extends \Test\TestCase { } public function testShareItemWithLink() { - OC_User::setUserId($this->user1); - $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); + \OC_User::setUserId($this->user1); + $token = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); $this->assertInternalType( 'string', $token, @@ -848,7 +850,7 @@ class Test_Share extends \Test\TestCase { // testGetShareByTokenExpirationValid $this->assertTrue( - OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''), + \OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''), 'Failed asserting that user 1 successfully set a future expiration date for the test.txt share.' ); $row = $this->getShareByValidToken($token); @@ -867,20 +869,20 @@ class Test_Share extends \Test\TestCase { $query->execute(); $this->assertFalse( - OCP\Share::getShareByToken($token), + \OCP\Share::getShareByToken($token), 'Failed asserting that an expired share could not be found.' ); } public function testShareItemWithLinkAndDefaultExpireDate() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $config = \OC::$server->getConfig(); $config->setAppValue('core', 'shareapi_default_expire_date', 'yes'); $config->setAppValue('core', 'shareapi_expire_after_n_days', '2'); - $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); + $token = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); $this->assertInternalType( 'string', $token, @@ -925,8 +927,8 @@ class Test_Share extends \Test\TestCase { * @expectedException \OC\HintException */ public function testShareWithRemoteUserAndRemoteIsInvalid($remoteId) { - OC_User::setUserId($this->user1); - OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_REMOTE, $remoteId, \OCP\Constants::PERMISSION_ALL); + \OC_User::setUserId($this->user1); + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $remoteId, \OCP\Constants::PERMISSION_ALL); } public function testUnshareAll() { @@ -935,49 +937,49 @@ class Test_Share extends \Test\TestCase { $this->shareUserTestFileWithUser($this->user3, $this->user4); $this->shareUserOneTestFileWithGroupOne(); - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->assertEquals( array('test.txt', 'test.txt'), - OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemsShared('test', Backend::FORMAT_SOURCE), 'Failed asserting that the test.txt file is shared exactly two times by user1.' ); - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); $this->assertEquals( array('test.txt'), - OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemsShared('test', Backend::FORMAT_SOURCE), 'Failed asserting that the test.txt file is shared exactly once by user2.' ); - OC_User::setUserId($this->user3); + \OC_User::setUserId($this->user3); $this->assertEquals( array('test.txt'), - OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE), + \OCP\Share::getItemsShared('test', Backend::FORMAT_SOURCE), 'Failed asserting that the test.txt file is shared exactly once by user3.' ); $this->assertTrue( - OCP\Share::unshareAll('test', 'test.txt'), + \OCP\Share::unshareAll('test', 'test.txt'), 'Failed asserting that user 3 successfully unshared all shares of the test.txt share.' ); $this->assertEquals( array(), - OCP\Share::getItemsShared('test'), + \OCP\Share::getItemsShared('test'), 'Failed asserting that the share of the test.txt file by user 3 has been removed.' ); - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $this->assertEquals( array(), - OCP\Share::getItemsShared('test'), + \OCP\Share::getItemsShared('test'), 'Failed asserting that both shares of the test.txt file by user 1 have been removed.' ); - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); $this->assertEquals( array(), - OCP\Share::getItemsShared('test'), + \OCP\Share::getItemsShared('test'), 'Failed asserting that the share of the test.txt file by user 2 has been removed.' ); } @@ -1154,13 +1156,13 @@ class Test_Share extends \Test\TestCase { * is enforced by the settings. */ public function testClearExpireDateWhileEnforced() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); \OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'yes'); \OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '2'); \OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'yes'); - $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); + $token = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); $this->assertInternalType( 'string', $token, @@ -1170,7 +1172,7 @@ class Test_Share extends \Test\TestCase { $setExpireDateFailed = false; try { $this->assertTrue( - OCP\Share::setExpirationDate('test', 'test.txt', '', ''), + \OCP\Share::setExpirationDate('test', 'test.txt', '', ''), 'Failed asserting that user 1 successfully set an expiration date for the test.txt share.' ); } catch (\Exception $e) { @@ -1187,7 +1189,7 @@ class Test_Share extends \Test\TestCase { /** * Cannot set password is there is no user * - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage User not logged in */ public function testSetPasswordNoUser() { @@ -1305,7 +1307,7 @@ class Test_Share extends \Test\TestCase { } /** - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage Cannot remove password * * Test removing a password when password is enforced @@ -1358,7 +1360,7 @@ class Test_Share extends \Test\TestCase { } /** - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage Share not found * * Test modification of invaid share @@ -1411,7 +1413,7 @@ class Test_Share extends \Test\TestCase { } /** - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage Cannot update share of a different user * * Test modification of share of another user @@ -1509,7 +1511,7 @@ class Test_Share extends \Test\TestCase { // Expiration date $expireAt = time() + 2 * 24*60*60; - $date = new DateTime(); + $date = new \DateTime(); $date->setTimestamp($expireAt); $date->setTime(0, 0, 0); @@ -1517,20 +1519,20 @@ class Test_Share extends \Test\TestCase { $this->shareUserTestFileWithUser($this->user1, $this->user2); //User 2 shares as link - OC_User::setUserId($this->user2); - $result = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); + \OC_User::setUserId($this->user2); + $result = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ); $this->assertTrue(is_string($result)); //Check if expire date is correct - $result = OCP\Share::getItemShared('test', 'test.txt'); + $result = \OCP\Share::getItemShared('test', 'test.txt'); $this->assertCount(1, $result); $result = reset($result); $this->assertNotEmpty($result['expiration']); - $expireDate = new DateTime($result['expiration']); + $expireDate = new \DateTime($result['expiration']); $this->assertEquals($date, $expireDate); //Unshare - $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt')); + $this->assertTrue(\OCP\Share::unshareAll('test', 'test.txt')); //Reset config $config->deleteAppValue('core', 'shareapi_default_expire_date'); @@ -1541,7 +1543,7 @@ class Test_Share extends \Test\TestCase { * Test case for #17560 */ public function testAccesToSharedSubFolder() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $view = new \OC\Files\View('/' . $this->user1 . '/'); $view->mkdir('files/folder1'); @@ -1550,11 +1552,11 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL), 'Failed asserting that user 1 successfully shared "test" with user 2.' ); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_ALL), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_ALL), 'Failed asserting that user 1 successfully shared "test" with user 3.' ); @@ -1565,28 +1567,28 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL), 'Failed asserting that user 1 successfully shared "test" with user 4.' ); - $res = OCP\Share::getItemShared( + $res = \OCP\Share::getItemShared( 'folder', $fileId, - OCP\Share::FORMAT_NONE, + \OCP\Share::FORMAT_NONE, null, true ); $this->assertCount(3, $res); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user5, \OCP\Constants::PERMISSION_ALL), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user5, \OCP\Constants::PERMISSION_ALL), 'Failed asserting that user 1 successfully shared "test" with user 5.' ); - $res = OCP\Share::getItemShared( + $res = \OCP\Share::getItemShared( 'folder', $fileId, - OCP\Share::FORMAT_NONE, + \OCP\Share::FORMAT_NONE, null, true ); @@ -1594,7 +1596,7 @@ class Test_Share extends \Test\TestCase { } public function testShareWithSelfError() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $view = new \OC\Files\View('/' . $this->user1 . '/'); $view->mkdir('files/folder1'); @@ -1603,7 +1605,7 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); try { - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL); $this->fail(); } catch (\Exception $e) { $this->assertEquals('Sharing /folder1 failed, because you can not share with yourself', $e->getMessage()); @@ -1612,7 +1614,7 @@ class Test_Share extends \Test\TestCase { public function testShareWithOwnerError() { - OC_User::setUserId($this->user1); + \OC_User::setUserId($this->user1); $view = new \OC\Files\View('/' . $this->user1 . '/'); $view->mkdir('files/folder1'); @@ -1621,13 +1623,13 @@ class Test_Share extends \Test\TestCase { $fileId = $fileInfo->getId(); $this->assertTrue( - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL), + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL), 'Failed asserting that user 1 successfully shared "test" with user 2.' ); - OC_User::setUserId($this->user2); + \OC_User::setUserId($this->user2); try { - OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL); + \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL); $this->fail(); } catch (\Exception $e) { $this->assertEquals('Sharing failed, because the user ' . $this->user1 . ' is the original sharer', $e->getMessage()); diff --git a/tests/lib/share20/defaultshareprovidertest.php b/tests/lib/Share20/DefaultShareProviderTest.php index 44a48535b9b..6ef00721a70 100644 --- a/tests/lib/share20/defaultshareprovidertest.php +++ b/tests/lib/Share20/DefaultShareProviderTest.php @@ -57,6 +57,8 @@ class DefaultShareProviderTest extends \Test\TestCase { $this->groupManager = $this->getMock('OCP\IGroupManager'); $this->rootFolder = $this->getMock('OCP\Files\IRootFolder'); + $this->userManager->expects($this->any())->method('userExists')->willReturn(true); + //Empty share table $this->dbConn->getQueryBuilder()->delete('share')->execute(); @@ -587,7 +589,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testCreateUserShare() { - $share = new \OC\Share20\Share($this->rootFolder); + $share = new \OC\Share20\Share($this->rootFolder, $this->userManager); $shareOwner = $this->getMock('OCP\IUser'); $shareOwner->method('getUID')->WillReturn('shareOwner'); @@ -635,7 +637,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testCreateGroupShare() { - $share = new \OC\Share20\Share($this->rootFolder); + $share = new \OC\Share20\Share($this->rootFolder, $this->userManager); $shareOwner = $this->getMock('\OCP\IUser'); $shareOwner->method('getUID')->willReturn('shareOwner'); @@ -683,7 +685,7 @@ class DefaultShareProviderTest extends \Test\TestCase { } public function testCreateLinkShare() { - $share = new \OC\Share20\Share($this->rootFolder); + $share = new \OC\Share20\Share($this->rootFolder, $this->userManager); $shareOwner = $this->getMock('\OCP\IUser'); $shareOwner->method('getUID')->willReturn('shareOwner'); diff --git a/tests/lib/share20/managertest.php b/tests/lib/Share20/ManagerTest.php index 7d79150449c..a50ea6c892a 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -2283,6 +2283,9 @@ class ManagerTest extends \Test\TestCase { } public function testUpdateShareUser() { + + $this->userManager->expects($this->any())->method('userExists')->willReturn(true); + $manager = $this->createManagerMock() ->setMethods([ 'canShare', @@ -2567,4 +2570,4 @@ class DummyFactory implements IProviderFactory { public function getProviderForType($shareType) { return $this->provider; } -}
\ No newline at end of file +} diff --git a/tests/lib/share20/sharetest.php b/tests/lib/Share20/ShareTest.php index fdfc69f6577..91bd2fe84b6 100644 --- a/tests/lib/share20/sharetest.php +++ b/tests/lib/Share20/ShareTest.php @@ -36,7 +36,8 @@ class ShareTest extends \Test\TestCase { public function setUp() { $this->rootFolder = $this->getMock('\OCP\Files\IRootFolder'); - $this->share = new \OC\Share20\Share($this->rootFolder); + $this->userManager = $this->getMock('OCP\IUserManager'); + $this->share = new \OC\Share20\Share($this->rootFolder, $this->userManager); } /** diff --git a/tests/lib/streamwrappers.php b/tests/lib/StreamWrappersTest.php index 7175683a60b..a378f975fde 100644 --- a/tests/lib/streamwrappers.php +++ b/tests/lib/StreamWrappersTest.php @@ -20,12 +20,14 @@ * */ +namespace Test; + /** - * Class Test_StreamWrappers + * Class StreamWrappersTest * * @group DB */ -class Test_StreamWrappers extends \Test\TestCase { +class StreamWrappersTest extends \Test\TestCase { private static $trashBinStatus; @@ -54,7 +56,7 @@ class Test_StreamWrappers extends \Test\TestCase { public function testCloseStream() { //ensure all basic stream stuff works - $sourceFile = OC::$SERVERROOT . '/tests/data/lorem.txt'; + $sourceFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; $tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt'); $file = 'close://' . $tmpFile; $this->assertTrue(file_exists($file)); diff --git a/tests/lib/subadmin.php b/tests/lib/SubAdminTest.php index 960943c22f5..c1159132a50 100644 --- a/tests/lib/subadmin.php +++ b/tests/lib/SubAdminTest.php @@ -20,7 +20,7 @@ */ namespace Test; -class SubAdmin extends \Test\TestCase { +class SubAdminTest extends \Test\TestCase { /** @var \OCP\IUserManager */ private $userManager; diff --git a/tests/lib/systemtag/systemtagmanagertest.php b/tests/lib/SystemTag/SystemTagManagerTest.php index 1afb147f08a..e697e373465 100644 --- a/tests/lib/systemtag/systemtagmanagertest.php +++ b/tests/lib/SystemTag/SystemTagManagerTest.php @@ -17,6 +17,8 @@ use OCP\SystemTag\ISystemTag; use OCP\SystemTag\ISystemTagManager; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Test\TestCase; +use OCP\IUserManager; +use OCP\IGroupManager; /** * Class TestSystemTagManager @@ -37,6 +39,11 @@ class SystemTagManagerTest extends TestCase { private $connection; /** + * @var IGroupManager + */ + private $groupManager; + + /** * @var EventDispatcherInterface */ private $dispatcher; @@ -49,8 +56,11 @@ class SystemTagManagerTest extends TestCase { $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface') ->getMock(); + $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager')->getMock(); + $this->tagManager = new SystemTagManager( $this->connection, + $this->groupManager, $this->dispatcher ); $this->pruneTagsTables(); @@ -410,6 +420,102 @@ class SystemTagManagerTest extends TestCase { ], $tagIdMapping); } + public function visibilityCheckProvider() { + return [ + [false, false, false, false], + [true, false, false, true], + [false, false, true, true], + [true, false, true, true], + ]; + } + + /** + * @dataProvider visibilityCheckProvider + */ + public function testVisibilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult) { + $user = $this->getMockBuilder('\OCP\IUser')->getMock(); + $user->expects($this->any()) + ->method('getUID') + ->will($this->returnValue('test')); + $tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable); + + $this->groupManager->expects($this->any()) + ->method('isAdmin') + ->with('test') + ->will($this->returnValue($isAdmin)); + + $this->assertEquals($expectedResult, $this->tagManager->canUserSeeTag($tag1, $user)); + } + + public function assignabilityCheckProvider() { + return [ + // no groups + [false, false, false, false], + [true, false, false, false], + [true, true, false, true], + [false, true, false, false], + // admin rulez + [false, false, true, true], + [false, true, true, true], + [true, false, true, true], + [true, true, true, true], + // ignored groups + [false, false, false, false, ['group1'], ['group1']], + [true, true, false, true, ['group1'], ['group1']], + [true, true, false, true, ['group1'], ['anothergroup']], + [false, true, false, false, ['group1'], ['group1']], + // admin has precedence over groups + [false, false, true, true, ['group1'], ['anothergroup']], + [false, true, true, true, ['group1'], ['anothergroup']], + [true, false, true, true, ['group1'], ['anothergroup']], + [true, true, true, true, ['group1'], ['anothergroup']], + // groups only checked when visible and user non-assignable and non-admin + [true, false, false, false, ['group1'], ['anothergroup1']], + [true, false, false, true, ['group1'], ['group1']], + [true, false, false, true, ['group1', 'group2'], ['group2', 'group3']], + ]; + } + + /** + * @dataProvider assignabilityCheckProvider + */ + public function testAssignabilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult, $userGroupIds = [], $tagGroupIds = []) { + $user = $this->getMockBuilder('\OCP\IUser')->getMock(); + $user->expects($this->any()) + ->method('getUID') + ->will($this->returnValue('test')); + $tag1 = $this->tagManager->createTag('one', $userVisible, $userAssignable); + $this->tagManager->setTagGroups($tag1, $tagGroupIds); + + $this->groupManager->expects($this->any()) + ->method('isAdmin') + ->with('test') + ->will($this->returnValue($isAdmin)); + $this->groupManager->expects($this->any()) + ->method('getUserGroupIds') + ->with($user) + ->will($this->returnValue($userGroupIds)); + + $this->assertEquals($expectedResult, $this->tagManager->canUserAssignTag($tag1, $user)); + } + + public function testTagGroups() { + $tag1 = $this->tagManager->createTag('tag1', true, false); + $tag2 = $this->tagManager->createTag('tag2', true, false); + $this->tagManager->setTagGroups($tag1, ['group1', 'group2']); + $this->tagManager->setTagGroups($tag2, ['group2', 'group3']); + + $this->assertEquals(['group1', 'group2'], $this->tagManager->getTagGroups($tag1)); + $this->assertEquals(['group2', 'group3'], $this->tagManager->getTagGroups($tag2)); + + // change groups + $this->tagManager->setTagGroups($tag1, ['group3', 'group4']); + $this->tagManager->setTagGroups($tag2, []); + + $this->assertEquals(['group3', 'group4'], $this->tagManager->getTagGroups($tag1)); + $this->assertEquals([], $this->tagManager->getTagGroups($tag2)); + } + /** * @param ISystemTag $tag1 * @param ISystemTag $tag2 diff --git a/tests/lib/systemtag/systemtagobjectmappertest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php index 69cf7e8f816..69cf7e8f816 100644 --- a/tests/lib/systemtag/systemtagobjectmappertest.php +++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php diff --git a/tests/lib/tags.php b/tests/lib/TagsTest.php index 91472d5ceb8..2662c209d2c 100644 --- a/tests/lib/tags.php +++ b/tests/lib/TagsTest.php @@ -20,12 +20,14 @@ * */ +namespace Test; + /** - * Class Test_Tags + * Class TagsTest * * @group DB */ -class Test_Tags extends \Test\TestCase { +class TagsTest extends \Test\TestCase { protected $objectType; /** @var \OCP\IUser */ @@ -41,12 +43,12 @@ class Test_Tags extends \Test\TestCase { protected function setUp() { parent::setUp(); - OC_User::clearBackends(); - OC_User::useBackend('dummy'); + \OC_User::clearBackends(); + \OC_User::useBackend('dummy'); $userId = $this->getUniqueID('user_'); \OC::$server->getUserManager()->createUser($userId, 'pass'); - OC_User::setUserId($userId); - $this->user = new OC\User\User($userId, null); + \OC_User::setUserId($userId); + $this->user = new \OC\User\User($userId, null); $this->userSession = $this->getMock('\OCP\IUserSession'); $this->userSession ->expects($this->any()) @@ -54,8 +56,8 @@ class Test_Tags extends \Test\TestCase { ->will($this->returnValue($this->user)); $this->objectType = $this->getUniqueID('type_'); - $this->tagMapper = new OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection()); - $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession); + $this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection()); + $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession); } @@ -73,7 +75,7 @@ class Test_Tags extends \Test\TestCase { ->expects($this->any()) ->method('getUser') ->will($this->returnValue(null)); - $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession); + $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession); $this->assertNull($this->tagMgr->load($this->objectType)); } @@ -236,7 +238,7 @@ class Test_Tags extends \Test\TestCase { $this->assertTrue($tagger->rename('Wrok', 'Work')); $this->assertTrue($tagger->hasTag('Work')); - $this->assertFalse($tagger->hastag('Wrok')); + $this->assertFalse($tagger->hasTag('Wrok')); $this->assertFalse($tagger->rename('Wrok', 'Work')); // Rename non-existant tag. $this->assertFalse($tagger->rename('Work', 'Family')); // Collide with existing tag. } @@ -284,28 +286,28 @@ class Test_Tags extends \Test\TestCase { public function testShareTags() { $testTag = 'TestTag'; - OCP\Share::registerBackend('test', 'Test_Share_Backend'); + \OCP\Share::registerBackend('test', 'Test\Share\Backend'); $tagger = $this->tagMgr->load('test'); $tagger->tagAs(1, $testTag); $otherUserId = $this->getUniqueID('user2_'); \OC::$server->getUserManager()->createUser($otherUserId, 'pass'); - OC_User::setUserId($otherUserId); + \OC_User::setUserId($otherUserId); $otherUserSession = $this->getMock('\OCP\IUserSession'); $otherUserSession ->expects($this->any()) ->method('getUser') - ->will($this->returnValue(new OC\User\User($otherUserId, null))); + ->will($this->returnValue(new \OC\User\User($otherUserId, null))); - $otherTagMgr = new OC\TagManager($this->tagMapper, $otherUserSession); + $otherTagMgr = new \OC\TagManager($this->tagMapper, $otherUserSession); $otherTagger = $otherTagMgr->load('test'); $this->assertFalse($otherTagger->hasTag($testTag)); - OC_User::setUserId($this->user->getUID()); - OCP\Share::shareItem('test', 1, OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ); + \OC_User::setUserId($this->user->getUID()); + \OCP\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ); - OC_User::setUserId($otherUserId); + \OC_User::setUserId($otherUserId); $otherTagger = $otherTagMgr->load('test', array(), true); // Update tags, load shared ones. $this->assertTrue($otherTagger->hasTag($testTag)); $this->assertContains(1, $otherTagger->getIdsForTag($testTag)); diff --git a/tests/lib/tempmanager.php b/tests/lib/TempManagerTest.php index 8faf804a203..0eaca464c74 100644 --- a/tests/lib/tempmanager.php +++ b/tests/lib/TempManagerTest.php @@ -21,7 +21,7 @@ class NullLogger extends Log { } } -class TempManager extends \Test\TestCase { +class TempManagerTest extends \Test\TestCase { protected $baseDir = null; diff --git a/tests/lib/template/resourcelocator.php b/tests/lib/Template/ResourceLocatorTest.php index ef5e2ed1357..1918b927c94 100644 --- a/tests/lib/template/resourcelocator.php +++ b/tests/lib/Template/ResourceLocatorTest.php @@ -10,7 +10,7 @@ namespace Test\Template; use OC\Template\ResourceNotFoundException; -class ResourceLocator extends \Test\TestCase { +class ResourceLocatorTest extends \Test\TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $logger; diff --git a/tests/lib/template.php b/tests/lib/TemplateFunctionsTest.php index 6e62d3955f1..aa3c73d4743 100644 --- a/tests/lib/template.php +++ b/tests/lib/TemplateFunctionsTest.php @@ -1,5 +1,4 @@ <?php - /** * ownCloud * @@ -20,12 +19,15 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ -class Test_TemplateFunctions extends \Test\TestCase { + +namespace Test; + +class TemplateFunctionsTest extends \Test\TestCase { protected function setUp() { parent::setUp(); - $loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib']); + $loader = new \OC\Autoloader([\OC::$SERVERROOT . '/lib']); $loader->load('OC_Template'); } diff --git a/tests/lib/testcase.php b/tests/lib/TestCase.php index 7ed121d3556..7ed121d3556 100644 --- a/tests/lib/testcase.php +++ b/tests/lib/TestCase.php diff --git a/tests/lib/testmoveablemountpoint.php b/tests/lib/TestMoveableMountPoint.php index 262016b76c1..262016b76c1 100644 --- a/tests/lib/testmoveablemountpoint.php +++ b/tests/lib/TestMoveableMountPoint.php diff --git a/tests/lib/traits/encryptiontrait.php b/tests/lib/Traits/EncryptionTrait.php index 5e2ca4e561f..5e2ca4e561f 100644 --- a/tests/lib/traits/encryptiontrait.php +++ b/tests/lib/Traits/EncryptionTrait.php diff --git a/tests/lib/traits/mountprovidertrait.php b/tests/lib/Traits/MountProviderTrait.php index bccb5b693ee..bccb5b693ee 100644 --- a/tests/lib/traits/mountprovidertrait.php +++ b/tests/lib/Traits/MountProviderTrait.php diff --git a/tests/lib/traits/usertrait.php b/tests/lib/Traits/UserTrait.php index 229087a5200..229087a5200 100644 --- a/tests/lib/traits/usertrait.php +++ b/tests/lib/Traits/UserTrait.php diff --git a/tests/lib/updater/versioncheck.php b/tests/lib/Updater/VersionCheckTest.php index 2122ca28800..fb43571cece 100644 --- a/tests/lib/updater/versioncheck.php +++ b/tests/lib/Updater/VersionCheckTest.php @@ -20,7 +20,7 @@ * */ -namespace OC; +namespace Test\Updater; use OC\Updater\VersionCheck; use OCP\IConfig; diff --git a/tests/lib/updater.php b/tests/lib/UpdaterTest.php index f97eb3ac139..643a18cc714 100644 --- a/tests/lib/updater.php +++ b/tests/lib/UpdaterTest.php @@ -20,8 +20,9 @@ * */ -namespace OC; +namespace Test; +use OC\Updater; use OCP\IConfig; use OCP\ILogger; use OC\IntegrityCheck\Checker; diff --git a/tests/lib/urlGenerator.php b/tests/lib/UrlGeneratorTest.php index 07103225baa..7186c8fad80 100644 --- a/tests/lib/urlGenerator.php +++ b/tests/lib/UrlGeneratorTest.php @@ -6,12 +6,14 @@ * See the COPYING-README file. */ +namespace Test; + /** - * Class Test_UrlGenerator + * Class UrlGeneratorTest * * @group DB */ -class Test_UrlGenerator extends \Test\TestCase { +class UrlGeneratorTest extends \Test\TestCase { /** * @small diff --git a/tests/lib/user/avataruserdummy.php b/tests/lib/User/AvatarUserDummy.php index 086adb6043f..123825de50f 100644 --- a/tests/lib/user/avataruserdummy.php +++ b/tests/lib/User/AvatarUserDummy.php @@ -20,8 +20,10 @@ * */ -class Avatar_User_Dummy extends \Test\Util\User\Dummy { +namespace Test\User; + +class AvatarUserDummy extends \Test\Util\User\Dummy { public function canChangeAvatar($uid) { return true; } -}
\ No newline at end of file +} diff --git a/tests/lib/user/backend.php b/tests/lib/User/Backend.php index d5bbbe9f406..85ccbac913c 100644 --- a/tests/lib/user/backend.php +++ b/tests/lib/User/Backend.php @@ -20,6 +20,8 @@ * */ +namespace Test\User; + /** * Abstract class to provide the basis of backend-specific unit test classes. * @@ -30,7 +32,7 @@ * For an example see /tests/lib/user/dummy.php */ -abstract class Test_User_Backend extends \Test\TestCase { +abstract class Backend extends \Test\TestCase { /** * @var \OC\User\Backend $backend */ diff --git a/tests/lib/user/database.php b/tests/lib/User/DatabaseTest.php index 0dea037ad78..270d90b35bc 100644 --- a/tests/lib/user/database.php +++ b/tests/lib/User/DatabaseTest.php @@ -20,12 +20,14 @@ * */ +namespace Test\User; + /** - * Class Test_User_Database + * Class DatabaseTest * * @group DB */ -class Test_User_Database extends Test_User_Backend { +class DatabaseTest extends Backend { /** @var array */ private $users; diff --git a/tests/lib/user/dummy.php b/tests/lib/User/Dummy.php index c6c79d7a860..50382aa8fe6 100644 --- a/tests/lib/user/dummy.php +++ b/tests/lib/User/Dummy.php @@ -20,7 +20,9 @@ * */ -class Test_User_Dummy extends Test_User_Backend { +namespace Test\User; + +class Dummy extends Backend { protected function setUp() { parent::setUp(); $this->backend=new \Test\Util\User\Dummy(); diff --git a/tests/lib/user/manager.php b/tests/lib/User/ManagerTest.php index 14221e4a665..2a6cdbc1355 100644 --- a/tests/lib/user/manager.php +++ b/tests/lib/User/ManagerTest.php @@ -10,13 +10,13 @@ namespace Test\User; /** - * Class Manager + * Class ManagerTest * * @group DB * * @package Test\User */ -class Manager extends \Test\TestCase { +class ManagerTest extends \Test\TestCase { public function testGetBackends() { $userDummyBackend = $this->getMock('\Test\Util\User\Dummy'); $manager = new \OC\User\Manager(); diff --git a/tests/lib/user/session.php b/tests/lib/User/SessionTest.php index 710d5ae20b3..4438487e2a0 100644 --- a/tests/lib/user/session.php +++ b/tests/lib/User/SessionTest.php @@ -16,7 +16,7 @@ use OC\User\User; * @group DB * @package Test\User */ -class Session extends \Test\TestCase { +class SessionTest extends \Test\TestCase { /** @var \OCP\AppFramework\Utility\ITimeFactory */ private $timeFactory; @@ -477,4 +477,36 @@ class Session extends \Test\TestCase { $this->assertEquals($users['bar'], $userSession->getUser()); } + public function testTryTokenLoginWithDisabledUser() { + $manager = $this->getMockBuilder('\OC\User\Manager') + ->disableOriginalConstructor() + ->getMock(); + $session = new Memory(''); + $token = $this->getMock('\OC\Authentication\Token\IToken'); + $user = $this->getMock('\OCP\IUser'); + $userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->defaultProvider); + $request = $this->getMock('\OCP\IRequest'); + + $request->expects($this->once()) + ->method('getHeader') + ->with('Authorization') + ->will($this->returnValue('token xxxxx')); + $this->defaultProvider->expects($this->once()) + ->method('validateToken') + ->with('xxxxx') + ->will($this->returnValue($token)); + $token->expects($this->once()) + ->method('getUID') + ->will($this->returnValue('user123')); + $manager->expects($this->once()) + ->method('get') + ->with('user123') + ->will($this->returnValue($user)); + $user->expects($this->once()) + ->method('isEnabled') + ->will($this->returnValue(false)); + + $this->assertFalse($userSession->tryTokenLogin($request)); + } + } diff --git a/tests/lib/user/user.php b/tests/lib/User/UserTest.php index 0a972f7bdaa..a49bddde9eb 100644 --- a/tests/lib/user/user.php +++ b/tests/lib/User/UserTest.php @@ -12,13 +12,13 @@ namespace Test\User; use OC\Hooks\PublicEmitter; /** - * Class User + * Class UserTest * * @group DB * * @package Test\User */ -class User extends \Test\TestCase { +class UserTest extends \Test\TestCase { public function testDisplayName() { /** * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend @@ -120,8 +120,7 @@ class User extends \Test\TestCase { /** * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend */ - require_once 'avataruserdummy.php'; - $backend = $this->getMock('Avatar_User_Dummy'); + $backend = $this->getMock('Test\User\AvatarUserDummy'); $backend->expects($this->once()) ->method('canChangeAvatar') ->with($this->equalTo('foo')) @@ -145,8 +144,7 @@ class User extends \Test\TestCase { /** * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend */ - require_once 'avataruserdummy.php'; - $backend = $this->getMock('Avatar_User_Dummy'); + $backend = $this->getMock('Test\User\AvatarUserDummy'); $backend->expects($this->once()) ->method('canChangeAvatar') ->with($this->equalTo('foo')) @@ -170,8 +168,7 @@ class User extends \Test\TestCase { /** * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend */ - require_once 'avataruserdummy.php'; - $backend = $this->getMock('Avatar_User_Dummy'); + $backend = $this->getMock('Test\User\AvatarUserDummy'); $backend->expects($this->never()) ->method('canChangeAvatar'); diff --git a/tests/lib/user.php b/tests/lib/UserTest.php index dc5551d1cad..456e864ab75 100644 --- a/tests/lib/user.php +++ b/tests/lib/UserTest.php @@ -16,7 +16,7 @@ namespace Test; * * @package Test */ -class User extends TestCase { +class UserTest extends TestCase { /** * @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend */ diff --git a/tests/lib/util/group/dummy.php b/tests/lib/Util/Group/Dummy.php index 8f06316ca03..8f06316ca03 100644 --- a/tests/lib/util/group/dummy.php +++ b/tests/lib/Util/Group/Dummy.php diff --git a/tests/lib/util/user/dummy.php b/tests/lib/Util/User/Dummy.php index ea47f5d7d15..ea47f5d7d15 100644 --- a/tests/lib/util/user/dummy.php +++ b/tests/lib/Util/User/Dummy.php diff --git a/tests/lib/utilcheckserver.php b/tests/lib/UtilCheckServerTest.php index 94e7fd2f779..b864af6888a 100644 --- a/tests/lib/utilcheckserver.php +++ b/tests/lib/UtilCheckServerTest.php @@ -6,18 +6,20 @@ * See the COPYING-README file. */ +namespace Test; + /** * Tests for server check functions * * @group DB */ -class Test_Util_CheckServer extends \Test\TestCase { +class UtilCheckServerTest extends \Test\TestCase { private $datadir; /** * @param array $systemOptions - * @return \OCP\IConfig | PHPUnit_Framework_MockObject_MockObject + * @return \OCP\IConfig | \PHPUnit_Framework_MockObject_MockObject */ protected function getConfig($systemOptions) { $systemOptions['datadirectory'] = $this->datadir; diff --git a/tests/lib/util.php b/tests/lib/UtilTest.php index 4d788353881..7da7db0291c 100644 --- a/tests/lib/util.php +++ b/tests/lib/UtilTest.php @@ -1,12 +1,16 @@ <?php - /** * Copyright (c) 2012 Lukas Reschke <lukas@statuscode.ch> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ -class Test_Util extends \Test\TestCase { + +namespace Test; + +use OC_Util; + +class UtilTest extends \Test\TestCase { public function testGetVersion() { $version = \OCP\Util::getVersion(); $this->assertTrue(is_array($version)); @@ -46,7 +50,7 @@ class Test_Util extends \Test\TestCase { } /** - * @expectedException Exception + * @expectedException \Exception */ function testFormatDateWithInvalidTZ() { OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr'); @@ -283,7 +287,7 @@ class Test_Util extends \Test\TestCase { * @dataProvider defaultAppsProvider */ function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) { - $oldDefaultApps = \OCP\Config::getSystemValue('core', 'defaultapp', ''); + $oldDefaultApps = \OCP\Config::getSystemValue('defaultapp', ''); // CLI is doing messy stuff with the webroot, so need to work it around $oldWebRoot = \OC::$WEBROOT; \OC::$WEBROOT = ''; diff --git a/version.php b/version.php index d9e1ca1df1c..a4f1c4dbce0 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ // We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades // between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel // when updating major/minor version number. -$OC_Version = array(9, 1, 0, 2); +$OC_Version = array(9, 1, 0, 3); // The human readable string $OC_VersionString = '9.1.0 pre alpha'; |