本文整理汇总了PHP中OCP\IUser::getUID方法的典型用法代码示例。如果您正苦于以下问题:PHP IUser::getUID方法的具体用法?PHP IUser::getUID怎么用?PHP IUser::getUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\IUser
的用法示例。
在下文中一共展示了IUser::getUID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
$connection = \OC::$server->getDatabaseConnection();
$deleteStatement = $connection->prepare('DELETE FROM `*PREFIX*properties`' . ' WHERE `userid` = ?');
$deleteStatement->execute(array($this->user->getUID()));
$deleteStatement->closeCursor();
}
示例2: setRecoveryForUser
/**
* @param $enabled
* @return bool
*/
public function setRecoveryForUser($enabled)
{
$value = $enabled ? '1' : '0';
try {
$this->config->setUserValue($this->user->getUID(), 'encryption', 'recoveryEnabled', $value);
return true;
} catch (PreConditionNotMetException $e) {
return false;
}
}
示例3: 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);
}
示例4: 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 [];
}
}
示例5: 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);
}
示例6: getDirtyMountPoints
/**
* Get all mountpoints we need to update the etag for
*
* @return string[]
*/
protected function getDirtyMountPoints()
{
$dirty = array();
$mountPoints = $this->config->getAppKeys('files_external');
foreach ($mountPoints as $mountPoint) {
if (substr($mountPoint, 0, 1) === '/') {
$updateTime = $this->config->getAppValue('files_external', $mountPoint);
$userTime = $this->config->getUserValue($this->user->getUID(), 'files_external', $mountPoint);
if ($updateTime > $userTime) {
$dirty[] = $mountPoint;
}
}
}
return $dirty;
}
示例7: 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);
}
示例8: 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]);
}
示例9: 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;
});
return array_map(function ($share) use($user, $storageFactory) {
Filesystem::initMountPoints($share['uid_owner']);
// for updating etags for the share owner when we make changes to this share.
$ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']);
// for updating our etags when changes are made to the share from the owners side (probably indirectly by us trough another share)
$this->propagationManager->listenToOwnerChanges($share['uid_owner'], $user->getUID());
return new SharedMount('\\OC\\Files\\Storage\\Shared', '/' . $user->getUID() . '/' . $share['file_target'], array('propagator' => $ownerPropagator, 'share' => $share, 'user' => $user->getUID()), $storageFactory);
}, $shares);
}
示例10: testShowHiddenFiles
public function testShowHiddenFiles()
{
$show = false;
$this->config->expects($this->once())->method('setUserValue')->with($this->user->getUID(), 'files', 'show_hidden', $show);
$expected = new Http\Response();
$actual = $this->apiController->showHiddenFiles($show);
$this->assertEquals($expected, $actual);
}
示例11: 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);
}
示例12: __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;
}
示例13: 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();
}
示例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));
// filter out excluded shares and group shares that includes self
$shares = array_filter($shares, function (\OCP\Share\IShare $share) use($user) {
return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID();
});
$mounts = [];
foreach ($shares as $share) {
try {
$mounts[] = new SharedMount('\\OC\\Files\\Storage\\Shared', $mounts, ['user' => $user->getUID(), 'newShare' => $share], $storageFactory);
} catch (\Exception $e) {
$this->logger->logException($e);
$this->logger->error('Error while trying to create shared mount');
}
}
// array_filter removes the null values from the array
return array_filter($mounts);
}
示例15: createKeyPair
/**
* create new private/public key-pair for user
*
* @return array|bool
*/
public function createKeyPair()
{
$log = $this->logger;
$res = $this->getOpenSSLPKey();
if (!$res) {
$log->error("Encryption Library couldn't generate users key-pair for {$this->user->getUID()}", ['app' => 'encryption']);
if (openssl_error_string()) {
$log->error('Encryption library openssl_pkey_new() fails: ' . openssl_error_string(), ['app' => 'encryption']);
}
} elseif (openssl_pkey_export($res, $privateKey, null, $this->getOpenSSLConfig())) {
$keyDetails = openssl_pkey_get_details($res);
$publicKey = $keyDetails['key'];
return ['publicKey' => $publicKey, 'privateKey' => $privateKey];
}
$log->error('Encryption library couldn\'t export users private key, please check your servers OpenSSL configuration.' . $this->user->getUID(), ['app' => 'encryption']);
if (openssl_error_string()) {
$log->error('Encryption Library:' . openssl_error_string(), ['app' => 'encryption']);
}
return false;
}