feat(sharing): Add `shareapi_allow_custom_tokens` config

Signed-off-by: Christopher Ng <chrng8@gmail.com>
pull/49317/head
Christopher Ng 10 months ago
parent cdc65b6985
commit 8b26383d00
  1. 6
      lib/private/Share20/Manager.php
  2. 8
      lib/public/Share/IManager.php

@ -21,6 +21,7 @@ use OCP\Files\Mount\IShareOwnerlessMount;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\HintException;
use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IDateTimeZone;
use OCP\IGroupManager;
@ -79,6 +80,7 @@ class Manager implements IManager {
private KnownUserService $knownUserService,
private ShareDisableChecker $shareDisableChecker,
private IDateTimeZone $dateTimeZone,
private IAppConfig $appConfig,
) {
$this->l = $this->l10nFactory->get('lib');
// The constructor of LegacyHooks registers the listeners of share events
@ -1906,6 +1908,10 @@ class Manager implements IManager {
return $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_ignore_second_dn', 'no') === 'yes';
}
public function allowCustomTokens(): bool {
return $this->appConfig->getValueBool('core', 'shareapi_allow_custom_tokens', false);
}
public function currentUserCanEnumerateTargetUser(?IUser $currentUser, IUser $targetUser): bool {
if ($this->allowEnumerationFullMatch()) {
return true;

@ -464,6 +464,14 @@ interface IManager {
*/
public function ignoreSecondDisplayName(): bool;
/**
* Check if custom tokens are allowed
*
* @since 31.0.0
*/
public function allowCustomTokens(): bool;
/**
* Check if the current user can enumerate the target user
*

Loading…
Cancel
Save