diff options
75 files changed, 255 insertions, 82 deletions
diff --git a/apps/comments/l10n/it.js b/apps/comments/l10n/it.js index 112af1bedf5..27844003c03 100644 --- a/apps/comments/l10n/it.js +++ b/apps/comments/l10n/it.js @@ -3,7 +3,7 @@ OC.L10N.register( { "Type in a new comment..." : "Digita un nuovo commento...", "Delete comment" : "Elimina commento", - "Post" : "Commento", + "Post" : "Post", "Cancel" : "Annulla", "Edit comment" : "Modifica commento", "[Deleted user]" : "[Utente eliminato]", diff --git a/apps/comments/l10n/it.json b/apps/comments/l10n/it.json index e46f1b8b40a..73605cd6f03 100644 --- a/apps/comments/l10n/it.json +++ b/apps/comments/l10n/it.json @@ -1,7 +1,7 @@ { "translations": { "Type in a new comment..." : "Digita un nuovo commento...", "Delete comment" : "Elimina commento", - "Post" : "Commento", + "Post" : "Post", "Cancel" : "Annulla", "Edit comment" : "Modifica commento", "[Deleted user]" : "[Utente eliminato]", diff --git a/apps/federatedfilesharing/appinfo/app.php b/apps/federatedfilesharing/appinfo/app.php index 23af62037a3..4666d343f7e 100644 --- a/apps/federatedfilesharing/appinfo/app.php +++ b/apps/federatedfilesharing/appinfo/app.php @@ -19,7 +19,5 @@ * */ -namespace OCA\FederatedFileSharing\AppInfo; - -$app = new Application('federatedfilesharing'); +$app = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing'); $app->registerSettings(); diff --git a/apps/federatedfilesharing/lib/addresshandler.php b/apps/federatedfilesharing/lib/AddressHandler.php index 92768f11b95..92768f11b95 100644 --- a/apps/federatedfilesharing/lib/addresshandler.php +++ b/apps/federatedfilesharing/lib/AddressHandler.php diff --git a/apps/federatedfilesharing/appinfo/application.php b/apps/federatedfilesharing/lib/AppInfo/Application.php index 5a213aec8e2..5a213aec8e2 100644 --- a/apps/federatedfilesharing/appinfo/application.php +++ b/apps/federatedfilesharing/lib/AppInfo/Application.php diff --git a/apps/federatedfilesharing/backgroundjob/unshare.php b/apps/federatedfilesharing/lib/BackgroundJob/UnShare.php index b056db4eac7..b056db4eac7 100644 --- a/apps/federatedfilesharing/backgroundjob/unshare.php +++ b/apps/federatedfilesharing/lib/BackgroundJob/UnShare.php diff --git a/apps/federatedfilesharing/lib/discoverymanager.php b/apps/federatedfilesharing/lib/DiscoveryManager.php index 51ea71195fa..51ea71195fa 100644 --- a/apps/federatedfilesharing/lib/discoverymanager.php +++ b/apps/federatedfilesharing/lib/DiscoveryManager.php diff --git a/apps/federatedfilesharing/lib/federatedshareprovider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php index d014a6219a3..d014a6219a3 100644 --- a/apps/federatedfilesharing/lib/federatedshareprovider.php +++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php diff --git a/apps/federatedfilesharing/lib/notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 9cdc7760361..9cdc7760361 100644 --- a/apps/federatedfilesharing/lib/notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php diff --git a/apps/federatedfilesharing/lib/tokenhandler.php b/apps/federatedfilesharing/lib/TokenHandler.php index ec5f73127d6..ec5f73127d6 100644 --- a/apps/federatedfilesharing/lib/tokenhandler.php +++ b/apps/federatedfilesharing/lib/TokenHandler.php diff --git a/apps/federatedfilesharing/tests/addresshandlertest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index 9f7d8c49b4d..9f7d8c49b4d 100644 --- a/apps/federatedfilesharing/tests/addresshandlertest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php diff --git a/apps/federatedfilesharing/tests/federatedshareprovidertest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 1fbae90a46f..1fbae90a46f 100644 --- a/apps/federatedfilesharing/tests/federatedshareprovidertest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php diff --git a/apps/federatedfilesharing/tests/notificationstest.php b/apps/federatedfilesharing/tests/NotificationsTest.php index bde69a82bad..bde69a82bad 100644 --- a/apps/federatedfilesharing/tests/notificationstest.php +++ b/apps/federatedfilesharing/tests/NotificationsTest.php diff --git a/apps/federatedfilesharing/tests/tokenhandlertest.php b/apps/federatedfilesharing/tests/TokenHandlerTest.php index 490c0d95d7b..490c0d95d7b 100644 --- a/apps/federatedfilesharing/tests/tokenhandlertest.php +++ b/apps/federatedfilesharing/tests/TokenHandlerTest.php diff --git a/apps/files/l10n/lv.js b/apps/files/l10n/lv.js index 5efe5d6f2bd..fe8e21cbbcb 100644 --- a/apps/files/l10n/lv.js +++ b/apps/files/l10n/lv.js @@ -41,6 +41,8 @@ OC.L10N.register( "Select" : "Norādīt", "Pending" : "Gaida savu kārtu", "Unable to determine date" : "Neizdevās noteikt datumu", + "This operation is forbidden" : "Šī darbība ir aizliegta", + "This directory is unavailable, please check the logs or contact the administrator" : "Šis direktorijs nav pieejams, lūdzu pārbaudiet žurnālus vai sazinieties ar administratoru", "No entries in this folder match '{filter}'" : "Šajā mapē nekas nav atrasts, meklējot pēc '{filter}'", "Name" : "Nosaukums", "Size" : "Izmērs", diff --git a/apps/files/l10n/lv.json b/apps/files/l10n/lv.json index 3148589deb4..203491a591b 100644 --- a/apps/files/l10n/lv.json +++ b/apps/files/l10n/lv.json @@ -39,6 +39,8 @@ "Select" : "Norādīt", "Pending" : "Gaida savu kārtu", "Unable to determine date" : "Neizdevās noteikt datumu", + "This operation is forbidden" : "Šī darbība ir aizliegta", + "This directory is unavailable, please check the logs or contact the administrator" : "Šis direktorijs nav pieejams, lūdzu pārbaudiet žurnālus vai sazinieties ar administratoru", "No entries in this folder match '{filter}'" : "Šajā mapē nekas nav atrasts, meklējot pēc '{filter}'", "Name" : "Nosaukums", "Size" : "Izmērs", diff --git a/apps/files/l10n/ro.js b/apps/files/l10n/ro.js index a0ecbc06e27..fc27355e58f 100644 --- a/apps/files/l10n/ro.js +++ b/apps/files/l10n/ro.js @@ -30,6 +30,7 @@ OC.L10N.register( "Not enough free space, you are uploading {size1} but only {size2} is left" : "Spațiu liber insuficient, încărcați {size1} însă doar {size2} disponibil rămas", "Could not get result from server." : "Nu se poate obține rezultatul de la server.", "Uploading..." : "Încărcare", + "..." : "...", "File upload is in progress. Leaving the page now will cancel the upload." : "Fișierul este în curs de încărcare. Părăsirea paginii va întrerupe încărcarea.", "Actions" : "Acțiuni", "Download" : "Descarcă", diff --git a/apps/files/l10n/ro.json b/apps/files/l10n/ro.json index 6adf4eaac55..8187dad94a1 100644 --- a/apps/files/l10n/ro.json +++ b/apps/files/l10n/ro.json @@ -28,6 +28,7 @@ "Not enough free space, you are uploading {size1} but only {size2} is left" : "Spațiu liber insuficient, încărcați {size1} însă doar {size2} disponibil rămas", "Could not get result from server." : "Nu se poate obține rezultatul de la server.", "Uploading..." : "Încărcare", + "..." : "...", "File upload is in progress. Leaving the page now will cancel the upload." : "Fișierul este în curs de încărcare. Părăsirea paginii va întrerupe încărcarea.", "Actions" : "Acțiuni", "Download" : "Descarcă", diff --git a/apps/files_external/l10n/de.js b/apps/files_external/l10n/de.js index 003a2bd56b9..364a87b6a41 100644 --- a/apps/files_external/l10n/de.js +++ b/apps/files_external/l10n/de.js @@ -55,7 +55,7 @@ OC.L10N.register( "OAuth1" : "OAuth1", "App key" : "App-Schlüssel", "App secret" : "Geheime Zeichenkette der App", - "OAuth2" : "OAutch2", + "OAuth2" : "OAuth2", "Client ID" : "Client-ID", "Client secret" : "Geheime Zeichenkette des Client", "OpenStack" : "OpenStack", diff --git a/apps/files_external/l10n/de.json b/apps/files_external/l10n/de.json index a18205519fb..3ddc417e3b5 100644 --- a/apps/files_external/l10n/de.json +++ b/apps/files_external/l10n/de.json @@ -53,7 +53,7 @@ "OAuth1" : "OAuth1", "App key" : "App-Schlüssel", "App secret" : "Geheime Zeichenkette der App", - "OAuth2" : "OAutch2", + "OAuth2" : "OAuth2", "Client ID" : "Client-ID", "Client secret" : "Geheime Zeichenkette des Client", "OpenStack" : "OpenStack", diff --git a/apps/files_sharing/l10n/lv.js b/apps/files_sharing/l10n/lv.js index abc9d4ce301..41fcffb93ff 100644 --- a/apps/files_sharing/l10n/lv.js +++ b/apps/files_sharing/l10n/lv.js @@ -7,6 +7,22 @@ OC.L10N.register( "Could not authenticate to remote share, password might be wrong" : "Nesanāca autentificēties pie attālinātās koplietotnes, parole varētu būt nepareiza", "Storage not valid" : "Glabātuve nav derīga", "Couldn't add remote share" : "Nevarēja pievienot attālināto koplietotni", + "Share API is disabled" : "Koplietošanas API ir atslēgta", + "Wrong share ID, share doesn't exist" : "Nepareizs koplietošanas ID, koplietotne neeksistē", + "Could not delete share" : "Neizdevās dzēst koplietotni", + "Please specify a file or folder path" : "Lūdzu norādiet datnes vai mapes ceļu", + "Wrong path, file/folder doesn't exist" : "Nepareizs ceļš, datne/mape neeksistē", + "Please specify a valid user" : "Lūdzu norādiet derīgu lietotāju", + "Group sharing is disabled by the administrator" : "Administrators grupas koplietošanu ir atslēdzis", + "Please specify a valid group" : "Lūdzu norādiet derīgu grupu", + "Public link sharing is disabled by the administrator" : "Administrators publisku saites koplietošanu ir atslēdzis", + "Public upload disabled by the administrator" : "Administrators publisku augšupielādi ir atslēdzis", + "Public upload is only possible for publicly shared folders" : "Publiska augšupielāde iespējama tikai publiski koplietotām mapēm", + "Invalid date, date format must be YYYY-MM-DD" : "Nepareizs datums, datumam jābūt YYYY-MM-DD formātā", + "Unknown share type" : "Nezināms koplietošanas tips", + "Could not lock path" : "Nevarēja bloķēt ceļu", + "Can't change permissions for public share links" : "Publiskai koplietošanas saitei nevar mainīt tiesības", + "Cannot increase permissions" : "Nevar palielināt tiesības", "Shared with you" : "Koplietots ar tevi", "Shared with others" : "Koplietots ar citiem", "Shared by link" : "Koplietots ar saiti", @@ -21,6 +37,7 @@ OC.L10N.register( "Remote share password" : "Attālinātās koplietotnes parole", "Cancel" : "Atcelt", "Add remote share" : "Pievienot attālināto koplietotni", + "You can upload into this folder" : "Jūs variet augšuplādēt šajā mapē", "No ownCloud installation (7 or higher) found at {remote}" : "Nav atrasta neviena ownCloud (7. vai augstāka) instalācija {remote}", "Invalid ownCloud url" : "Nederīga ownCloud saite", "Shared by" : "Dalījās", @@ -28,6 +45,7 @@ OC.L10N.register( "A file or folder has been <strong>shared</strong>" : "<strong>Koplietota</strong> fails vai mape", "A file or folder was shared from <strong>another server</strong>" : "Fails vai mape tika koplietota no <strong>cita servera</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Publiski koplietots fails vai mape tika <strong>lejupielādēts</strong>", + "You received a new remote share %2$s from %1$s" : "Jūs saņēmāt jaunu attālinātu koplietotni %2$s no %1$s", "You received a new remote share from %s" : "Saņēmāt jaunu attālinātu koplietotni no %s", "%1$s accepted remote share %2$s" : "%1$s apstiprināja attālināto koplietotni %2$s", "%1$s declined remote share %2$s" : "%1$s noraidīja attālināto koplietotni %2$s", @@ -35,7 +53,13 @@ OC.L10N.register( "Public shared folder %1$s was downloaded" : "Publiski koplietota mape %1$s tika lejupielādēta", "Public shared file %1$s was downloaded" : "Publiski koplietots fails %1$s tika lejupielādēts", "You shared %1$s with %2$s" : "Tu koplietoji %1$s ar %2$s", + "%2$s shared %1$s with %3$s" : "%2$s koplietots %1$s ar %3$s", + "You removed the share of %2$s for %1$s" : "Tu noņēmi koplietošanu no %2$s priekš %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s noņēma koplietošanu no %3$s priekš %1$s", "You shared %1$s with group %2$s" : "Tu koplietoji %1$s ar grupu %2$s", + "%2$s shared %1$s with group %3$s" : "%2$s koplietots %1$s ar grupu %3$s", + "You removed the share of group %2$s for %1$s" : "Tu noņēmi koplietošanu no grupas %2$s priekš %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s noņēma koplietošanu no gruapas %3$s priekš %1$s", "You shared %1$s via link" : "Tu koplietoji %1$s , izmantojot saiti", "%2$s shared %1$s with you" : "%2$s koplietoja %1$s ar tevi", "Shares" : "Koplietotie", diff --git a/apps/files_sharing/l10n/lv.json b/apps/files_sharing/l10n/lv.json index 5ea0c87b814..c4557eed842 100644 --- a/apps/files_sharing/l10n/lv.json +++ b/apps/files_sharing/l10n/lv.json @@ -5,6 +5,22 @@ "Could not authenticate to remote share, password might be wrong" : "Nesanāca autentificēties pie attālinātās koplietotnes, parole varētu būt nepareiza", "Storage not valid" : "Glabātuve nav derīga", "Couldn't add remote share" : "Nevarēja pievienot attālināto koplietotni", + "Share API is disabled" : "Koplietošanas API ir atslēgta", + "Wrong share ID, share doesn't exist" : "Nepareizs koplietošanas ID, koplietotne neeksistē", + "Could not delete share" : "Neizdevās dzēst koplietotni", + "Please specify a file or folder path" : "Lūdzu norādiet datnes vai mapes ceļu", + "Wrong path, file/folder doesn't exist" : "Nepareizs ceļš, datne/mape neeksistē", + "Please specify a valid user" : "Lūdzu norādiet derīgu lietotāju", + "Group sharing is disabled by the administrator" : "Administrators grupas koplietošanu ir atslēdzis", + "Please specify a valid group" : "Lūdzu norādiet derīgu grupu", + "Public link sharing is disabled by the administrator" : "Administrators publisku saites koplietošanu ir atslēdzis", + "Public upload disabled by the administrator" : "Administrators publisku augšupielādi ir atslēdzis", + "Public upload is only possible for publicly shared folders" : "Publiska augšupielāde iespējama tikai publiski koplietotām mapēm", + "Invalid date, date format must be YYYY-MM-DD" : "Nepareizs datums, datumam jābūt YYYY-MM-DD formātā", + "Unknown share type" : "Nezināms koplietošanas tips", + "Could not lock path" : "Nevarēja bloķēt ceļu", + "Can't change permissions for public share links" : "Publiskai koplietošanas saitei nevar mainīt tiesības", + "Cannot increase permissions" : "Nevar palielināt tiesības", "Shared with you" : "Koplietots ar tevi", "Shared with others" : "Koplietots ar citiem", "Shared by link" : "Koplietots ar saiti", @@ -19,6 +35,7 @@ "Remote share password" : "Attālinātās koplietotnes parole", "Cancel" : "Atcelt", "Add remote share" : "Pievienot attālināto koplietotni", + "You can upload into this folder" : "Jūs variet augšuplādēt šajā mapē", "No ownCloud installation (7 or higher) found at {remote}" : "Nav atrasta neviena ownCloud (7. vai augstāka) instalācija {remote}", "Invalid ownCloud url" : "Nederīga ownCloud saite", "Shared by" : "Dalījās", @@ -26,6 +43,7 @@ "A file or folder has been <strong>shared</strong>" : "<strong>Koplietota</strong> fails vai mape", "A file or folder was shared from <strong>another server</strong>" : "Fails vai mape tika koplietota no <strong>cita servera</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Publiski koplietots fails vai mape tika <strong>lejupielādēts</strong>", + "You received a new remote share %2$s from %1$s" : "Jūs saņēmāt jaunu attālinātu koplietotni %2$s no %1$s", "You received a new remote share from %s" : "Saņēmāt jaunu attālinātu koplietotni no %s", "%1$s accepted remote share %2$s" : "%1$s apstiprināja attālināto koplietotni %2$s", "%1$s declined remote share %2$s" : "%1$s noraidīja attālināto koplietotni %2$s", @@ -33,7 +51,13 @@ "Public shared folder %1$s was downloaded" : "Publiski koplietota mape %1$s tika lejupielādēta", "Public shared file %1$s was downloaded" : "Publiski koplietots fails %1$s tika lejupielādēts", "You shared %1$s with %2$s" : "Tu koplietoji %1$s ar %2$s", + "%2$s shared %1$s with %3$s" : "%2$s koplietots %1$s ar %3$s", + "You removed the share of %2$s for %1$s" : "Tu noņēmi koplietošanu no %2$s priekš %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s noņēma koplietošanu no %3$s priekš %1$s", "You shared %1$s with group %2$s" : "Tu koplietoji %1$s ar grupu %2$s", + "%2$s shared %1$s with group %3$s" : "%2$s koplietots %1$s ar grupu %3$s", + "You removed the share of group %2$s for %1$s" : "Tu noņēmi koplietošanu no grupas %2$s priekš %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s noņēma koplietošanu no gruapas %3$s priekš %1$s", "You shared %1$s via link" : "Tu koplietoji %1$s , izmantojot saiti", "%2$s shared %1$s with you" : "%2$s koplietoja %1$s ar tevi", "Shares" : "Koplietotie", diff --git a/apps/files_trashbin/l10n/lv.js b/apps/files_trashbin/l10n/lv.js index 5629ba6af06..75b4eb9e9aa 100644 --- a/apps/files_trashbin/l10n/lv.js +++ b/apps/files_trashbin/l10n/lv.js @@ -8,6 +8,8 @@ OC.L10N.register( "Delete" : "Dzēst", "Delete permanently" : "Dzēst pavisam", "Error" : "Kļūda", + "This operation is forbidden" : "Šī darbība ir aizliegta", + "This directory is unavailable, please check the logs or contact the administrator" : "Šis direktorijs nav pieejams, lūdzu pārbaudiet žurnālus vai sazinieties ar administratoru", "restored" : "atjaunots", "No deleted files" : "Nav dzēstu failu", "You will be able to recover deleted files from here" : "No šejienes būs iespējams atgūt dzēstos failus", diff --git a/apps/files_trashbin/l10n/lv.json b/apps/files_trashbin/l10n/lv.json index 4cf941bd21e..22f0ac494f4 100644 --- a/apps/files_trashbin/l10n/lv.json +++ b/apps/files_trashbin/l10n/lv.json @@ -6,6 +6,8 @@ "Delete" : "Dzēst", "Delete permanently" : "Dzēst pavisam", "Error" : "Kļūda", + "This operation is forbidden" : "Šī darbība ir aizliegta", + "This directory is unavailable, please check the logs or contact the administrator" : "Šis direktorijs nav pieejams, lūdzu pārbaudiet žurnālus vai sazinieties ar administratoru", "restored" : "atjaunots", "No deleted files" : "Nav dzēstu failu", "You will be able to recover deleted files from here" : "No šejienes būs iespējams atgūt dzēstos failus", diff --git a/core/templates/filetemplates/template.odp b/core/templates/filetemplates/template.odp Binary files differindex f6371165b82..3800a491fa6 100644 --- a/core/templates/filetemplates/template.odp +++ b/core/templates/filetemplates/template.odp diff --git a/core/templates/filetemplates/template.ods b/core/templates/filetemplates/template.ods Binary files differindex e5e8b0bed8b..998ea21bd73 100644 --- a/core/templates/filetemplates/template.ods +++ b/core/templates/filetemplates/template.ods diff --git a/core/templates/filetemplates/template.odt b/core/templates/filetemplates/template.odt Binary files differindex cbb49a1cf3e..4717040fd89 100644 --- a/core/templates/filetemplates/template.odt +++ b/core/templates/filetemplates/template.odt 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/Cache/File.php b/lib/private/Cache/File.php index 989e05275b7..38f88959bd7 100644 --- a/lib/private/Cache/File.php +++ b/lib/private/Cache/File.php @@ -172,7 +172,9 @@ class File implements ICache { public function gc() { $storage = $this->getStorage(); if ($storage and $storage->is_dir('/')) { - $now = time(); + // extra hour safety, in case of stray part chunks that take longer to write, + // because touch() is only called after the chunk was finished + $now = time() - 3600; $dh = $storage->opendir('/'); if (!is_resource($dh)) { return null; diff --git a/lib/public/l10n/ifactory.php b/lib/public/L10N/IFactory.php index 264c9719639..264c9719639 100644 --- a/lib/public/l10n/ifactory.php +++ b/lib/public/L10N/IFactory.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/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/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/RequestTest.php b/tests/lib/appframework/http/RequestTest.php index 3f1d09c2a93..5b960908991 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; 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/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/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/cache/cappedmemorycache.php b/tests/lib/cache/cappedmemorycache.php index a8fb273b80a..c9c74de72db 100644 --- a/tests/lib/cache/cappedmemorycache.php +++ b/tests/lib/cache/cappedmemorycache.php @@ -29,7 +29,7 @@ namespace Test\Cache; * * @package Test\Cache */ -class CappedMemoryCache extends \Test_Cache { +class CappedMemoryCache 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/filecache.php index 92b784bf8ea..a85b12671f3 100644 --- a/tests/lib/cache/file.php +++ b/tests/lib/cache/filecache.php @@ -29,7 +29,7 @@ namespace Test\Cache; * * @package Test\Cache */ -class FileCache extends \Test_Cache { +class FileCache 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/command/background.php b/tests/lib/command/backgroundjobs.php index 7e992480530..7e992480530 100644 --- a/tests/lib/command/background.php +++ b/tests/lib/command/backgroundjobs.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/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/db/mysqlmigration.php b/tests/lib/db/mysqlmigration.php index 51e8801dc3b..42ed6ba7251 100644 --- a/tests/lib/db/mysqlmigration.php +++ b/tests/lib/db/mysqlmigration.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 MySqlMigration extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ private $connection; diff --git a/tests/lib/db/sqlitemigration.php b/tests/lib/db/sqlitemigration.php index f23f4d4ee86..176b947e310 100644 --- a/tests/lib/db/sqlitemigration.php +++ b/tests/lib/db/sqlitemigration.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 SqliteMigration extends \Test\TestCase { /** @var \Doctrine\DBAL\Connection */ private $connection; 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/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; */ |