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

This commit is contained in:
Thomas Tanghus 2012-11-12 00:37:40 +01:00
commit 82e010c51c
37 changed files with 268 additions and 185 deletions

View File

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

View File

@ -58,7 +58,7 @@
<th id="headerSize"><?php echo $l->t( 'Size' ); ?></th>
<th id="headerDate">
<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 -->
<?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>

View File

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

View File

@ -97,10 +97,10 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
$file['permissions'] = $item['permissions'];
if ($file['type'] == '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
$file['permissions'] |= OCP\Share::PERMISSION_DELETE;
$file['permissions'] |= OCP\PERMISSION_DELETE;
$files[] = $file;
}
return $files;
@ -113,7 +113,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
}
$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) {
$files = array();
foreach ($items as $item) {

View File

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

View File

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

View File

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

View File

@ -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"
);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

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

View File

@ -20,6 +20,8 @@
*
*/
require_once 'public/constants.php';
/**
* 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
@ -230,7 +232,7 @@ class OC{
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);
$result=OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/db_structure.xml');
if(!$result) {
@ -288,7 +290,7 @@ class OC{
// (re)-initialize session
session_start();
// regenerate session id periodically to avoid session fixation
if (!isset($_SESSION['SID_CREATED'])) {
$_SESSION['SID_CREATED'] = time();

View File

@ -91,16 +91,16 @@ class OC_Files {
foreach ($files as &$file) {
$file['directory'] = $directory;
$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
if (!$file['encrypted']) {
$permissions |= OCP\Share::PERMISSION_SHARE;
$permissions |= OCP\PERMISSION_SHARE;
}
if ($file['type'] == 'dir' && $file['writable']) {
$permissions |= OCP\Share::PERMISSION_CREATE;
$permissions |= OCP\PERMISSION_CREATE;
}
if ($file['writable']) {
$permissions |= OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_DELETE;
$permissions |= OCP\PERMISSION_UPDATE | OCP\PERMISSION_DELETE;
}
$file['permissions'] = $permissions;
}

38
lib/public/constants.php Normal file
View File

@ -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;

View File

@ -46,12 +46,8 @@ class Share {
* 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
* 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_STATUSES = -2;
@ -402,7 +398,7 @@ class Share {
// Check if permissions were removed
if ($item['permissions'] & ~$permissions) {
// 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);
} else {
$ids = array();
@ -701,7 +697,7 @@ class Share {
$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
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];
unset($items[$id]);
$id = $row['id'];
@ -847,7 +843,7 @@ class Share {
throw new \Exception($message);
}
// Check if share permissions is granted
if ((int)$checkReshare['permissions'] & self::PERMISSION_SHARE) {
if ((int)$checkReshare['permissions'] & PERMISSION_SHARE) {
if (~(int)$checkReshare['permissions'] & $permissions) {
$message = 'Sharing '.$itemSource.' failed, because the permissions exceed permissions granted to '.$uidOwner;
\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();
if ($duplicateParent) {
// 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->execute(array($duplicateParent['id'], $item['id']));
continue;

View File

@ -17,16 +17,16 @@
"Enable" => "Käytä",
"Saving..." => "Tallennetaan...",
"__language_name__" => "_kielen_nimi_",
"Add your App" => "Lisää ohjelmasi",
"Add your App" => "Lisää sovelluksesi",
"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",
"<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>" => "<span class=\"licence\"></span>-lisensoija <span class=\"author\"></span>",
"Documentation" => "Dokumentaatio",
"Managing Big Files" => "Suurten tiedostojen hallinta",
"Ask a question" => "Kysy jotain",
"Problems connecting to help database." => "Virhe yhdistettäessä tietokantaan.",
"Go there manually." => "Ohje löytyy sieltä.",
"Go there manually." => "Siirry sinne itse.",
"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>",
"Desktop and Mobile Syncing Clients" => "Tietokoneen ja mobiililaitteiden synkronointisovellukset",

View File

@ -28,6 +28,7 @@
"Problems connecting to help database." => "Problème de connexion à la base de données d'aide.",
"Go there manually." => "S'y rendre manuellement.",
"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",
"Download" => "Télécharger",
"Your password was changed" => "Votre mot de passe a été changé",

View File

@ -28,6 +28,7 @@
"Problems connecting to help database." => "Problemas ao conectar na base de dados.",
"Go there manually." => "Ir manualmente.",
"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",
"Download" => "Download",
"Your password was changed" => "Sua senha foi alterada",

View File

@ -28,6 +28,7 @@
"Problems connecting to help database." => "Problem med att ansluta till hjälpdatabasen.",
"Go there manually." => "Gå dit manuellt.",
"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",
"Download" => "Ladda ner",
"Your password was changed" => "Ditt lösenord har ändrats",

View File

@ -2,6 +2,7 @@
"Unable to load list from App Store" => "無法從 App Store 讀取清單",
"Group already exists" => "群組已存在",
"Unable to add group" => "群組增加失敗",
"Could not enable app. " => "未能啟動此app",
"Email saved" => "Email已儲存",
"Invalid email" => "無效的email",
"OpenID Changed" => "OpenID 已變更",
@ -17,16 +18,19 @@
"Saving..." => "儲存中...",
"__language_name__" => "__語言_名稱__",
"Add your App" => "添加你的 App",
"More Apps" => "更多Apps",
"Select an App" => "選擇一個應用程式",
"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" => "文件",
"Managing Big Files" => "管理大檔案",
"Ask a question" => "提問",
"Problems connecting to help database." => "連接到求助資料庫發生問題",
"Problems connecting to help database." => "連接到求助資料庫發生問題",
"Go there manually." => "手動前往",
"Answer" => "答案",
"Desktop and Mobile Syncing Clients" => "桌機與手機同步客戶端",
"Download" => "下載",
"Your password was changed" => "你的密碼已更改",
"Unable to change your password" => "無法變更你的密碼",
"Current password" => "目前密碼",
"New password" => "新密碼",
@ -38,6 +42,7 @@
"Language" => "語言",
"Help translate" => "幫助翻譯",
"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" => "名稱",
"Password" => "密碼",
"Groups" => "群組",

View File

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