forked from extern/egroupware
Break out merge share creation so it can be overridden
This commit is contained in:
parent
2d644d930e
commit
66d6a6c883
@ -485,16 +485,36 @@ abstract class Merge
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get or create the share
|
// Get or create the share
|
||||||
|
$share = $this->create_share($app, $id, $content);
|
||||||
|
|
||||||
|
if($share)
|
||||||
|
{
|
||||||
|
$replacements['$$'.$prefix.'share$$'] = $link = Api\Sharing::share2link($share);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $replacements;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a share for an entry
|
||||||
|
*
|
||||||
|
* @param string $app
|
||||||
|
* @param string $id
|
||||||
|
* @param string $path
|
||||||
|
* @param type $content
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
protected function create_share($app, $id, &$content)
|
||||||
|
{
|
||||||
// Check if some other process created the share (with custom options)
|
// Check if some other process created the share (with custom options)
|
||||||
// and put it in the session cache for us
|
// and put it in the session cache for us
|
||||||
$path = "$app::$id";
|
$path = "$app::$id";
|
||||||
$session = \EGroupware\Api\Cache::getSession(Api\Sharing::class, $path);
|
$session = \EGroupware\Api\Cache::getSession(Api\Sharing::class, $path);
|
||||||
if($session && $session['share_path'] == $path)
|
if($session && $session['share_path'] == $path)
|
||||||
{
|
{
|
||||||
$share = $session;
|
return $session;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Need to create the share here.
|
// Need to create the share here.
|
||||||
// No way to know here if it should be writable, or who it's going to
|
// No way to know here if it should be writable, or who it's going to
|
||||||
$mode = /* ? ? Sharing::WRITABLE :*/ Api\Sharing::READONLY;
|
$mode = /* ? ? Sharing::WRITABLE :*/ Api\Sharing::READONLY;
|
||||||
@ -503,15 +523,7 @@ abstract class Merge
|
|||||||
|
|
||||||
//$extra['share_writable'] |= ($mode == Sharing::WRITABLE ? 1 : 0);
|
//$extra['share_writable'] |= ($mode == Sharing::WRITABLE ? 1 : 0);
|
||||||
|
|
||||||
$share = \EGroupware\Stylite\Link\Sharing::create($path, $mode, NULL, $recipients, $extra);
|
return \EGroupware\Stylite\Link\Sharing::create($path, $mode, NULL, $recipients, $extra);
|
||||||
}
|
|
||||||
|
|
||||||
if($share)
|
|
||||||
{
|
|
||||||
$replacements['$$'.$prefix.'share$$'] = $link = Api\Sharing::share2link($share);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $replacements;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user