Merge branch 'master' of github.com:owncloud/core into vcategories_db

remotes/origin/stable5
Thomas Tanghus 13 years ago
commit 82e010c51c
  1. 8
      apps/files/index.php
  2. 2
      apps/files/templates/index.php
  3. 6
      apps/files_sharing/appinfo/update.php
  4. 6
      apps/files_sharing/lib/share/file.php
  5. 2
      apps/files_sharing/lib/share/folder.php
  6. 8
      apps/files_sharing/lib/sharedstorage.php
  7. 2
      apps/files_sharing/public.php
  8. 30
      apps/user_ldap/l10n/nl.php
  9. 3
      apps/user_webdavauth/l10n/pt_BR.php
  10. 12
      l10n/fi_FI/settings.po
  11. 9
      l10n/fr/settings.po
  12. 7
      l10n/fr/user_webdavauth.po
  13. 65
      l10n/nl/user_ldap.po
  14. 9
      l10n/pt_BR/settings.po
  15. 9
      l10n/pt_BR/user_webdavauth.po
  16. 8
      l10n/sv/settings.po
  17. 2
      l10n/templates/core.pot
  18. 2
      l10n/templates/files.pot
  19. 2
      l10n/templates/files_encryption.pot
  20. 2
      l10n/templates/files_external.pot
  21. 2
      l10n/templates/files_sharing.pot
  22. 2
      l10n/templates/files_versions.pot
  23. 2
      l10n/templates/lib.pot
  24. 2
      l10n/templates/settings.pot
  25. 2
      l10n/templates/user_ldap.pot
  26. 2
      l10n/templates/user_webdavauth.pot
  27. 19
      l10n/zh_TW/settings.po
  28. 6
      lib/base.php
  29. 8
      lib/files.php
  30. 38
      lib/public/constants.php
  31. 14
      lib/public/share.php
  32. 6
      settings/l10n/fi_FI.php
  33. 1
      settings/l10n/fr.php
  34. 1
      settings/l10n/pt_BR.php
  35. 1
      settings/l10n/sv.php
  36. 7
      settings/l10n/zh_TW.php
  37. 146
      tests/lib/share/share.php

@ -89,15 +89,15 @@ $freeSpace=OC_Filesystem::free_space($dir);
$freeSpace=max($freeSpace, 0); $freeSpace=max($freeSpace, 0);
$maxUploadFilesize = min($maxUploadFilesize, $freeSpace); $maxUploadFilesize = min($maxUploadFilesize, $freeSpace);
$permissions = OCP\Share::PERMISSION_READ; $permissions = OCP\PERMISSION_READ;
if (OC_Filesystem::isUpdatable($dir.'/')) { if (OC_Filesystem::isUpdatable($dir.'/')) {
$permissions |= OCP\Share::PERMISSION_UPDATE; $permissions |= OCP\PERMISSION_UPDATE;
} }
if (OC_Filesystem::isDeletable($dir.'/')) { if (OC_Filesystem::isDeletable($dir.'/')) {
$permissions |= OCP\Share::PERMISSION_DELETE; $permissions |= OCP\PERMISSION_DELETE;
} }
if (OC_Filesystem::isSharable($dir.'/')) { if (OC_Filesystem::isSharable($dir.'/')) {
$permissions |= OCP\Share::PERMISSION_SHARE; $permissions |= OCP\PERMISSION_SHARE;
} }
$tmpl = new OCP\Template( 'files', 'index', 'user' ); $tmpl = new OCP\Template( 'files', 'index', 'user' );

@ -58,7 +58,7 @@
<th id="headerSize"><?php echo $l->t( 'Size' ); ?></th> <th id="headerSize"><?php echo $l->t( 'Size' ); ?></th>
<th id="headerDate"> <th id="headerDate">
<span id="modified"><?php echo $l->t( 'Modified' ); ?></span> <span id="modified"><?php echo $l->t( 'Modified' ); ?></span>
<?php if ($_['permissions'] & OCP\Share::PERMISSION_DELETE): ?> <?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder --> <!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
<?php if ($_['dir'] == '/Shared'): ?> <?php if ($_['dir'] == '/Shared'): ?>
<span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Unshare')?> <img class="svg" alt="<?php echo $l->t('Unshare')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span> <span class="selectedActions"><a href="" class="delete"><?php echo $l->t('Unshare')?> <img class="svg" alt="<?php echo $l->t('Unshare')?>" src="<?php echo OCP\image_path("core", "actions/delete.svg"); ?>" /></a></span>

@ -19,11 +19,11 @@ if (version_compare($installedVersion, '0.3', '<')) {
$itemType = 'file'; $itemType = 'file';
} }
if ($row['permissions'] == 0) { if ($row['permissions'] == 0) {
$permissions = OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE; $permissions = OCP\PERMISSION_READ | OCP\PERMISSION_SHARE;
} else { } else {
$permissions = OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_SHARE; $permissions = OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE | OCP\PERMISSION_SHARE;
if ($itemType == 'folder') { if ($itemType == 'folder') {
$permissions |= OCP\Share::PERMISSION_CREATE; $permissions |= OCP\PERMISSION_CREATE;
} }
} }
$pos = strrpos($row['uid_shared_with'], '@'); $pos = strrpos($row['uid_shared_with'], '@');

@ -97,10 +97,10 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
$file['permissions'] = $item['permissions']; $file['permissions'] = $item['permissions'];
if ($file['type'] == 'file') { if ($file['type'] == 'file') {
// Remove Create permission if type is file // Remove Create permission if type is file
$file['permissions'] &= ~OCP\Share::PERMISSION_CREATE; $file['permissions'] &= ~OCP\PERMISSION_CREATE;
} }
// NOTE: Temporary fix to allow unsharing of files in root of Shared directory // NOTE: Temporary fix to allow unsharing of files in root of Shared directory
$file['permissions'] |= OCP\Share::PERMISSION_DELETE; $file['permissions'] |= OCP\PERMISSION_DELETE;
$files[] = $file; $files[] = $file;
} }
return $files; return $files;
@ -113,7 +113,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
} }
$size += $item['size']; $size += $item['size'];
} }
return array(0 => array('id' => -1, 'name' => 'Shared', 'mtime' => $mtime, 'mimetype' => 'httpd/unix-directory', 'size' => $size, 'writable' => false, 'type' => 'dir', 'directory' => '', 'permissions' => OCP\Share::PERMISSION_READ)); return array(0 => array('id' => -1, 'name' => 'Shared', 'mtime' => $mtime, 'mimetype' => 'httpd/unix-directory', 'size' => $size, 'writable' => false, 'type' => 'dir', 'directory' => '', 'permissions' => OCP\PERMISSION_READ));
} else if ($format == self::FORMAT_OPENDIR) { } else if ($format == self::FORMAT_OPENDIR) {
$files = array(); $files = array();
foreach ($items as $item) { foreach ($items as $item) {

@ -41,7 +41,7 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share
$file['permissions'] = $folder['permissions']; $file['permissions'] = $folder['permissions'];
if ($file['type'] == 'file') { if ($file['type'] == 'file') {
// Remove Create permission if type is file // Remove Create permission if type is file
$file['permissions'] &= ~OCP\Share::PERMISSION_CREATE; $file['permissions'] &= ~OCP\PERMISSION_CREATE;
} }
} }
return $files; return $files;

@ -201,7 +201,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($path == '') { if ($path == '') {
return false; return false;
} }
return ($this->getPermissions($path) & OCP\Share::PERMISSION_CREATE); return ($this->getPermissions($path) & OCP\PERMISSION_CREATE);
} }
public function isReadable($path) { public function isReadable($path) {
@ -212,21 +212,21 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
if ($path == '') { if ($path == '') {
return false; return false;
} }
return ($this->getPermissions($path) & OCP\Share::PERMISSION_UPDATE); return ($this->getPermissions($path) & OCP\PERMISSION_UPDATE);
} }
public function isDeletable($path) { public function isDeletable($path) {
if ($path == '') { if ($path == '') {
return true; return true;
} }
return ($this->getPermissions($path) & OCP\Share::PERMISSION_DELETE); return ($this->getPermissions($path) & OCP\PERMISSION_DELETE);
} }
public function isSharable($path) { public function isSharable($path) {
if ($path == '') { if ($path == '') {
return false; return false;
} }
return ($this->getPermissions($path) & OCP\Share::PERMISSION_SHARE); return ($this->getPermissions($path) & OCP\PERMISSION_SHARE);
} }
public function file_exists($path) { public function file_exists($path) {

@ -147,7 +147,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
if ($i['directory'] == '/') { if ($i['directory'] == '/') {
$i['directory'] = ''; $i['directory'] = '';
} }
$i['permissions'] = OCP\Share::PERMISSION_READ; $i['permissions'] = OCP\PERMISSION_READ;
$files[] = $i; $files[] = $i;
} }
// Make breadcrumb // Make breadcrumb

@ -0,0 +1,30 @@
<?php $TRANSLATIONS = array(
"Host" => "Host",
"You can omit the protocol, except you require SSL. Then start with ldaps://" => "Je kunt het protocol weglaten, tenzij je SSL vereist. Start in dat geval met ldaps://",
"Base DN" => "Basis DN",
"User DN" => "Gebruikers DN",
"Password" => "Wachtwoord",
"For anonymous access, leave DN and Password empty." => "Voor anonieme toegang, laat de DN en het wachtwoord leeg.",
"User Login Filter" => "Gebruikers Login Filter",
"Defines the filter to apply, when login is attempted. %%uid replaces the username in the login action." => "Definiëerd de toe te passen filter indien er geprobeerd wordt in te loggen. %%uid vervangt de gebruikersnaam in de login actie.",
"User List Filter" => "Gebruikers Lijst Filter",
"Defines the filter to apply, when retrieving users." => "Definiëerd de toe te passen filter voor het ophalen van gebruikers.",
"Group Filter" => "Groep Filter",
"Defines the filter to apply, when retrieving groups." => "Definiëerd de toe te passen filter voor het ophalen van groepen.",
"Port" => "Poort",
"Base User Tree" => "Basis Gebruikers Structuur",
"Base Group Tree" => "Basis Groupen Structuur",
"Group-Member association" => "Groepslid associatie",
"Use TLS" => "Gebruik TLS",
"Do not use it for SSL connections, it will fail." => "Gebruik niet voor SSL connecties, deze mislukken.",
"Turn off SSL certificate validation." => "Schakel SSL certificaat validatie uit.",
"Not recommended, use for testing only." => "Niet aangeraden, gebruik alleen voor test doeleinden.",
"User Display Name Field" => "Gebruikers Schermnaam Veld",
"The LDAP attribute to use to generate the user`s ownCloud name." => "Het te gebruiken LDAP attribuut voor het genereren van de ownCloud naam voor de gebruikers.",
"Group Display Name Field" => "Groep Schermnaam Veld",
"The LDAP attribute to use to generate the groups`s ownCloud name." => "Het te gebruiken LDAP attribuut voor het genereren van de ownCloud naam voor de groepen.",
"in bytes" => "in bytes",
"in seconds. A change empties the cache." => "in seconden. Een verandering maakt de cache leeg.",
"Leave empty for user name (default). Otherwise, specify an LDAP/AD attribute." => "Laat leeg voor de gebruikersnaam (standaard). Of, specificeer een LDAP/AD attribuut.",
"Help" => "Help"
);

@ -0,0 +1,3 @@
<?php $TRANSLATIONS = array(
"WebDAV URL: http://" => "URL do WebDAV: http://"
);

@ -10,9 +10,9 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-11-10 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-11-09 23:01+0000\n" "PO-Revision-Date: 2012-11-11 21:26+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n" "Last-Translator: Jiri Grönroos <jiri.gronroos@iki.fi>\n"
"Language-Team: Finnish (Finland) (http://www.transifex.com/projects/p/owncloud/language/fi_FI/)\n" "Language-Team: Finnish (Finland) (http://www.transifex.com/projects/p/owncloud/language/fi_FI/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -96,7 +96,7 @@ msgstr "_kielen_nimi_"
#: templates/apps.php:10 #: templates/apps.php:10
msgid "Add your App" msgid "Add your App"
msgstr "Lisää ohjelmasi" msgstr "Lisää sovelluksesi"
#: templates/apps.php:11 #: templates/apps.php:11
msgid "More Apps" msgid "More Apps"
@ -104,7 +104,7 @@ msgstr "Lisää sovelluksia"
#: templates/apps.php:27 #: templates/apps.php:27
msgid "Select an App" msgid "Select an App"
msgstr "Valitse ohjelma" msgstr "Valitse sovellus"
#: templates/apps.php:31 #: templates/apps.php:31
msgid "See application page at apps.owncloud.com" msgid "See application page at apps.owncloud.com"
@ -132,7 +132,7 @@ msgstr "Virhe yhdistettäessä tietokantaan."
#: templates/help.php:23 #: templates/help.php:23
msgid "Go there manually." msgid "Go there manually."
msgstr "Ohje löytyy sieltä." msgstr "Siirry sinne itse."
#: templates/help.php:31 #: templates/help.php:31
msgid "Answer" msgid "Answer"

@ -13,15 +13,16 @@
# <life_0n_mars@live.fr>, 2012. # <life_0n_mars@live.fr>, 2012.
# Nahir Mohamed <nahirmoha@gmail.com>, 2012. # Nahir Mohamed <nahirmoha@gmail.com>, 2012.
# <pierreamiel.giraud@gmail.com>, 2012. # <pierreamiel.giraud@gmail.com>, 2012.
# Robert Di Rosa <>, 2012.
# <rom1dep@gmail.com>, 2011, 2012. # <rom1dep@gmail.com>, 2011, 2012.
# Romain DEP. <rom1dep@gmail.com>, 2012. # Romain DEP. <rom1dep@gmail.com>, 2012.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-11-10 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-11-09 23:01+0000\n" "PO-Revision-Date: 2012-11-11 09:59+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n" "Last-Translator: Robert Di Rosa <>\n"
"Language-Team: French (http://www.transifex.com/projects/p/owncloud/language/fr/)\n" "Language-Team: French (http://www.transifex.com/projects/p/owncloud/language/fr/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -150,7 +151,7 @@ msgstr "Réponse"
#: templates/personal.php:8 #: templates/personal.php:8
#, php-format #, php-format
msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>" msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>"
msgstr "" msgstr "Vous avez utilisé <strong>%s</strong> des <strong>%s<strong> disponibles"
#: templates/personal.php:12 #: templates/personal.php:12
msgid "Desktop and Mobile Syncing Clients" msgid "Desktop and Mobile Syncing Clients"

@ -3,13 +3,14 @@
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the PACKAGE package.
# #
# Translators: # Translators:
# Robert Di Rosa <>, 2012.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-11-09 10:06+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-11-09 09:06+0000\n" "PO-Revision-Date: 2012-11-11 10:15+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: Robert Di Rosa <>\n"
"Language-Team: French (http://www.transifex.com/projects/p/owncloud/language/fr/)\n" "Language-Team: French (http://www.transifex.com/projects/p/owncloud/language/fr/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"

@ -3,32 +3,33 @@
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the PACKAGE package.
# #
# Translators: # Translators:
# <lenny@weijl.org>, 2012.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-08-29 02:01+0200\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-08-29 00:03+0000\n" "PO-Revision-Date: 2012-11-11 09:07+0000\n"
"Last-Translator: I Robot <thomas.mueller@tmit.eu>\n" "Last-Translator: Len <lenny@weijl.org>\n"
"Language-Team: Dutch (http://www.transifex.com/projects/p/owncloud/language/nl/)\n" "Language-Team: Dutch (http://www.transifex.com/projects/p/owncloud/language/nl/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Language: nl\n" "Language: nl\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: templates/settings.php:8 #: templates/settings.php:8
msgid "Host" msgid "Host"
msgstr "" msgstr "Host"
#: templates/settings.php:8 #: templates/settings.php:8
msgid "" msgid ""
"You can omit the protocol, except you require SSL. Then start with ldaps://" "You can omit the protocol, except you require SSL. Then start with ldaps://"
msgstr "" msgstr "Je kunt het protocol weglaten, tenzij je SSL vereist. Start in dat geval met ldaps://"
#: templates/settings.php:9 #: templates/settings.php:9
msgid "Base DN" msgid "Base DN"
msgstr "" msgstr "Basis DN"
#: templates/settings.php:9 #: templates/settings.php:9
msgid "You can specify Base DN for users and groups in the Advanced tab" msgid "You can specify Base DN for users and groups in the Advanced tab"
@ -36,7 +37,7 @@ msgstr ""
#: templates/settings.php:10 #: templates/settings.php:10
msgid "User DN" msgid "User DN"
msgstr "" msgstr "Gebruikers DN"
#: templates/settings.php:10 #: templates/settings.php:10
msgid "" msgid ""
@ -47,22 +48,22 @@ msgstr ""
#: templates/settings.php:11 #: templates/settings.php:11
msgid "Password" msgid "Password"
msgstr "" msgstr "Wachtwoord"
#: templates/settings.php:11 #: templates/settings.php:11
msgid "For anonymous access, leave DN and Password empty." msgid "For anonymous access, leave DN and Password empty."
msgstr "" msgstr "Voor anonieme toegang, laat de DN en het wachtwoord leeg."
#: templates/settings.php:12 #: templates/settings.php:12
msgid "User Login Filter" msgid "User Login Filter"
msgstr "" msgstr "Gebruikers Login Filter"
#: templates/settings.php:12 #: templates/settings.php:12
#, php-format #, php-format
msgid "" msgid ""
"Defines the filter to apply, when login is attempted. %%uid replaces the " "Defines the filter to apply, when login is attempted. %%uid replaces the "
"username in the login action." "username in the login action."
msgstr "" msgstr "Definiëerd de toe te passen filter indien er geprobeerd wordt in te loggen. %%uid vervangt de gebruikersnaam in de login actie."
#: templates/settings.php:12 #: templates/settings.php:12
#, php-format #, php-format
@ -71,11 +72,11 @@ msgstr ""
#: templates/settings.php:13 #: templates/settings.php:13
msgid "User List Filter" msgid "User List Filter"
msgstr "" msgstr "Gebruikers Lijst Filter"
#: templates/settings.php:13 #: templates/settings.php:13
msgid "Defines the filter to apply, when retrieving users." msgid "Defines the filter to apply, when retrieving users."
msgstr "" msgstr "Definiëerd de toe te passen filter voor het ophalen van gebruikers."
#: templates/settings.php:13 #: templates/settings.php:13
msgid "without any placeholder, e.g. \"objectClass=person\"." msgid "without any placeholder, e.g. \"objectClass=person\"."
@ -83,11 +84,11 @@ msgstr ""
#: templates/settings.php:14 #: templates/settings.php:14
msgid "Group Filter" msgid "Group Filter"
msgstr "" msgstr "Groep Filter"
#: templates/settings.php:14 #: templates/settings.php:14
msgid "Defines the filter to apply, when retrieving groups." msgid "Defines the filter to apply, when retrieving groups."
msgstr "" msgstr "Definiëerd de toe te passen filter voor het ophalen van groepen."
#: templates/settings.php:14 #: templates/settings.php:14
msgid "without any placeholder, e.g. \"objectClass=posixGroup\"." msgid "without any placeholder, e.g. \"objectClass=posixGroup\"."
@ -95,27 +96,27 @@ msgstr ""
#: templates/settings.php:17 #: templates/settings.php:17
msgid "Port" msgid "Port"
msgstr "" msgstr "Poort"
#: templates/settings.php:18 #: templates/settings.php:18
msgid "Base User Tree" msgid "Base User Tree"
msgstr "" msgstr "Basis Gebruikers Structuur"
#: templates/settings.php:19 #: templates/settings.php:19
msgid "Base Group Tree" msgid "Base Group Tree"
msgstr "" msgstr "Basis Groupen Structuur"
#: templates/settings.php:20 #: templates/settings.php:20
msgid "Group-Member association" msgid "Group-Member association"
msgstr "" msgstr "Groepslid associatie"
#: templates/settings.php:21 #: templates/settings.php:21
msgid "Use TLS" msgid "Use TLS"
msgstr "" msgstr "Gebruik TLS"
#: templates/settings.php:21 #: templates/settings.php:21
msgid "Do not use it for SSL connections, it will fail." msgid "Do not use it for SSL connections, it will fail."
msgstr "" msgstr "Gebruik niet voor SSL connecties, deze mislukken."
#: templates/settings.php:22 #: templates/settings.php:22
msgid "Case insensitve LDAP server (Windows)" msgid "Case insensitve LDAP server (Windows)"
@ -123,7 +124,7 @@ msgstr ""
#: templates/settings.php:23 #: templates/settings.php:23
msgid "Turn off SSL certificate validation." msgid "Turn off SSL certificate validation."
msgstr "" msgstr "Schakel SSL certificaat validatie uit."
#: templates/settings.php:23 #: templates/settings.php:23
msgid "" msgid ""
@ -133,38 +134,38 @@ msgstr ""
#: templates/settings.php:23 #: templates/settings.php:23
msgid "Not recommended, use for testing only." msgid "Not recommended, use for testing only."
msgstr "" msgstr "Niet aangeraden, gebruik alleen voor test doeleinden."
#: templates/settings.php:24 #: templates/settings.php:24
msgid "User Display Name Field" msgid "User Display Name Field"
msgstr "" msgstr "Gebruikers Schermnaam Veld"
#: templates/settings.php:24 #: templates/settings.php:24
msgid "The LDAP attribute to use to generate the user`s ownCloud name." msgid "The LDAP attribute to use to generate the user`s ownCloud name."
msgstr "" msgstr "Het te gebruiken LDAP attribuut voor het genereren van de ownCloud naam voor de gebruikers."
#: templates/settings.php:25 #: templates/settings.php:25
msgid "Group Display Name Field" msgid "Group Display Name Field"
msgstr "" msgstr "Groep Schermnaam Veld"
#: templates/settings.php:25 #: templates/settings.php:25
msgid "The LDAP attribute to use to generate the groups`s ownCloud name." msgid "The LDAP attribute to use to generate the groups`s ownCloud name."
msgstr "" msgstr "Het te gebruiken LDAP attribuut voor het genereren van de ownCloud naam voor de groepen."
#: templates/settings.php:27 #: templates/settings.php:27
msgid "in bytes" msgid "in bytes"
msgstr "" msgstr "in bytes"
#: templates/settings.php:29 #: templates/settings.php:29
msgid "in seconds. A change empties the cache." msgid "in seconds. A change empties the cache."
msgstr "" msgstr "in seconden. Een verandering maakt de cache leeg."
#: templates/settings.php:30 #: templates/settings.php:30
msgid "" msgid ""
"Leave empty for user name (default). Otherwise, specify an LDAP/AD " "Leave empty for user name (default). Otherwise, specify an LDAP/AD "
"attribute." "attribute."
msgstr "" msgstr "Laat leeg voor de gebruikersnaam (standaard). Of, specificeer een LDAP/AD attribuut."
#: templates/settings.php:32 #: templates/settings.php:32
msgid "Help" msgid "Help"
msgstr "" msgstr "Help"

@ -9,14 +9,15 @@
# Sandro Venezuela <sandrovenezuela@gmail.com>, 2012. # Sandro Venezuela <sandrovenezuela@gmail.com>, 2012.
# <targinosilveira@gmail.com>, 2012. # <targinosilveira@gmail.com>, 2012.
# Thiago Vicente <thiagovice@gmail.com>, 2012. # Thiago Vicente <thiagovice@gmail.com>, 2012.
# <thoriumbr@gmail.com>, 2012.
# Van Der Fran <transifex@vanderland.com>, 2011. # Van Der Fran <transifex@vanderland.com>, 2011.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-11-10 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-11-09 23:01+0000\n" "PO-Revision-Date: 2012-11-11 13:30+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n" "Last-Translator: thoriumbr <thoriumbr@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/owncloud/language/pt_BR/)\n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/owncloud/language/pt_BR/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -145,7 +146,7 @@ msgstr "Resposta"
#: templates/personal.php:8 #: templates/personal.php:8
#, php-format #, php-format
msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>" msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>"
msgstr "" msgstr "Você usou <strong>%s</strong> do seu espaço de <strong>%s</strong>"
#: templates/personal.php:12 #: templates/personal.php:12
msgid "Desktop and Mobile Syncing Clients" msgid "Desktop and Mobile Syncing Clients"

@ -3,13 +3,14 @@
# This file is distributed under the same license as the PACKAGE package. # This file is distributed under the same license as the PACKAGE package.
# #
# Translators: # Translators:
# <thoriumbr@gmail.com>, 2012.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-11-09 10:06+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-11-09 09:06+0000\n" "PO-Revision-Date: 2012-11-11 13:40+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: thoriumbr <thoriumbr@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/owncloud/language/pt_BR/)\n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/owncloud/language/pt_BR/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -19,4 +20,4 @@ msgstr ""
#: templates/settings.php:4 #: templates/settings.php:4
msgid "WebDAV URL: http://" msgid "WebDAV URL: http://"
msgstr "" msgstr "URL do WebDAV: http://"

@ -14,9 +14,9 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-11-10 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-11-09 23:01+0000\n" "PO-Revision-Date: 2012-11-11 13:03+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n" "Last-Translator: Magnus Höglund <magnus@linux.com>\n"
"Language-Team: Swedish (http://www.transifex.com/projects/p/owncloud/language/sv/)\n" "Language-Team: Swedish (http://www.transifex.com/projects/p/owncloud/language/sv/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -145,7 +145,7 @@ msgstr "Svar"
#: templates/personal.php:8 #: templates/personal.php:8
#, php-format #, php-format
msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>" msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>"
msgstr "" msgstr "Du har använt <strong>%s</strong> av tillgängliga <strong>%s</strong>"
#: templates/personal.php:12 #: templates/personal.php:12
msgid "Desktop and Mobile Syncing Clients" msgid "Desktop and Mobile Syncing Clients"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-11 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

@ -4,6 +4,7 @@
# #
# Translators: # Translators:
# Donahue Chuang <soshinwu@gmail.com>, 2012. # Donahue Chuang <soshinwu@gmail.com>, 2012.
# <sy6614@yahoo.com.hk>, 2012.
# <weiyu871@ms14.url.com.tw>, 2012. # <weiyu871@ms14.url.com.tw>, 2012.
# <wu0809@msn.com>, 2012. # <wu0809@msn.com>, 2012.
# ywang <ywang1007@gmail.com>, 2012. # ywang <ywang1007@gmail.com>, 2012.
@ -11,9 +12,9 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ownCloud\n" "Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n" "Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2012-11-10 00:01+0100\n" "POT-Creation-Date: 2012-11-12 00:01+0100\n"
"PO-Revision-Date: 2012-11-09 23:01+0000\n" "PO-Revision-Date: 2012-11-11 14:57+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n" "Last-Translator: sy6614 <sy6614@yahoo.com.hk>\n"
"Language-Team: Chinese (Taiwan) (http://www.transifex.com/projects/p/owncloud/language/zh_TW/)\n" "Language-Team: Chinese (Taiwan) (http://www.transifex.com/projects/p/owncloud/language/zh_TW/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
@ -35,7 +36,7 @@ msgstr "群組增加失敗"
#: ajax/enableapp.php:12 #: ajax/enableapp.php:12
msgid "Could not enable app. " msgid "Could not enable app. "
msgstr "" msgstr "未能啟動此app"
#: ajax/lostpassword.php:12 #: ajax/lostpassword.php:12
msgid "Email saved" msgid "Email saved"
@ -101,7 +102,7 @@ msgstr "添加你的 App"
#: templates/apps.php:11 #: templates/apps.php:11
msgid "More Apps" msgid "More Apps"
msgstr "" msgstr "更多Apps"
#: templates/apps.php:27 #: templates/apps.php:27
msgid "Select an App" msgid "Select an App"
@ -113,7 +114,7 @@ msgstr "查看應用程式頁面於 apps.owncloud.com"
#: templates/apps.php:32 #: templates/apps.php:32
msgid "<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>" msgid "<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>"
msgstr "" msgstr "<span class=\"licence\"></span>-核准: <span class=\"author\"></span>"
#: templates/help.php:9 #: templates/help.php:9
msgid "Documentation" msgid "Documentation"
@ -129,7 +130,7 @@ msgstr "提問"
#: templates/help.php:22 #: templates/help.php:22
msgid "Problems connecting to help database." msgid "Problems connecting to help database."
msgstr "連接到求助資料庫發生問題" msgstr "連接到求助資料庫發生問題"
#: templates/help.php:23 #: templates/help.php:23
msgid "Go there manually." msgid "Go there manually."
@ -154,7 +155,7 @@ msgstr "下載"
#: templates/personal.php:19 #: templates/personal.php:19
msgid "Your password was changed" msgid "Your password was changed"
msgstr "" msgstr "你的密碼已更改"
#: templates/personal.php:20 #: templates/personal.php:20
msgid "Unable to change your password" msgid "Unable to change your password"
@ -208,7 +209,7 @@ msgid ""
"licensed under the <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" " "licensed under the <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" "
"target=\"_blank\"><abbr title=\"Affero General Public " "target=\"_blank\"><abbr title=\"Affero General Public "
"License\">AGPL</abbr></a>." "License\">AGPL</abbr></a>."
msgstr "" msgstr "由<a href=\"http://ownCloud.org/contact\" target=\"_blank\">ownCloud 社區</a>開發,<a href=\"https://github.com/owncloud\" target=\"_blank\">源代碼</a>在<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero General Public License\">AGPL</abbr></a>許可證下發布。"
#: templates/users.php:21 templates/users.php:76 #: templates/users.php:21 templates/users.php:76
msgid "Name" msgid "Name"

@ -20,6 +20,8 @@
* *
*/ */
require_once 'public/constants.php';
/** /**
* Class that is a namespace for all global OC variables * Class that is a namespace for all global OC variables
* No, we can not put this class in its own file because it is used by * No, we can not put this class in its own file because it is used by
@ -230,7 +232,7 @@ class OC{
file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/.htaccess', $content); file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/.htaccess', $content);
} }
} }
} }
OC_Log::write('core', 'starting upgrade from '.$installedVersion.' to '.$currentVersion, OC_Log::DEBUG); OC_Log::write('core', 'starting upgrade from '.$installedVersion.' to '.$currentVersion, OC_Log::DEBUG);
$result=OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml'); $result=OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
if(!$result) { if(!$result) {
@ -288,7 +290,7 @@ class OC{
// (re)-initialize session // (re)-initialize session
session_start(); session_start();
// regenerate session id periodically to avoid session fixation // regenerate session id periodically to avoid session fixation
if (!isset($_SESSION['SID_CREATED'])) { if (!isset($_SESSION['SID_CREATED'])) {
$_SESSION['SID_CREATED'] = time(); $_SESSION['SID_CREATED'] = time();

@ -91,16 +91,16 @@ class OC_Files {
foreach ($files as &$file) { foreach ($files as &$file) {
$file['directory'] = $directory; $file['directory'] = $directory;
$file['type'] = ($file['mimetype'] == 'httpd/unix-directory') ? 'dir' : 'file'; $file['type'] = ($file['mimetype'] == 'httpd/unix-directory') ? 'dir' : 'file';
$permissions = OCP\Share::PERMISSION_READ; $permissions = OCP\PERMISSION_READ;
// NOTE: Remove check when new encryption is merged // NOTE: Remove check when new encryption is merged
if (!$file['encrypted']) { if (!$file['encrypted']) {
$permissions |= OCP\Share::PERMISSION_SHARE; $permissions |= OCP\PERMISSION_SHARE;
} }
if ($file['type'] == 'dir' && $file['writable']) { if ($file['type'] == 'dir' && $file['writable']) {
$permissions |= OCP\Share::PERMISSION_CREATE; $permissions |= OCP\PERMISSION_CREATE;
} }
if ($file['writable']) { if ($file['writable']) {
$permissions |= OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_DELETE; $permissions |= OCP\PERMISSION_UPDATE | OCP\PERMISSION_DELETE;
} }
$file['permissions'] = $permissions; $file['permissions'] = $permissions;
} }

@ -0,0 +1,38 @@
<?php
/**
* ownCloud
*
* @author Thomas Tanghus
* @copyright 2012 Thomas Tanghus (thomas@tanghus.net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* This file defines common constants used in ownCloud
*/
namespace OCP;
/**
* CRUDS permissions.
*/
const PERMISSION_CREATE = 4;
const PERMISSION_READ = 1;
const PERMISSION_UPDATE = 2;
const PERMISSION_DELETE = 8;
const PERMISSION_SHARE = 16;
const PERMISSION_ALL = 31;

@ -46,12 +46,8 @@ class Share {
* Check if permission is granted with And (&) e.g. Check if delete is granted: if ($permissions & PERMISSION_DELETE) * Check if permission is granted with And (&) e.g. Check if delete is granted: if ($permissions & PERMISSION_DELETE)
* Remove permissions with And (&) and Not (~) e.g. Remove the update permission: $permissions &= ~PERMISSION_UPDATE * Remove permissions with And (&) and Not (~) e.g. Remove the update permission: $permissions &= ~PERMISSION_UPDATE
* Apps are required to handle permissions on their own, this class only stores and manages the permissions of shares * Apps are required to handle permissions on their own, this class only stores and manages the permissions of shares
* @see lib/public/constants.php
*/ */
const PERMISSION_CREATE = 4;
const PERMISSION_READ = 1;
const PERMISSION_UPDATE = 2;
const PERMISSION_DELETE = 8;
const PERMISSION_SHARE = 16;
const FORMAT_NONE = -1; const FORMAT_NONE = -1;
const FORMAT_STATUSES = -2; const FORMAT_STATUSES = -2;
@ -402,7 +398,7 @@ class Share {
// Check if permissions were removed // Check if permissions were removed
if ($item['permissions'] & ~$permissions) { if ($item['permissions'] & ~$permissions) {
// If share permission is removed all reshares must be deleted // If share permission is removed all reshares must be deleted
if (($item['permissions'] & self::PERMISSION_SHARE) && (~$permissions & self::PERMISSION_SHARE)) { if (($item['permissions'] & PERMISSION_SHARE) && (~$permissions & PERMISSION_SHARE)) {
self::delete($item['id'], true); self::delete($item['id'], true);
} else { } else {
$ids = array(); $ids = array();
@ -701,7 +697,7 @@ class Share {
$items[$id]['share_with'] = $row['share_with']; $items[$id]['share_with'] = $row['share_with'];
} }
// Switch ids if sharing permission is granted on only one share to ensure correct parent is used if resharing // Switch ids if sharing permission is granted on only one share to ensure correct parent is used if resharing
if (~(int)$items[$id]['permissions'] & self::PERMISSION_SHARE && (int)$row['permissions'] & self::PERMISSION_SHARE) { if (~(int)$items[$id]['permissions'] & PERMISSION_SHARE && (int)$row['permissions'] & PERMISSION_SHARE) {
$items[$row['id']] = $items[$id]; $items[$row['id']] = $items[$id];
unset($items[$id]); unset($items[$id]);
$id = $row['id']; $id = $row['id'];
@ -847,7 +843,7 @@ class Share {
throw new \Exception($message); throw new \Exception($message);
} }
// Check if share permissions is granted // Check if share permissions is granted
if ((int)$checkReshare['permissions'] & self::PERMISSION_SHARE) { if ((int)$checkReshare['permissions'] & PERMISSION_SHARE) {
if (~(int)$checkReshare['permissions'] & $permissions) { if (~(int)$checkReshare['permissions'] & $permissions) {
$message = 'Sharing '.$itemSource.' failed, because the permissions exceed permissions granted to '.$uidOwner; $message = 'Sharing '.$itemSource.' failed, because the permissions exceed permissions granted to '.$uidOwner;
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR); \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
@ -1133,7 +1129,7 @@ class Share {
$duplicateParent = $query->execute(array($item['item_type'], $item['item_target'], self::SHARE_TYPE_USER, self::SHARE_TYPE_GROUP, self::$shareTypeGroupUserUnique, $item['uid_owner'], $item['parent']))->fetchRow(); $duplicateParent = $query->execute(array($item['item_type'], $item['item_target'], self::SHARE_TYPE_USER, self::SHARE_TYPE_GROUP, self::$shareTypeGroupUserUnique, $item['uid_owner'], $item['parent']))->fetchRow();
if ($duplicateParent) { if ($duplicateParent) {
// Change the parent to the other item id if share permission is granted // Change the parent to the other item id if share permission is granted
if ($duplicateParent['permissions'] & self::PERMISSION_SHARE) { if ($duplicateParent['permissions'] & PERMISSION_SHARE) {
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `parent` = ? WHERE `id` = ?'); $query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `parent` = ? WHERE `id` = ?');
$query->execute(array($duplicateParent['id'], $item['id'])); $query->execute(array($duplicateParent['id'], $item['id']));
continue; continue;

@ -17,16 +17,16 @@
"Enable" => "Käytä", "Enable" => "Käytä",
"Saving..." => "Tallennetaan...", "Saving..." => "Tallennetaan...",
"__language_name__" => "_kielen_nimi_", "__language_name__" => "_kielen_nimi_",
"Add your App" => "Lisää ohjelmasi", "Add your App" => "Lisää sovelluksesi",
"More Apps" => "Lisää sovelluksia", "More Apps" => "Lisää sovelluksia",
"Select an App" => "Valitse ohjelma", "Select an App" => "Valitse sovellus",
"See application page at apps.owncloud.com" => "Katso sovellussivu osoitteessa apps.owncloud.com", "See application page at apps.owncloud.com" => "Katso sovellussivu osoitteessa apps.owncloud.com",
"<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>" => "<span class=\"licence\"></span>-lisensoija <span class=\"author\"></span>", "<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>" => "<span class=\"licence\"></span>-lisensoija <span class=\"author\"></span>",
"Documentation" => "Dokumentaatio", "Documentation" => "Dokumentaatio",
"Managing Big Files" => "Suurten tiedostojen hallinta", "Managing Big Files" => "Suurten tiedostojen hallinta",
"Ask a question" => "Kysy jotain", "Ask a question" => "Kysy jotain",
"Problems connecting to help database." => "Virhe yhdistettäessä tietokantaan.", "Problems connecting to help database." => "Virhe yhdistettäessä tietokantaan.",
"Go there manually." => "Ohje löytyy sieltä.", "Go there manually." => "Siirry sinne itse.",
"Answer" => "Vastaus", "Answer" => "Vastaus",
"You have used <strong>%s</strong> of the available <strong>%s</strong>" => "Käytössäsi on <strong>%s</strong>/<strong>%s</strong>", "You have used <strong>%s</strong> of the available <strong>%s</strong>" => "Käytössäsi on <strong>%s</strong>/<strong>%s</strong>",
"Desktop and Mobile Syncing Clients" => "Tietokoneen ja mobiililaitteiden synkronointisovellukset", "Desktop and Mobile Syncing Clients" => "Tietokoneen ja mobiililaitteiden synkronointisovellukset",

@ -28,6 +28,7 @@
"Problems connecting to help database." => "Problème de connexion à la base de données d'aide.", "Problems connecting to help database." => "Problème de connexion à la base de données d'aide.",
"Go there manually." => "S'y rendre manuellement.", "Go there manually." => "S'y rendre manuellement.",
"Answer" => "Réponse", "Answer" => "Réponse",
"You have used <strong>%s</strong> of the available <strong>%s</strong>" => "Vous avez utilisé <strong>%s</strong> des <strong>%s<strong> disponibles",
"Desktop and Mobile Syncing Clients" => "Clients de synchronisation Mobile et Ordinateur", "Desktop and Mobile Syncing Clients" => "Clients de synchronisation Mobile et Ordinateur",
"Download" => "Télécharger", "Download" => "Télécharger",
"Your password was changed" => "Votre mot de passe a été changé", "Your password was changed" => "Votre mot de passe a été changé",

@ -28,6 +28,7 @@
"Problems connecting to help database." => "Problemas ao conectar na base de dados.", "Problems connecting to help database." => "Problemas ao conectar na base de dados.",
"Go there manually." => "Ir manualmente.", "Go there manually." => "Ir manualmente.",
"Answer" => "Resposta", "Answer" => "Resposta",
"You have used <strong>%s</strong> of the available <strong>%s</strong>" => "Você usou <strong>%s</strong> do seu espaço de <strong>%s</strong>",
"Desktop and Mobile Syncing Clients" => "Sincronizando Desktop e Mobile", "Desktop and Mobile Syncing Clients" => "Sincronizando Desktop e Mobile",
"Download" => "Download", "Download" => "Download",
"Your password was changed" => "Sua senha foi alterada", "Your password was changed" => "Sua senha foi alterada",

@ -28,6 +28,7 @@
"Problems connecting to help database." => "Problem med att ansluta till hjälpdatabasen.", "Problems connecting to help database." => "Problem med att ansluta till hjälpdatabasen.",
"Go there manually." => "Gå dit manuellt.", "Go there manually." => "Gå dit manuellt.",
"Answer" => "Svar", "Answer" => "Svar",
"You have used <strong>%s</strong> of the available <strong>%s</strong>" => "Du har använt <strong>%s</strong> av tillgängliga <strong>%s</strong>",
"Desktop and Mobile Syncing Clients" => "Synkroniseringsklienter för dator och mobil", "Desktop and Mobile Syncing Clients" => "Synkroniseringsklienter för dator och mobil",
"Download" => "Ladda ner", "Download" => "Ladda ner",
"Your password was changed" => "Ditt lösenord har ändrats", "Your password was changed" => "Ditt lösenord har ändrats",

@ -2,6 +2,7 @@
"Unable to load list from App Store" => "無法從 App Store 讀取清單", "Unable to load list from App Store" => "無法從 App Store 讀取清單",
"Group already exists" => "群組已存在", "Group already exists" => "群組已存在",
"Unable to add group" => "群組增加失敗", "Unable to add group" => "群組增加失敗",
"Could not enable app. " => "未能啟動此app",
"Email saved" => "Email已儲存", "Email saved" => "Email已儲存",
"Invalid email" => "無效的email", "Invalid email" => "無效的email",
"OpenID Changed" => "OpenID 已變更", "OpenID Changed" => "OpenID 已變更",
@ -17,16 +18,19 @@
"Saving..." => "儲存中...", "Saving..." => "儲存中...",
"__language_name__" => "__語言_名稱__", "__language_name__" => "__語言_名稱__",
"Add your App" => "添加你的 App", "Add your App" => "添加你的 App",
"More Apps" => "更多Apps",
"Select an App" => "選擇一個應用程式", "Select an App" => "選擇一個應用程式",
"See application page at apps.owncloud.com" => "查看應用程式頁面於 apps.owncloud.com", "See application page at apps.owncloud.com" => "查看應用程式頁面於 apps.owncloud.com",
"<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>" => "<span class=\"licence\"></span>-核准: <span class=\"author\"></span>",
"Documentation" => "文件", "Documentation" => "文件",
"Managing Big Files" => "管理大檔案", "Managing Big Files" => "管理大檔案",
"Ask a question" => "提問", "Ask a question" => "提問",
"Problems connecting to help database." => "連接到求助資料庫發生問題", "Problems connecting to help database." => "連接到求助資料庫發生問題",
"Go there manually." => "手動前往", "Go there manually." => "手動前往",
"Answer" => "答案", "Answer" => "答案",
"Desktop and Mobile Syncing Clients" => "桌機與手機同步客戶端", "Desktop and Mobile Syncing Clients" => "桌機與手機同步客戶端",
"Download" => "下載", "Download" => "下載",
"Your password was changed" => "你的密碼已更改",
"Unable to change your password" => "無法變更你的密碼", "Unable to change your password" => "無法變更你的密碼",
"Current password" => "目前密碼", "Current password" => "目前密碼",
"New password" => "新密碼", "New password" => "新密碼",
@ -38,6 +42,7 @@
"Language" => "語言", "Language" => "語言",
"Help translate" => "幫助翻譯", "Help translate" => "幫助翻譯",
"use this address to connect to your ownCloud in your file manager" => "使用這個位址去連接到你的私有雲檔案管理員", "use this address to connect to your ownCloud in your file manager" => "使用這個位址去連接到你的私有雲檔案管理員",
"Developed by the <a href=\"http://ownCloud.org/contact\" target=\"_blank\">ownCloud community</a>, the <a href=\"https://github.com/owncloud\" target=\"_blank\">source code</a> is licensed under the <a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero General Public License\">AGPL</abbr></a>." => "由<a href=\"http://ownCloud.org/contact\" target=\"_blank\">ownCloud 社區</a>開發,<a href=\"https://github.com/owncloud\" target=\"_blank\">源代碼</a><a href=\"http://www.gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero General Public License\">AGPL</abbr></a>許可證下發布。",
"Name" => "名稱", "Name" => "名稱",
"Password" => "密碼", "Password" => "密碼",
"Groups" => "群組", "Groups" => "群組",

@ -64,7 +64,7 @@ class Test_Share extends UnitTestCase {
public function testShareInvalidShareType() { public function testShareInvalidShareType() {
$message = 'Share type foobar is not valid for test.txt'; $message = 'Share type foobar is not valid for test.txt';
try { try {
OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, OCP\PERMISSION_READ);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
@ -73,7 +73,7 @@ class Test_Share extends UnitTestCase {
public function testInvalidItemType() { public function testInvalidItemType() {
$message = 'Sharing backend for foobar not found'; $message = 'Sharing backend for foobar not found';
try { try {
OCP\Share::shareItem('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
@ -109,7 +109,7 @@ class Test_Share extends UnitTestCase {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
try { try {
OCP\Share::setPermissions('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_UPDATE); OCP\Share::setPermissions('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_UPDATE);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
@ -120,131 +120,131 @@ class Test_Share extends UnitTestCase {
// Invalid shares // Invalid shares
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the item owner'; $message = 'Sharing test.txt failed, because the user '.$this->user1.' is the item owner';
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
$message = 'Sharing test.txt failed, because the user foobar does not exist'; $message = 'Sharing test.txt failed, because the user foobar does not exist';
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, 'foobar', OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, 'foobar', OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
$message = 'Sharing foobar failed, because the sharing backend for test could not find its source'; $message = 'Sharing foobar failed, because the sharing backend for test could not find its source';
try { try {
OCP\Share::shareItem('test', 'foobar', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'foobar', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Valid share // Valid share
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
$this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE)); $this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$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', Test_Share_Backend::FORMAT_SOURCE));
// Attempt to share again // 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; $message = 'Sharing test.txt failed, because this item is already shared with '.$this->user2;
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Attempt to share back // Attempt to share back
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the original sharer'; $message = 'Sharing test.txt failed, because the user '.$this->user1.' is the original sharer';
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Unshare // Unshare
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2)); $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
// Attempt reshare without share permission // Attempt reshare without share permission
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because resharing is not allowed'; $message = 'Sharing test.txt failed, because resharing is not allowed';
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Owner grants share and update permission // Owner grants share and update permission
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_SHARE)); $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE | OCP\PERMISSION_SHARE));
// Attempt reshare with escalated permissions // 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; $message = 'Sharing test.txt failed, because the permissions exceed permissions granted to '.$this->user2;
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_DELETE); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Valid reshare // Valid reshare
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE));
$this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE)); $this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$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', Test_Share_Backend::FORMAT_SOURCE));
$this->assertEquals(array(OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Attempt to escalate 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; $message = 'Setting permissions for test.txt failed, because the permissions exceed permissions granted to '.$this->user2;
try { try {
OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_DELETE); OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Remove update permission // Remove update permission
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE)); $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array(OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$this->assertEquals(array(OCP\Share::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Remove share permission // Remove share permission
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array(OCP\Share::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$this->assertFalse(OCP\Share::getItemSharedWith('test', 'test.txt')); $this->assertFalse(OCP\Share::getItemSharedWith('test', 'test.txt'));
// Reshare again, and then have owner unshare // Reshare again, and then have owner unshare
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE)); $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ));
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2)); $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertFalse(OCP\Share::getItemSharedWith('test', 'test.txt')); $this->assertFalse(OCP\Share::getItemSharedWith('test', 'test.txt'));
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$this->assertFalse(OCP\Share::getItemSharedWith('test', 'test.txt')); $this->assertFalse(OCP\Share::getItemSharedWith('test', 'test.txt'));
// Attempt target conflict // Attempt target conflict
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\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET); $to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
@ -263,7 +263,7 @@ class Test_Share extends UnitTestCase {
// Invalid shares // Invalid shares
$message = 'Sharing test.txt failed, because the group foobar does not exist'; $message = 'Sharing test.txt failed, because the group foobar does not exist';
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, 'foobar', OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, 'foobar', OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
@ -272,131 +272,131 @@ class Test_Share extends UnitTestCase {
OC_Appconfig::setValue('core', 'shareapi_share_policy', 'groups_only'); OC_Appconfig::setValue('core', 'shareapi_share_policy', 'groups_only');
$message = 'Sharing test.txt failed, because '.$this->user1.' is not a member of the group '.$this->group2; $message = 'Sharing test.txt failed, because '.$this->user1.' is not a member of the group '.$this->group2;
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group2, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group2, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
OC_Appconfig::setValue('core', 'shareapi_share_policy', $policy); OC_Appconfig::setValue('core', 'shareapi_share_policy', $policy);
// Valid share // Valid share
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ));
$this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE)); $this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$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', Test_Share_Backend::FORMAT_SOURCE));
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$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', Test_Share_Backend::FORMAT_SOURCE));
// Attempt to share again // 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->group1; $message = 'Sharing test.txt failed, because this item is already shared with '.$this->group1;
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Attempt to share back to owner of group share // Attempt to share back to owner of group share
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the original sharer'; $message = 'Sharing test.txt failed, because the user '.$this->user1.' is the original sharer';
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Attempt to share back to group // Attempt to share back to group
$message = 'Sharing test.txt failed, because this item is already shared with '.$this->group1; $message = 'Sharing test.txt failed, because this item is already shared with '.$this->group1;
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Attempt to share back to member of group // Attempt to share back to member of group
$message ='Sharing test.txt failed, because this item is already shared with '.$this->user3; $message ='Sharing test.txt failed, because this item is already shared with '.$this->user3;
try { try {
OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\Share::PERMISSION_READ); OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, OCP\PERMISSION_READ);
$this->fail('Exception was expected: '.$message); $this->fail('Exception was expected: '.$message);
} catch (Exception $exception) { } catch (Exception $exception) {
$this->assertEquals($message, $exception->getMessage()); $this->assertEquals($message, $exception->getMessage());
} }
// Unshare // Unshare
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1)); $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1));
// Valid share with same person - user then group // Valid share with same person - user then group
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE | OCP\PERMISSION_SHARE));
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
$this->assertEquals(array(OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE | OCP\PERMISSION_DELETE | OCP\PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
$this->assertEquals(array(OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Valid reshare // Valid reshare
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\Share::PERMISSION_READ)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\PERMISSION_READ));
OC_User::setUserId($this->user4); OC_User::setUserId($this->user4);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Unshare from user only // Unshare from user only
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2)); $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array(OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
OC_User::setUserId($this->user4); OC_User::setUserId($this->user4);
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Valid share with same person - group then user // Valid share with same person - group then user
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\Share::PERMISSION_READ | OCP\Share::PERMISSION_DELETE)); $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, OCP\PERMISSION_READ | OCP\PERMISSION_DELETE));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
$this->assertEquals(array(OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_UPDATE | OCP\PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Unshare from group only // Unshare from group only
OC_User::setUserId($this->user1); OC_User::setUserId($this->user1);
$this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1)); $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array(OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS)); $this->assertEquals(array(OCP\PERMISSION_READ | OCP\PERMISSION_DELETE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
// Attempt user specific target conflict // Attempt user specific target conflict
OC_User::setUserId($this->user3); OC_User::setUserId($this->user3);
$this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE)); $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET); $to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
$this->assertEquals(2, count($to_test)); $this->assertEquals(2, count($to_test));
$this->assertTrue(in_array('test.txt', $to_test)); $this->assertTrue(in_array('test.txt', $to_test));
$this->assertTrue(in_array('test1.txt', $to_test)); $this->assertTrue(in_array('test1.txt', $to_test));
// Valid reshare // Valid reshare
$this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_SHARE)); $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE));
OC_User::setUserId($this->user4); OC_User::setUserId($this->user4);
$this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Remove user from group // Remove user from group
OC_Group::removeFromGroup($this->user2, $this->group1); OC_Group::removeFromGroup($this->user2, $this->group1);
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
OC_User::setUserId($this->user4); OC_User::setUserId($this->user4);
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Add user to group // Add user to group
OC_Group::addToGroup($this->user4, $this->group1); OC_Group::addToGroup($this->user4, $this->group1);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Unshare from self // Unshare from self
$this->assertTrue(OCP\Share::unshareFromSelf('test', 'test.txt')); $this->assertTrue(OCP\Share::unshareFromSelf('test', 'test.txt'));
$this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
OC_User::setUserId($this->user2); OC_User::setUserId($this->user2);
$this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET)); $this->assertEquals(array('test.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
// Remove group // Remove group
OC_Group::deleteGroup($this->group1); OC_Group::deleteGroup($this->group1);
OC_User::setUserId($this->user4); OC_User::setUserId($this->user4);

Loading…
Cancel
Save