本文整理汇总了PHP中OCP\User::getUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getUsers方法的具体用法?PHP User::getUsers怎么用?PHP User::getUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\User
的用法示例。
在下文中一共展示了User::getUsers方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createInitConvs
private function createInitConvs()
{
$initConvs = array();
$convs = $this->userMapper->findByUser($this->app->getUserId());
$usersAllreadyInConv = array();
foreach ($convs as $conv) {
$users = $this->userMapper->findUsersInConv($conv->getConversationId());
// Find the correct contact for the correct user
$this->messages->setRequestData(array("conv_id" => $conv->getConversationId(), 'user' => $this->app->getCurrentUser(), "limit" => array(0, 30)));
$messages = $this->messages->execute();
$messages = $messages['messages'];
$files = $this->attachmentMapper->findRawByConv($conv->getConversationId());
$initConvs[$conv->getConversationId()] = array("id" => $conv->getConversationId(), "users" => $users, "backend" => "och", "messages" => $messages, "files" => $files);
if (count($users) === 2) {
foreach ($users as $user) {
if ($user !== \OCP\User::getUser()) {
$usersAllreadyInConv[] = $user;
}
}
}
$this->join->setRequestData(array("conv_id" => $conv->getConversationId(), "user" => $this->app->getCurrentUser()));
$this->join->execute();
}
$allUsers = \OCP\User::getUsers();
$users = array_diff($allUsers, $usersAllreadyInConv);
foreach ($users as $user) {
if ($user !== \OCP\User::getUser()) {
$this->startconv->setRequestData(array("user" => $this->app->getCurrentUser(), "user_to_invite" => array($this->app->getUserasContact($user))));
$info = $this->startconv->execute();
$initConvs[$info['conv_id']] = array("id" => $info['conv_id'], "users" => array(\OCP\User::getUser(), $user), "backend" => "och", "messages" => array());
}
}
self::$initConvs = $initConvs;
}
示例2: __construct
public function __construct(ICache $cache, $userId)
{
parent::__construct($cache);
// check if userId is a real ownCloud user
if (!in_array($userId, \OCP\User::getUsers())) {
throw new \Exception('Second argument must be an ownCloud user ID');
}
$this->userId = $userId;
$this->processImage();
}
示例3: getEnabled
/**
* @NoAdminRequired
*/
public function getEnabled()
{
$uids = \OCP\User::getUsers();
$config = \OC::$server->getConfig();
$userValue = $config->getUserValueForUsers('core', 'enabled', $uids);
$max = sizeof($uids);
for ($i = 0; $i < $max; $i++) {
$name = $uids[$i];
$userValue[$name] = !array_key_exists($name, $userValue) || $userValue[$name] == 'true' || empty($userValue[$name]) ? true : false;
}
return new DataResponse($userValue);
}
示例4: reorganizeFolderStructure
/**
* iterate through users and reorganize the folder structure
*/
public function reorganizeFolderStructure()
{
$this->reorganizeSystemFolderStructure();
$limit = 500;
$offset = 0;
do {
$users = \OCP\User::getUsers('', $limit, $offset);
foreach ($users as $user) {
$this->reorganizeFolderStructureForUser($user);
}
$offset += $limit;
} while (count($users) >= $limit);
}
示例5: setRequestData
public function setRequestData(array $requestData)
{
if (empty($requestData['conv_id'])) {
throw new RequestDataInvalid(ApiController::NO_SESSION_ID);
}
if (empty($requestData['user_to_invite'])) {
throw new RequestDataInvalid(ApiController::NO_USER_TO_INVITE);
}
if ($requestData['user']['id'] === $requestData['user_to_invite']) {
throw new RequestDataInvalid(ApiController::USER_EQUAL_TO_USER_TO_INVITE);
}
if (!in_array($requestData['user_to_invite']['id'], \OCP\User::getUsers())) {
throw new RequestDataInvalid(ApiController::USER_TO_INVITE_NOT_OC_USER);
}
$this->requestData = $requestData;
}
示例6: reorganizeFolderStructure
public function reorganizeFolderStructure()
{
$this->createPathForKeys('/files_encryption');
// backup system wide folders
$this->backupSystemWideKeys();
// rename public keys
$this->renamePublicKeys();
// rename system wide mount point
$this->renameFileKeys('', '/files_encryption/keyfiles');
// rename system private keys
$this->renameSystemPrivateKeys();
// delete old system wide folders
$this->view->deleteAll('/public-keys');
$this->view->deleteAll('/owncloud_private_key');
$this->view->deleteAll('/files_encryption/share-keys');
$this->view->deleteAll('/files_encryption/keyfiles');
$users = \OCP\User::getUsers();
foreach ($users as $user) {
// backup all keys
if ($this->backupUserKeys($user)) {
// create new 'key' folder
$this->view->mkdir($user . '/files_encryption/keys');
// rename users private key
$this->renameUsersPrivateKey($user);
// rename file keys
$path = $user . '/files_encryption/keyfiles';
$this->renameFileKeys($user, $path);
$trashPath = $user . '/files_trashbin/keyfiles';
if (\OC_App::isEnabled('files_trashbin') && $this->view->is_dir($trashPath)) {
$this->renameFileKeys($user, $trashPath, true);
$this->view->deleteAll($trashPath);
$this->view->deleteAll($user . '/files_trashbin/share-keys');
}
// delete old folders
$this->deleteOldKeys($user);
}
}
}
示例7: getUserWithAccessToMountPoint
private function getUserWithAccessToMountPoint($users, $groups)
{
$result = array();
if (in_array('all', $users)) {
$result = \OCP\User::getUsers();
} else {
$result = array_merge($result, $users);
foreach ($groups as $group) {
$result = array_merge($result, \OC_Group::usersInGroup($group));
}
}
return $result;
}
示例8: testGetUsersViaAPISearchEmptyResult
public function testGetUsersViaAPISearchEmptyResult()
{
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
$backend = new UserLDAP($access, $this->getMock('\\OCP\\IConfig'));
\OC_User::useBackend($backend);
$result = \OCP\User::getUsers('nix');
$this->assertEquals(0, count($result));
}
示例9: testGetUsersViaAPI
public function testGetUsersViaAPI()
{
$access = $this->getAccessMock();
$this->prepareAccessForGetUsers($access);
$backend = new UserLDAP($access);
\OC_User::useBackend($backend);
$result = \OCP\User::getUsers();
$this->assertEquals(3, count($result));
$result = \OCP\User::getUsers('', 1, 2);
$this->assertEquals(1, count($result));
$result = \OCP\User::getUsers('', 2, 1);
$this->assertEquals(2, count($result));
$result = \OCP\User::getUsers('yo');
$this->assertEquals(2, count($result));
$result = \OCP\User::getUsers('nix');
$this->assertEquals(0, count($result));
}
示例10: foreach
<?php
$installedVersion = OCP\Config::getAppValue('files_versions', 'installed_version');
// move versions to new directory
if (version_compare($installedVersion, '1.0.2', '<')) {
$users = \OCP\User::getUsers();
$datadir = \OCP\Config::getSystemValue('datadirectory') . '/';
foreach ($users as $user) {
$oldPath = $datadir . $user . '/versions';
$newPath = $datadir . $user . '/files_versions';
if (is_dir($oldPath)) {
rename($oldPath, $newPath);
}
}
}
示例11: usersInGroup
/**
* @brief get a list of all users in a group
* @returns array with user ids
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0)
{
if (!$this->enabled) {
return array();
}
$this->groupSearch = $search;
if ($this->connection->isCached('usersInGroup' . $gid)) {
$groupUsers = $this->connection->getFromCache('usersInGroup' . $gid);
if (!empty($this->groupSearch)) {
$groupUsers = array_filter($groupUsers, array($this, 'groupMatchesFilter'));
}
if ($limit == -1) {
$limit = null;
}
return array_slice($groupUsers, $offset, $limit);
}
$groupDN = $this->groupname2dn($gid);
if (!$groupDN) {
$this->connection->writeToCache('usersInGroup' . $gid, array());
return array();
}
$members = $this->readAttribute($groupDN, $this->connection->ldapGroupMemberAssocAttr);
if (!$members) {
$this->connection->writeToCache('usersInGroup' . $gid, array());
return array();
}
$result = array();
$isMemberUid = strtolower($this->connection->ldapGroupMemberAssocAttr) == 'memberuid';
foreach ($members as $member) {
if ($isMemberUid) {
$filter = \OCP\Util::mb_str_replace('%uid', $member, $this->connection->ldapLoginFilter, 'UTF-8');
$ldap_users = $this->fetchListOfUsers($filter, 'dn');
if (count($ldap_users) < 1) {
continue;
}
$result[] = $this->dn2username($ldap_users[0]);
continue;
} else {
if ($ocname = $this->dn2username($member)) {
$result[] = $ocname;
}
}
}
if (!$isMemberUid) {
$result = array_intersect($result, \OCP\User::getUsers());
}
$groupUsers = array_unique($result, SORT_LOCALE_STRING);
$this->connection->writeToCache('usersInGroup' . $gid, $groupUsers);
if (!empty($this->groupSearch)) {
$groupUsers = array_filter($groupUsers, array($this, 'groupMatchesFilter'));
}
if ($limit == -1) {
$limit = null;
}
return array_slice($groupUsers, $offset, $limit);
}