• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP OCP\IUserSession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OCP\IUserSession的典型用法代码示例。如果您正苦于以下问题:PHP IUserSession类的具体用法?PHP IUserSession怎么用?PHP IUserSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IUserSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param ILogger $logger
  * @param IUserSession $userSession
  * @param IConfig $config
  */
 public function __construct(ILogger $logger, IUserSession $userSession, IConfig $config)
 {
     $this->logger = $logger;
     $this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser() : false;
     $this->config = $config;
     $this->supportedKeyFormats = ['hash', 'password'];
 }
开发者ID:rosarion,项目名称:core,代码行数:12,代码来源:crypt.php


示例2: testTagManagerWithoutUserReturnsNull

 public function testTagManagerWithoutUserReturnsNull()
 {
     $this->userSession = $this->getMock('\\OCP\\IUserSession');
     $this->userSession->expects($this->any())->method('getUser')->will($this->returnValue(null));
     $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
     $this->assertNull($this->tagMgr->load($this->objectType));
 }
开发者ID:evanjt,项目名称:core,代码行数:7,代码来源:tags.php


示例3: __construct

 /**
  * @param ILogger $logger
  * @param IUserSession $userSession
  * @param Crypt $crypt
  * @param KeyManager $keyManager
  */
 public function __construct(ILogger $logger, IUserSession $userSession, Crypt $crypt, KeyManager $keyManager)
 {
     $this->logger = $logger;
     $this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
     $this->crypt = $crypt;
     $this->keyManager = $keyManager;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:13,代码来源:Setup.php


示例4: __construct

 /**
  * constructor of the controller
  *
  * @param string $appName
  * @param IRequest $request
  * @param ILogger $logger
  * @param IUserSession $userSession
  * @param CurrentUserSettings $userSettings
  */
 public function __construct($appName, IRequest $request, ILogger $logger, IUserSession $userSession, CurrentUserSettings $userSettings)
 {
     parent::__construct($appName, $request);
     $this->logger = $logger;
     $this->user = $userSession->getUser();
     $this->userSettings = $userSettings;
 }
开发者ID:pigulla,项目名称:owncloud-sipgate,代码行数:16,代码来源:personalsettingscontroller.php


示例5: __construct

 /**
  * Util constructor.
  *
  * @param View $files
  * @param Crypt $crypt
  * @param ILogger $logger
  * @param IUserSession $userSession
  * @param IConfig $config
  */
 public function __construct(View $files, Crypt $crypt, ILogger $logger, IUserSession $userSession, IConfig $config)
 {
     $this->files = $files;
     $this->crypt = $crypt;
     $this->logger = $logger;
     $this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser() : false;
     $this->config = $config;
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:17,代码来源:util.php


示例6: __construct

 /**
  * @param ILogger $logger
  * @param IUserSession $userSession
  * @param IConfig $config
  * @param IL10N $l
  */
 public function __construct(ILogger $logger, IUserSession $userSession, IConfig $config, IL10N $l)
 {
     $this->logger = $logger;
     $this->user = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : '"no user given"';
     $this->config = $config;
     $this->l = $l;
     $this->supportedKeyFormats = ['hash', 'password'];
 }
开发者ID:gvde,项目名称:core,代码行数:14,代码来源:crypt.php


示例7: __construct

 /**
  * @param \Sabre\DAV\Tree $tree tree
  * @param IUserSession $userSession user session
  * @param \OCP\Files\Folder $userFolder user home folder
  * @param \OCP\Share\IManager $shareManager share manager
  */
 public function __construct(\Sabre\DAV\Tree $tree, IUserSession $userSession, \OCP\Files\Folder $userFolder, \OCP\Share\IManager $shareManager)
 {
     $this->tree = $tree;
     $this->shareManager = $shareManager;
     $this->userFolder = $userFolder;
     $this->userId = $userSession->getUser()->getUID();
     $this->cachedShareTypes = [];
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:14,代码来源:SharesPlugin.php


示例8: getCurrentUser

 /**
  * @param IUserSession $session
  * @return string
  */
 protected function getCurrentUser(IUserSession $session)
 {
     $user = $session->getUser();
     if ($user instanceof IUser) {
         $user = $user->getUID();
     }
     return (string) $user;
 }
开发者ID:drognisep,项目名称:Portfolio-Site,代码行数:12,代码来源:Application.php


示例9: __construct

 public function __construct($AppName, IRequest $request, IUserSession $session, IConfig $settings)
 {
     parent::__construct($AppName, $request);
     $this->request = $request;
     $this->current_user = $session->getUser()->getUID();
     $this->content = array();
     $this->settings = $settings;
     $this->app = $AppName;
 }
开发者ID:camilasan,项目名称:popcornapp,代码行数:9,代码来源:mltcontroller.php


示例10: __construct

 /**
  * @param IUserSession $user
  * @param Crypt $crypt
  * @param ISecureRandom $random
  * @param KeyManager $keyManager
  * @param IConfig $config
  * @param IStorage $keyStorage
  * @param IFile $file
  * @param View $view
  */
 public function __construct(IUserSession $user, Crypt $crypt, ISecureRandom $random, KeyManager $keyManager, IConfig $config, IStorage $keyStorage, IFile $file, View $view)
 {
     $this->user = $user && $user->isLoggedIn() ? $user->getUser() : false;
     $this->crypt = $crypt;
     $this->random = $random;
     $this->keyManager = $keyManager;
     $this->config = $config;
     $this->keyStorage = $keyStorage;
     $this->view = $view;
     $this->file = $file;
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:21,代码来源:Recovery.php


示例11: isEnabledForUser

 /**
  * Check if an app is enabled for user
  *
  * @param string $appId
  * @param \OCP\IUser $user (optional) if not defined, the currently logged in user will be used
  * @return bool
  */
 public function isEnabledForUser($appId, $user = null)
 {
     if (is_null($user)) {
         $user = $this->userSession->getUser();
     }
     $installedApps = $this->getInstalledApps();
     if (isset($installedApps[$appId])) {
         $enabled = $installedApps[$appId];
         if ($enabled === 'yes') {
             return true;
         } elseif (is_null($user)) {
             return false;
         } else {
             $groupIds = json_decode($enabled);
             $userGroups = $this->groupManager->getUserGroupIds($user);
             foreach ($userGroups as $groupId) {
                 if (array_search($groupId, $groupIds) !== false) {
                     return true;
                 }
             }
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:33,代码来源:appmanager.php


示例12: updatePrivateKeyPassword

 /**
  * @NoAdminRequired
  * @UseSession
  *
  * @param string $oldPassword
  * @param string $newPassword
  * @return DataResponse
  */
 public function updatePrivateKeyPassword($oldPassword, $newPassword)
 {
     $result = false;
     $uid = $this->userSession->getUser()->getUID();
     $errorMessage = $this->l->t('Could not update the private key password.');
     //check if password is correct
     $passwordCorrect = $this->userManager->checkPassword($uid, $newPassword);
     if ($passwordCorrect !== false) {
         $encryptedKey = $this->keyManager->getPrivateKey($uid);
         $decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword);
         if ($decryptedKey) {
             $encryptedKey = $this->crypt->symmetricEncryptFileContent($decryptedKey, $newPassword);
             $header = $this->crypt->generateHeader();
             if ($encryptedKey) {
                 $this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
                 $this->session->setPrivateKey($decryptedKey);
                 $result = true;
             }
         } else {
             $errorMessage = $this->l->t('The old password was not correct, please try again.');
         }
     } else {
         $errorMessage = $this->l->t('The current log-in password was not correct, please try again.');
     }
     if ($result === true) {
         $this->session->setStatus(Session::INIT_SUCCESSFUL);
         return new DataResponse(['message' => (string) $this->l->t('Private key password successfully updated.')]);
     } else {
         return new DataResponse(['message' => (string) $errorMessage], Http::STATUS_BAD_REQUEST);
     }
 }
开发者ID:samj1912,项目名称:repo,代码行数:39,代码来源:settingscontroller.php


示例13: getGroup

 /**
  * returns an array of users in the group specified
  *
  * @param array $parameters
  * @return OC_OCS_Result
  */
 public function getGroup($parameters)
 {
     // Check if user is logged in
     $user = $this->userSession->getUser();
     if ($user === null) {
         return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED);
     }
     $groupId = $parameters['groupid'];
     // Check the group exists
     if (!$this->groupManager->groupExists($groupId)) {
         return new OC_OCS_Result(null, \OCP\API::RESPOND_NOT_FOUND, 'The requested group could not be found');
     }
     $isSubadminOfGroup = false;
     $group = $this->groupManager->get($groupId);
     if ($group !== null) {
         $isSubadminOfGroup = $this->groupManager->getSubAdmin()->isSubAdminofGroup($user, $group);
     }
     // Check subadmin has access to this group
     if ($this->groupManager->isAdmin($user->getUID()) || $isSubadminOfGroup) {
         $users = $this->groupManager->get($groupId)->getUsers();
         $users = array_map(function ($user) {
             /** @var IUser $user */
             return $user->getUID();
         }, $users);
         $users = array_values($users);
         return new OC_OCS_Result(['users' => $users]);
     } else {
         return new OC_OCS_Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'User does not have access to specified group');
     }
 }
开发者ID:kenwi,项目名称:core,代码行数:36,代码来源:groups.php


示例14: getUser

 /**
  * @return IUser|null
  */
 protected function getUser()
 {
     if ($this->user) {
         return $this->user;
     }
     return $this->userSession->getUser();
 }
开发者ID:evanjt,项目名称:core,代码行数:10,代码来源:usertrait.php


示例15: load

 /**
  * Create a new \OCP\ITags instance and load tags from db.
  *
  * @see \OCP\ITags
  * @param string $type The type identifier e.g. 'contact' or 'event'.
  * @param array $defaultTags An array of default tags to be used if none are stored.
  * @param boolean $includeShared Whether to include tags for items shared with this user by others.
  * @param string $userId user for which to retrieve the tags, defaults to the currently
  * logged in user
  * @return \OCP\ITags
  */
 public function load($type, $defaultTags = array(), $includeShared = false, $userId = null)
 {
     if (is_null($userId)) {
         $userId = $this->userSession->getUser()->getUId();
     }
     return new Tags($this->mapper, $userId, $type, $defaultTags, $includeShared);
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:18,代码来源:tagmanager.php


示例16: index

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  *
  * @return TemplateResponse
  */
 public function index()
 {
     $userId = $this->userSession->getUser()->getUID();
     $appVersion = $this->config->getAppValue($this->appName, 'installed_version');
     $defaultView = $this->config->getUserValue($userId, $this->appName, 'currentView', 'month');
     return new TemplateResponse('calendar', 'main', ['appVersion' => $appVersion, 'defaultView' => $defaultView]);
 }
开发者ID:dominicrico,项目名称:calendar-rework,代码行数:13,代码来源:viewcontroller.php


示例17: getFilesByTag

 /**
  * Updates the tags of the specified file path.
  * The passed tags are absolute, which means they will
  * replace the actual tag selection.
  *
  * @param array $tagName tag name to filter by
  * @return FileInfo[] list of matching files
  * @throws \Exception if the tag does not exist
  */
 public function getFilesByTag($tagName)
 {
     $nodes = $this->homeFolder->searchByTag($tagName, $this->userSession->getUser()->getUId());
     foreach ($nodes as &$node) {
         $node = $node->getFileInfo();
     }
     return $nodes;
 }
开发者ID:riso,项目名称:owncloud-core,代码行数:17,代码来源:tagservice.php


示例18: isAdmin

 /**
  * Returns whether the currently logged in user is an administrator
  */
 private function isAdmin()
 {
     $user = $this->userSession->getUser();
     if ($user !== null) {
         return $this->groupManager->isAdmin($user->getUID());
     }
     return false;
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:11,代码来源:systemtagsbyidcollection.php


示例19: index

 /**
  * @NoAdminRequired
  *
  * @param string $pattern
  * @param bool $filterGroups
  * @return DataResponse
  */
 public function index($pattern = '', $filterGroups = false)
 {
     $groupPattern = $filterGroups ? $pattern : '';
     $groupsInfo = new \OC\Group\MetaData($this->userSession->getUser()->getUID(), $this->isAdmin, $this->groupManager);
     $groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
     list($adminGroups, $groups) = $groupsInfo->get($groupPattern, $pattern);
     return new DataResponse(array('data' => array('adminGroups' => $adminGroups, 'groups' => $groups)));
 }
开发者ID:heldernl,项目名称:owncloud8-extended,代码行数:15,代码来源:groupscontroller.php


示例20: testImpersonate

 /**
  * @dataProvider usersProvider
  * @param $query
  * @param $uid
  */
 public function testImpersonate($query, $uid)
 {
     $user = $this->getMock('\\OCP\\IUser');
     $user->expects($this->once())->method('getUID')->will($this->returnValue($uid));
     $this->userManager->expects($this->once())->method('search')->with($query, 1, 0)->will($this->returnValue([$user]));
     $this->userSession->expects($this->once())->method('setUser')->with($user);
     $this->assertEquals(new JSONResponse(), $this->controller->impersonate($query));
 }
开发者ID:AARNet,项目名称:impersonate,代码行数:13,代码来源:settingscontrollertest.php



注:本文中的OCP\IUserSession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP OCP\JSON类代码示例发布时间:2022-05-23
下一篇:
PHP OCP\IUserManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap