Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share tags wip #10487

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/private/share/share.php
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,15 @@ protected static function unshareItem(array $item) {
\OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
}

/**
* Check if a backend class has been registered for the specified item type
* @param string $itemType
* @return boolean True if a backend has been registered, false otherwise.
*/
public static function hasBackend($itemType) {
return isset(self::$backendTypes[$itemType]);
}

/**
* Get the backend class for the specified item type
* @param string $itemType
Expand Down Expand Up @@ -1130,15 +1139,15 @@ public static function isResharingAllowed() {
* @param string $itemType
* @return array
*/
private static function getCollectionItemTypes($itemType) {
public static function getCollectionItemTypes($itemType) {
$collectionTypes = array($itemType);
foreach (self::$backendTypes as $type => $backend) {
if (in_array($backend['collectionOf'], $collectionTypes)) {
$collectionTypes[] = $type;
}
}
// TODO Add option for collections to be collection of themselves, only 'folder' does it now...
if (!self::getBackend($itemType) instanceof \OCP\Share_Backend_Collection || $itemType != 'folder') {
if (isset(self::$backendTypes[$itemType]) && (!self::getBackend($itemType) instanceof \OCP\Share_Backend_Collection || $itemType != 'folder')) {
unset($collectionTypes[0]);
}
// Return array if collections were found or the item type is a
Expand Down
Loading