setIdentifier('\OC\Files\Storage\SMB_OC') ->setStorageClass('\OCA\Files_External\Lib\Storage\SMB') ->setText($l->t('SMB/CIFS using OC login')) ->addParameters([ new DefinitionParameter('host', $l->t('Host')), (new DefinitionParameter('username_as_share', $l->t('Login as share'))) ->setType(DefinitionParameter::VALUE_BOOLEAN), (new DefinitionParameter('share', $l->t('Share'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), (new DefinitionParameter('root', $l->t('Remote subfolder'))) ->setFlag(DefinitionParameter::FLAG_OPTIONAL), ]) ->setPriority(BackendService::PRIORITY_DEFAULT - 10) ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD) ->setLegacyAuthMechanism($legacyAuth) ->deprecateTo($smbBackend) ; } /** * @return void */ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) { $username_as_share = ($storage->getBackendOption('username_as_share') === true); if ($username_as_share) { $share = '/' . $storage->getBackendOption('user'); $storage->setBackendOption('share', $share); } } }