private static $shareTypeGroupUserUnique = 2;\r
private static $backends = array();\r
private static $backendTypes = array();\r
+ private static $isResharingAllowed;\r
\r
/**\r
* @brief Register a sharing backend class that implements OCP\Share_Backend for an item type\r
throw new \Exception($message);\r
}\r
\r
+ /**\r
+ * @brief Check if resharing is allowed\r
+ * @return Returns true if allowed or false\r
+ *\r
+ * Resharing is allowed by default if not configured\r
+ *\r
+ */\r
+ private static function isResharingAllowed() {\r
+ if (!isset(self::$isResharingAllowed)) {\r
+ if (\OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes') == 'yes') {\r
+ self::$isResharingAllowed = true;\r
+ } else {\r
+ self::$isResharingAllowed = false;\r
+ }\r
+ }\r
+ return self::$isResharingAllowed;\r
+ }\r
+\r
/**\r
* @brief Get a list of collection item types for the specified item type\r
* @param string Item type\r
continue;\r
}\r
}\r
+ // Check if resharing is allowed, if not remove share permission\r
+ if (isset($row['permissions']) && !self::isResharingAllowed()) {\r
+ $row['permissions'] &= ~self::PERMISSION_SHARE;\r
+ }\r
$items[$row['id']] = $row;\r
}\r
if (!empty($items)) {\r
throw new \Exception($message);\r
}\r
// Check if share permissions is granted\r
- if ((int)$checkReshare['permissions'] & self::PERMISSION_SHARE) {\r
+ if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & self::PERMISSION_SHARE) {\r
if (~(int)$checkReshare['permissions'] & $permissions) {\r
$message = 'Sharing '.$itemSource.' failed, because the permissions exceed permissions granted to '.$uidOwner;\r
\OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);\r