diff options
34 files changed, 148 insertions, 8 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/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'; |