本文整理汇总了PHP中OCP\App\IAppManager::isEnabledForUser方法的典型用法代码示例。如果您正苦于以下问题:PHP IAppManager::isEnabledForUser方法的具体用法?PHP IAppManager::isEnabledForUser怎么用?PHP IAppManager::isEnabledForUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\App\IAppManager
的用法示例。
在下文中一共展示了IAppManager::isEnabledForUser方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forceSingleUserAndTrashbin
/**
* Set single user mode and disable the trashbin app
*/
protected function forceSingleUserAndTrashbin()
{
$this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin');
$this->wasSingleUserModeEnabled = $this->config->getSystemValue('singleuser', false);
$this->config->setSystemValue('singleuser', true);
$this->appManager->disableApp('files_trashbin');
}
示例2: isCertificateImportAllowed
/**
* check if certificate import is allowed
*
* @return bool
*/
protected function isCertificateImportAllowed()
{
$externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
if ($externalStorageEnabled) {
$backends = \OC_Mount_Config::getPersonalBackends();
if (!empty($backends)) {
return true;
}
}
return false;
}
示例3: __construct
/**
* @param IManager $encryptionManager
* @param IAppManager $appManager
* @param IConfig $config
* @param QuestionHelper $questionHelper
*/
public function __construct(IManager $encryptionManager, IAppManager $appManager, IConfig $config, QuestionHelper $questionHelper)
{
parent::__construct();
$this->appManager = $appManager;
$this->encryptionManager = $encryptionManager;
$this->config = $config;
$this->questionHelper = $questionHelper;
$this->wasTrashbinEnabled = $this->appManager->isEnabledForUser('files_trashbin');
$this->wasSingleUserModeEnabled = $this->config->getSystemValue('singleuser', false);
$this->config->setSystemValue('singleuser', true);
$this->appManager->disableApp('files_trashbin');
}
示例4: isSharingEnabled
/**
* Check whether sharing is enabled
* @return bool
*/
private function isSharingEnabled()
{
// FIXME: This check is done here since the route is globally defined and not inside the files_sharing app
// Check whether the sharing application is enabled
if (!$this->appManager->isEnabledForUser($this->appName)) {
return false;
}
// Check whether public sharing is enabled
if ($this->config->getAppValue('core', 'shareapi_allow_links', 'yes') !== 'yes') {
return false;
}
return true;
}
示例5: buildProviderList
/**
* @return \OCP\AppFramework\Http\JSONResponse
*/
public function buildProviderList()
{
$services = ['version' => 2, 'PRIVATE_DATA' => ['version' => 1, 'endpoints' => ['store' => '/ocs/v2.php/privatedata/setattribute', 'read' => '/ocs/v2.php/privatedata/getattribute', 'delete' => '/ocs/v2.php/privatedata/deleteattribute']]];
if ($this->appManager->isEnabledForUser('files_sharing')) {
$services['SHARING'] = ['version' => 1, 'endpoints' => ['share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares']];
$services['FEDERATED_SHARING'] = ['version' => 1, 'endpoints' => ['share' => '/ocs/v2.php/cloud/shares', 'webdav' => '/public.php/webdav/']];
}
if ($this->appManager->isEnabledForUser('activity')) {
$services['ACTIVITY'] = ['version' => 1, 'endpoints' => ['list' => '/ocs/v2.php/cloud/activity']];
}
if ($this->appManager->isEnabledForUser('provisioning_api')) {
$services['PROVISIONING'] = ['version' => 1, 'endpoints' => ['user' => '/ocs/v2.php/cloud/users', 'groups' => '/ocs/v2.php/cloud/groups', 'apps' => '/ocs/v2.php/cloud/apps']];
}
return new \OCP\AppFramework\Http\JSONResponse($services);
}
示例6: showFile
/**
* Redirects to the file list and highlight the given file id
*
* @param string $fileId file id to show
* @return RedirectResponse redirect response or not found response
* @throws \OCP\Files\NotFoundException
*
* @NoCSRFRequired
* @NoAdminRequired
*/
public function showFile($fileId)
{
$uid = $this->userSession->getUser()->getUID();
$baseFolder = $this->rootFolder->get($uid . '/files/');
$files = $baseFolder->getById($fileId);
$params = [];
if (empty($files) && $this->appManager->isEnabledForUser('files_trashbin')) {
$baseFolder = $this->rootFolder->get($uid . '/files_trashbin/files/');
$files = $baseFolder->getById($fileId);
$params['view'] = 'trashbin';
}
if (!empty($files)) {
$file = current($files);
if ($file instanceof Folder) {
// set the full path to enter the folder
$params['dir'] = $baseFolder->getRelativePath($file->getPath());
} else {
// set parent path as dir
$params['dir'] = $baseFolder->getRelativePath($file->getParent()->getPath());
// and scroll to the entry
$params['scrollto'] = $file->getName();
}
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index', $params));
}
throw new \OCP\Files\NotFoundException();
}
示例7: testIsEnabledForUserLoggedIn
public function testIsEnabledForUserLoggedIn()
{
$user = new User('user1', null);
$this->userSession->expects($this->once())->method('getUser')->will($this->returnValue($user));
$this->groupManager->expects($this->once())->method('getUserGroupIds')->with($user)->will($this->returnValue(array('foo', 'bar')));
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertTrue($this->manager->isEnabledForUser('test'));
}
示例8: isSharingEnabled
/**
* Check whether sharing is enabled
* @return bool
*/
private function isSharingEnabled()
{
// FIXME: This check is done here since the route is globally defined and not inside the files_sharing app
// Check whether the sharing application is enabled
if (!$this->appManager->isEnabledForUser($this->appName)) {
return false;
}
return true;
}
示例9: isCertificateImportAllowed
/**
* check if certificate import is allowed
*
* @return bool
*/
protected function isCertificateImportAllowed()
{
$externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
if ($externalStorageEnabled) {
$backendService = \OC_Mount_Config::$app->getContainer()->query('OCA\\Files_External\\Service\\BackendService');
if ($backendService->getBackendsVisibleFor(\OCA\Files_External\Service\BackendService::VISIBILITY_PERSONAL)) {
return true;
}
}
return false;
}
示例10: isCertificateImportAllowed
/**
* check if certificate import is allowed
*
* @return bool
*/
protected function isCertificateImportAllowed()
{
$externalStorageEnabled = $this->appManager->isEnabledForUser('files_external');
if ($externalStorageEnabled) {
/** @var \OCA\Files_External\Service\BackendService $backendService */
$backendService = \OC_Mount_Config::$app->getContainer()->query('\\OCA\\Files_External\\Service\\BackendService');
if ($backendService->isUserMountingAllowed()) {
return true;
}
}
return false;
}
示例11: __construct
/**
* @param string $appName
* @param IRequest $request
* @param IUserManager $userManager
* @param IGroupManager $groupManager
* @param IUserSession $userSession
* @param IConfig $config
* @param bool $isAdmin
* @param IL10N $l10n
* @param ILogger $log
* @param \OC_Defaults $defaults
* @param IMailer $mailer
* @param string $fromMailAddress
* @param IURLGenerator $urlGenerator
* @param IAppManager $appManager
*/
public function __construct($appName, IRequest $request, IUserManager $userManager, IGroupManager $groupManager, IUserSession $userSession, IConfig $config, $isAdmin, IL10N $l10n, ILogger $log, \OC_Defaults $defaults, IMailer $mailer, $fromMailAddress, IURLGenerator $urlGenerator, IAppManager $appManager)
{
parent::__construct($appName, $request);
$this->userManager = $userManager;
$this->groupManager = $groupManager;
$this->userSession = $userSession;
$this->config = $config;
$this->isAdmin = $isAdmin;
$this->l10n = $l10n;
$this->log = $log;
$this->defaults = $defaults;
$this->mailer = $mailer;
$this->fromMailAddress = $fromMailAddress;
$this->urlGenerator = $urlGenerator;
// check for encryption state - TODO see formatUserForIndex
$this->isEncryptionAppEnabled = $appManager->isEnabledForUser('encryption');
if ($this->isEncryptionAppEnabled) {
// putting this directly in empty is possible in PHP 5.5+
$result = $config->getAppValue('encryption', 'recoveryAdminEnabled', 0);
$this->isRestoreEnabled = !empty($result);
}
}
示例12: checkAppEnabled
/**
* This method is called before any HTTP after auth and checks if the user has access to the app
*
* @throws \Sabre\DAV\Exception\Forbidden
* @return bool
*/
public function checkAppEnabled()
{
if (!$this->appManager->isEnabledForUser($this->app)) {
throw new Forbidden();
}
}