本文整理汇总了PHP中OCP\IUser类的典型用法代码示例。如果您正苦于以下问题:PHP IUser类的具体用法?PHP IUser怎么用?PHP IUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IUser类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
parent::setUp();
$this->createUser('userid', 'pass');
$this->loginAsUser('userid');
$app = new Application();
$this->container = $app->getContainer();
$this->container['AppName'] = 'core';
$this->container['AvatarManager'] = $this->getMock('OCP\\IAvatarManager');
$this->container['Cache'] = $this->getMockBuilder('OC\\Cache\\File')->disableOriginalConstructor()->getMock();
$this->container['L10N'] = $this->getMock('OCP\\IL10N');
$this->container['L10N']->method('t')->will($this->returnArgument(0));
$this->container['UserManager'] = $this->getMock('OCP\\IUserManager');
$this->container['UserSession'] = $this->getMock('OCP\\IUserSession');
$this->container['Request'] = $this->getMock('OCP\\IRequest');
$this->container['UserFolder'] = $this->getMock('OCP\\Files\\Folder');
$this->container['Logger'] = $this->getMock('OCP\\ILogger');
$this->avatarMock = $this->getMock('OCP\\IAvatar');
$this->userMock = $this->getMock('OCP\\IUser');
$this->avatarController = $this->container['AvatarController'];
// Configure userMock
$this->userMock->method('getDisplayName')->willReturn('displayName');
$this->userMock->method('getUID')->willReturn('userId');
$this->container['UserManager']->method('get')->willReturnMap([['userId', $this->userMock]]);
$this->container['UserSession']->method('getUser')->willReturn($this->userMock);
$this->avatarFile = $this->getMock('OCP\\Files\\File');
$this->avatarFile->method('getContnet')->willReturn('image data');
$this->avatarFile->method('getMimeType')->willReturn('image type');
$this->avatarFile->method('getEtag')->willReturn('my etag');
}
开发者ID:farukuzun,项目名称:core-1,代码行数:30,代码来源:avatarcontrollertest.php
示例2: onPostRemoveUser
public function onPostRemoveUser(IGroup $group, IUser $targetUser)
{
$targetUserId = $targetUser->getUID();
$sharesAfter = $this->getUserShares($targetUserId);
$this->propagateSharesDiff($targetUserId, $this->userShares[$targetUserId], $sharesAfter);
unset($this->userShares[$targetUserId]);
}
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:7,代码来源:grouppropagationmanager.php
示例3: getHomeMountForUser
/**
* Get the cache mount for a user
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getHomeMountForUser(IUser $user, IStorageFactory $loader)
{
$arguments = ['user' => $user];
if (\OC\Files\Cache\Storage::exists('local::' . $user->getHome() . '/')) {
$arguments['legacy'] = true;
}
return new MountPoint('\\OC\\Files\\Storage\\Home', '/' . $user->getUID(), $arguments, $loader);
}
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:15,代码来源:LocalHomeMountProvider.php
示例4: __construct
/**
* @param IUser $user current user, must match the propagator's
* user
* @param \OC\Files\Cache\ChangePropagator $changePropagator change propagator
* initialized with a view for $user
* @param \OCP\IConfig $config
* @param PropagationManager $manager
* @param IGroupManager $groupManager
*/
public function __construct(IUser $user, $changePropagator, $config, PropagationManager $manager, IGroupManager $groupManager)
{
$this->userId = $user->getUID();
$this->user = $user;
$this->changePropagator = $changePropagator;
$this->config = $config;
$this->manager = $manager;
$this->groupManager = $groupManager;
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:18,代码来源:recipientpropagator.php
示例5: runScanner
/**
* @param IUser $user
*/
protected function runScanner(IUser $user)
{
try {
$scanner = new Scanner($user->getUID(), $this->dbConnection, $this->logger);
$scanner->backgroundScan('');
} catch (\Exception $e) {
$this->logger->logException($e, ['app' => 'files']);
}
\OC_Util::tearDownFS();
}
开发者ID:loulancn,项目名称:core,代码行数:13,代码来源:scanfiles.php
示例6: getNode
public function getNode($isAdmin = true)
{
$this->user = $this->getMock('\\OCP\\IUser');
$this->user->expects($this->any())->method('getUID')->will($this->returnValue('testuser'));
$userSession = $this->getMock('\\OCP\\IUserSession');
$userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
$groupManager = $this->getMock('\\OCP\\IGroupManager');
$groupManager->expects($this->any())->method('isAdmin')->with('testuser')->will($this->returnValue($isAdmin));
return new \OCA\DAV\SystemTag\SystemTagsByIdCollection($this->tagManager, $userSession, $groupManager);
}
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:10,代码来源:SystemTagsByIdCollectionTest.php
示例7: setUp
protected function setUp()
{
$this->shareManager = $this->getMockBuilder('OC\\Share20\\Manager')->disableOriginalConstructor()->getMock();
$this->groupManager = $this->getMock('OCP\\IGroupManager');
$this->userManager = $this->getMock('OCP\\IUserManager');
$this->request = $this->getMock('OCP\\IRequest');
$this->rootFolder = $this->getMock('OCP\\Files\\IRootFolder');
$this->urlGenerator = $this->getMock('OCP\\IURLGenerator');
$this->currentUser = $this->getMock('OCP\\IUser');
$this->currentUser->method('getUID')->willReturn('currentUser');
$this->ocs = new Share20OCS($this->shareManager, $this->groupManager, $this->userManager, $this->request, $this->rootFolder, $this->urlGenerator, $this->currentUser);
}
开发者ID:gcstang,项目名称:core,代码行数:12,代码来源:share20ocstest.php
示例8: getMountsForUser
/**
* Get all mountpoints applicable for the user and check for shares where we need to update the etags
*
* @param \OCP\IUser $user
* @param \OCP\Files\Storage\IStorageFactory $storageFactory
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $storageFactory)
{
$shares = \OCP\Share::getItemsSharedWithUser('file', $user->getUID());
$shares = array_filter($shares, function ($share) {
return $share['permissions'] > 0;
});
$shares = array_map(function ($share) use($user, $storageFactory) {
return new SharedMount('\\OC\\Files\\Storage\\Shared', '/' . $user->getUID() . '/' . $share['file_target'], array('share' => $share, 'user' => $user->getUID()), $storageFactory);
}, $shares);
// array_filter removes the null values from the array
return array_filter($shares);
}
开发者ID:evanjt,项目名称:core,代码行数:19,代码来源:mountprovider.php
示例9: manipulateStorageConfig
public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null)
{
if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) {
$uid = '';
} else {
$uid = $user->getUID();
}
$credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
if (is_array($credentials)) {
$storage->setBackendOption('user', $credentials['user']);
$storage->setBackendOption('password', $credentials['password']);
}
}
开发者ID:farukuzun,项目名称:core-1,代码行数:13,代码来源:globalauth.php
示例10: getMountsForUser
/**
* Get the cache mount for a user
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $loader)
{
$cacheBaseDir = $this->config->getSystemValue('cache_path', '');
if ($cacheBaseDir !== '') {
$cacheDir = rtrim($cacheBaseDir, '/') . '/' . $user->getUID();
if (!file_exists($cacheDir)) {
mkdir($cacheDir, 0770, true);
}
return [new MountPoint('\\OC\\Files\\Storage\\Local', '/' . $user->getUID() . '/cache', ['datadir' => $cacheDir, $loader])];
} else {
return [];
}
}
开发者ID:GitHubUser4234,项目名称:core,代码行数:20,代码来源:CacheMountProvider.php
示例11: runForUser
/**
* @param IUser $user
*/
public function runForUser($user)
{
$principal = 'principals/users/' . $user->getUID();
$calendars = $this->calDavBackend->getCalendarsForUser($principal);
foreach ($calendars as $calendar) {
$objects = $this->calDavBackend->getCalendarObjects($calendar['id']);
foreach ($objects as $object) {
$calObject = $this->calDavBackend->getCalendarObject($calendar['id'], $object['uri']);
$classification = $this->extractClassification($calObject['calendardata']);
$this->calDavBackend->setClassification($object['id'], $classification);
}
}
}
开发者ID:GitHubUser4234,项目名称:core,代码行数:16,代码来源:Classification.php
示例12: manipulateStorageConfig
public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null)
{
if (!isset($user)) {
throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
}
$uid = $user->getUID();
$credentials = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
if (!isset($credentials)) {
throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
}
$storage->setBackendOption('user', $credentials['user']);
$storage->setBackendOption('password', $credentials['password']);
}
开发者ID:farukuzun,项目名称:core-1,代码行数:13,代码来源:logincredentials.php
示例13: prepareStorageConfig
/**
* Process storage ready for mounting
*
* @param StorageConfig $storage
* @param IUser $user
*/
private function prepareStorageConfig(StorageConfig &$storage, IUser $user)
{
foreach ($storage->getBackendOptions() as $option => $value) {
$storage->setBackendOption($option, \OC_Mount_Config::setUserVars($user->getUID(), $value));
}
$objectStore = $storage->getBackendOption('objectstore');
if ($objectStore) {
$objectClass = $objectStore['class'];
$storage->setBackendOption('objectstore', new $objectClass($objectStore));
}
$storage->getAuthMechanism()->manipulateStorageConfig($storage);
$storage->getBackend()->manipulateStorageConfig($storage);
}
开发者ID:GrumpyCrouton,项目名称:core,代码行数:19,代码来源:configadapter.php
示例14: getMountsForUser
/**
* Get all mountpoints applicable for the user and check for shares where we need to update the etags
*
* @param \OCP\IUser $user
* @param \OCP\Files\Storage\IStorageFactory $storageFactory
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $storageFactory)
{
$shares = $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_USER, null, -1);
$shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), \OCP\Share::SHARE_TYPE_GROUP, null, -1));
$shares = array_filter($shares, function (\OCP\Share\IShare $share) {
return $share->getPermissions() > 0;
});
$mounts = [];
foreach ($shares as $share) {
$mounts[] = new SharedMount('\\OC\\Files\\Storage\\Shared', $mounts, ['user' => $user->getUID(), 'newShare' => $share], $storageFactory);
}
// array_filter removes the null values from the array
return array_filter($mounts);
}
开发者ID:stweil,项目名称:owncloud-core,代码行数:21,代码来源:mountprovider.php
示例15: testMergeShares
/**
* Tests merging shares.
*
* Happens when sharing the same entry to a user through multiple ways,
* like several groups and also direct shares at the same time.
*
* @dataProvider mergeSharesDataProvider
*
* @param array $userShares array of user share specs
* @param array $groupShares array of group share specs
* @param array $expectedShares array of expected supershare specs
*/
public function testMergeShares($userShares, $groupShares, $expectedShares)
{
$rootFolder = $this->getMock('\\OCP\\Files\\IRootFolder');
$userManager = $this->getMock('\\OCP\\IUserManager');
$userShares = array_map(function ($shareSpec) {
return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]);
}, $userShares);
$groupShares = array_map(function ($shareSpec) {
return $this->makeMockShare($shareSpec[0], $shareSpec[1], $shareSpec[2], $shareSpec[3], $shareSpec[4]);
}, $groupShares);
$this->user->expects($this->any())->method('getUID')->will($this->returnValue('user1'));
$this->shareManager->expects($this->at(0))->method('getSharedWith')->with('user1', \OCP\Share::SHARE_TYPE_USER)->will($this->returnValue($userShares));
$this->shareManager->expects($this->at(1))->method('getSharedWith')->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1)->will($this->returnValue($groupShares));
$this->shareManager->expects($this->any())->method('newShare')->will($this->returnCallback(function () use($rootFolder, $userManager) {
return new \OC\Share20\Share($rootFolder, $userManager);
}));
$mounts = $this->provider->getMountsForUser($this->user, $this->loader);
$this->assertCount(count($expectedShares), $mounts);
foreach ($mounts as $index => $mount) {
$expectedShare = $expectedShares[$index];
$this->assertInstanceOf('OCA\\Files_Sharing\\SharedMount', $mount);
// supershare
$share = $mount->getShare();
$this->assertEquals($expectedShare[0], $share->getId());
$this->assertEquals($expectedShare[1], $share->getNodeId());
$this->assertEquals($expectedShare[2], $share->getShareOwner());
$this->assertEquals($expectedShare[3], $share->getTarget());
$this->assertEquals($expectedShare[4], $share->getPermissions());
}
}
开发者ID:GitHubUser4234,项目名称:core,代码行数:42,代码来源:MountProviderTest.php
示例16: prepareStorageConfig
/**
* Process storage ready for mounting
*
* @param StorageConfig $storage
* @param IUser $user
*/
private function prepareStorageConfig(StorageConfig &$storage, IUser $user)
{
foreach ($storage->getBackendOptions() as $option => $value) {
$storage->setBackendOption($option, \OC_Mount_Config::setUserVars($user->getUID(), $value));
}
$objectStore = $storage->getBackendOption('objectstore');
if ($objectStore) {
$objectClass = $objectStore['class'];
if (!is_subclass_of($objectClass, '\\OCP\\Files\\ObjectStore\\IObjectStore')) {
throw new \InvalidArgumentException('Invalid object store');
}
$storage->setBackendOption('objectstore', new $objectClass($objectStore));
}
$storage->getAuthMechanism()->manipulateStorageConfig($storage);
$storage->getBackend()->manipulateStorageConfig($storage);
}
开发者ID:hyb148,项目名称:core,代码行数:22,代码来源:configadapter.php
示例17: getMountsForUser
public function getMountsForUser(IUser $user, IStorageFactory $loader)
{
$query = $this->connection->prepare('
SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner`
FROM `*PREFIX*share_external`
WHERE `user` = ? AND `accepted` = ?
');
$query->execute([$user->getUID(), 1]);
$mounts = [];
while ($row = $query->fetch()) {
$row['manager'] = $this;
$row['token'] = $row['share_token'];
$mounts[] = $this->getMount($user, $row, $loader);
}
return $mounts;
}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:16,代码来源:mountprovider.php
示例18: getMountsForUser
/**
* Get all mountpoints applicable for the user and check for shares where we need to update the etags
*
* @param \OCP\IUser $user
* @param \OCP\Files\Storage\IStorageFactory $storageFactory
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $storageFactory)
{
$shares = \OCP\Share::getItemsSharedWithUser('file', $user->getUID());
$propagator = $this->propagationManager->getSharePropagator($user->getUID());
$propagator->propagateDirtyMountPoints($shares);
$shares = array_filter($shares, function ($share) {
return $share['permissions'] > 0;
});
$shares = array_map(function ($share) use($user, $storageFactory) {
// for updating etags for the share owner when we make changes to this share.
$ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']);
return new SharedMount('\\OC\\Files\\Storage\\Shared', '/' . $user->getUID() . '/' . $share['file_target'], array('propagationManager' => $this->propagationManager, 'propagator' => $ownerPropagator, 'share' => $share, 'user' => $user->getUID()), $storageFactory);
}, $shares);
// array_filter removes the null values from the array
return array_filter($shares);
}
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:23,代码来源:mountprovider.php
示例19: setUp
protected function setUp()
{
$this->existingUser = $this->getMockBuilder('OCP\\IUser')->disableOriginalConstructor()->getMock();
$this->existingUser->expects($this->any())->method('getEMailAddress')->willReturn('[email protected]');
$this->config = $this->getMockBuilder('\\OCP\\IConfig')->disableOriginalConstructor()->getMock();
$this->l10n = $this->getMockBuilder('\\OCP\\IL10N')->disableOriginalConstructor()->getMock();
$this->l10n->expects($this->any())->method('t')->will($this->returnCallback(function ($text, $parameters = array()) {
return vsprintf($text, $parameters);
}));
$this->defaults = $this->getMockBuilder('\\OC_Defaults')->disableOriginalConstructor()->getMock();
$this->userManager = $this->getMockBuilder('\\OCP\\IUserManager')->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->getMockBuilder('\\OCP\\IURLGenerator')->disableOriginalConstructor()->getMock();
$this->mailer = $this->getMockBuilder('\\OCP\\Mail\\IMailer')->disableOriginalConstructor()->getMock();
$this->secureRandom = $this->getMockBuilder('\\OCP\\Security\\ISecureRandom')->disableOriginalConstructor()->getMock();
$this->timeFactory = $this->getMockBuilder('\\OCP\\AppFramework\\Utility\\ITimeFactory')->disableOriginalConstructor()->getMock();
$this->request = $this->getMockBuilder('OCP\\IRequest')->disableOriginalConstructor()->getMock();
$this->lostController = new LostController('Core', $this->request, $this->urlGenerator, $this->userManager, $this->defaults, $this->l10n, $this->config, $this->secureRandom, 'lostpassword-noreply@localhost', true, $this->mailer, $this->timeFactory);
}
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:18,代码来源:LostControllerTest.php
示例20: getMountsForUser
/**
* Get all mountpoints applicable for the user
*
* @param \OCP\IUser $user
* @param \OCP\Files\Storage\IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $loader)
{
$mountPoints = \OC_Mount_Config::getAbsoluteMountPoints($user->getUID());
$mounts = array();
foreach ($mountPoints as $mountPoint => $options) {
if (isset($options['options']['objectstore'])) {
$objectClass = $options['options']['objectstore']['class'];
$options['options']['objectstore'] = new $objectClass($options['options']['objectstore']);
}
$mountOptions = isset($options['mountOptions']) ? $options['mountOptions'] : [];
if (isset($options['personal']) && $options['personal']) {
$mounts[] = new PersonalMount($options['class'], $mountPoint, $options['options'], $loader, $mountOptions);
} else {
$mounts[] = new MountPoint($options['class'], $mountPoint, $options['options'], $loader, $mountOptions);
}
}
return $mounts;
}
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:25,代码来源:configadapter.php
注:本文中的OCP\IUser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论