зеркало из https://github.com/nextcloud/guests.git
nc 14 compatibility
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Родитель
791fc01ea5
Коммит
9dcdfac69d
|
@ -9,7 +9,7 @@
|
|||
<licence>AGPL</licence>
|
||||
<author>Nextcloud</author>
|
||||
<dependencies>
|
||||
<nextcloud min-version="12" max-version="14" />
|
||||
<nextcloud min-version="14" max-version="14" />
|
||||
</dependencies>
|
||||
<category>collaboration</category>
|
||||
<types>
|
||||
|
|
|
@ -113,24 +113,31 @@ class Application extends App {
|
|||
\OCP\Util::connectHook('OCP\Share', 'post_shared', $hooks, 'postShareHook');
|
||||
\OCP\Util::connectHook('OC_Filesystem', 'preSetup', $hooks, 'setupReadonlyFilesystem');
|
||||
|
||||
|
||||
$user = $server->getUserSession()->getUser();
|
||||
$userSession = $server->getUserSession();
|
||||
$user = $userSession->getUser();
|
||||
/** @var GuestManager $guestManager */
|
||||
$guestManager = $container->query(GuestManager::class);
|
||||
|
||||
if ($user && $guestManager->isGuest($user)) {
|
||||
/** @var AppWhitelist $whiteList */
|
||||
$whiteList = $container->query(AppWhitelist::class);
|
||||
// if the whitelist is used
|
||||
$whiteList->verifyAccess($user, $server->getRequest());
|
||||
/** @var AppWhitelist $whiteList */
|
||||
$whiteList = $container->query(AppWhitelist::class);
|
||||
|
||||
\OCP\Util::addStyle('guests', 'personal');
|
||||
if ($user) {
|
||||
if ($guestManager->isGuest($user)) {
|
||||
// if the whitelist is used
|
||||
$whiteList->verifyAccess($user, $server->getRequest());
|
||||
|
||||
/** @var NavigationManager $navManager */
|
||||
$navManager = $server->getNavigationManager();
|
||||
\OCP\Util::addStyle('guests', 'personal');
|
||||
|
||||
$server->registerService('NavigationManager', function () use ($navManager, $user, $whiteList) {
|
||||
return new FilteredNavigationManager($user, $navManager, $whiteList);
|
||||
/** @var NavigationManager $navManager */
|
||||
$navManager = $server->getNavigationManager();
|
||||
|
||||
$server->registerService('NavigationManager', function () use ($navManager, $user, $whiteList) {
|
||||
return new FilteredNavigationManager($user, $navManager, $whiteList);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$userSession->listen('\OC\User', 'postLogin', function () use ($userSession, $server, $whiteList) {
|
||||
$whiteList->verifyAccess($userSession->getUser(), $server->getRequest());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class AppWhitelist {
|
|||
return 'files';
|
||||
} else if (substr($url, 0, 8) === '/webdav/') {
|
||||
return 'dav';
|
||||
} else if (substr($url, 0, 12) === '/dav/') {
|
||||
} else if (substr($url, 0, 5) === '/dav/') {
|
||||
return 'dav';
|
||||
} else if (substr($url, 0, 10) === '/settings/') {
|
||||
return 'settings';
|
||||
|
|
|
@ -37,7 +37,7 @@ class FilteredNavigationManager extends NavigationManager {
|
|||
$this->navigationManager = $navigationManager;
|
||||
}
|
||||
|
||||
public function getAll($type = 'link') {
|
||||
public function getAll(string $type = 'link'): array {
|
||||
$items = $this->navigationManager->getAll($type);
|
||||
|
||||
return array_filter($items, [$this, 'isEntryWhitelisted']);
|
||||
|
|
|
@ -117,7 +117,7 @@ class Mail {
|
|||
'files.viewcontroller.showFile', ['fileid' => $itemSource]
|
||||
);
|
||||
|
||||
$emailTemplate = $this->mailer->createEMailTemplate();
|
||||
$emailTemplate = $this->mailer->createEMailTemplate('guest.invite');
|
||||
|
||||
$emailTemplate->addHeader();
|
||||
$emailTemplate->addHeading($this->l10n->t('Incoming share'));
|
||||
|
|
Загрузка…
Ссылка в новой задаче