本文整理汇总了PHP中OC_User::setDisplayName方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_User::setDisplayName方法的具体用法?PHP OC_User::setDisplayName怎么用?PHP OC_User::setDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_User
的用法示例。
在下文中一共展示了OC_User::setDisplayName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
function setUp()
{
parent::setUp();
\OC_User::setDisplayName(self::TEST_FILES_SHARING_API_USER1, 'User One');
\OC_User::setDisplayName(self::TEST_FILES_SHARING_API_USER2, 'User Two');
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$this->user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
// prepare user1's dir structure
$this->view->mkdir('container');
$this->view->mkdir('container/shareddir');
$this->view->mkdir('container/shareddir/subdir');
$this->view->mkdir('container/shareddir/emptydir');
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$this->view->file_put_contents('container/not shared.txt', $textData);
$this->view->file_put_contents('container/shared single file.txt', $textData);
$this->view->file_put_contents('container/shareddir/bar.txt', $textData);
$this->view->file_put_contents('container/shareddir/subdir/another.txt', $textData);
$this->view->file_put_contents('container/shareddir/subdir/another too.txt', $textData);
$this->view->file_put_contents('container/shareddir/subdir/not a text file.xml', '<xml></xml>');
list($this->ownerStorage, $internalPath) = $this->view->resolvePath('');
$this->ownerCache = $this->ownerStorage->getCache();
$this->ownerStorage->getScanner()->scan('');
// share "shareddir" with user2
$fileinfo = $this->view->getFileInfo('container/shareddir');
\OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
$fileinfo = $this->view->getFileInfo('container/shared single file.txt');
\OCP\Share::shareItem('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, 31);
// login as user2
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
// retrieve the shared storage
$secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
list($this->sharedStorage, $internalPath) = $secondView->resolvePath('files/shareddir');
$this->sharedCache = $this->sharedStorage->getCache();
}
示例2: setUp
protected function setUp()
{
parent::setUp();
$this->shareManager = \OC::$server->getShareManager();
\OC_User::setDisplayName(self::TEST_FILES_SHARING_API_USER1, 'User One');
\OC_User::setDisplayName(self::TEST_FILES_SHARING_API_USER2, 'User Two');
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
$this->user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
// prepare user1's dir structure
$this->view->mkdir('container');
$this->view->mkdir('container/shareddir');
$this->view->mkdir('container/shareddir/subdir');
$this->view->mkdir('container/shareddir/emptydir');
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$this->view->file_put_contents('container/not shared.txt', $textData);
$this->view->file_put_contents('container/shared single file.txt', $textData);
$this->view->file_put_contents('container/shareddir/bar.txt', $textData);
$this->view->file_put_contents('container/shareddir/subdir/another.txt', $textData);
$this->view->file_put_contents('container/shareddir/subdir/another too.txt', $textData);
$this->view->file_put_contents('container/shareddir/subdir/not a text file.xml', '<xml></xml>');
list($this->ownerStorage, ) = $this->view->resolvePath('');
$this->ownerCache = $this->ownerStorage->getCache();
$this->ownerStorage->getScanner()->scan('');
// share "shareddir" with user2
$rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
$node = $rootFolder->get('container/shareddir');
$share = $this->shareManager->newShare();
$share->setNode($node)->setShareType(\OCP\Share::SHARE_TYPE_USER)->setSharedWith(self::TEST_FILES_SHARING_API_USER2)->setSharedBy(self::TEST_FILES_SHARING_API_USER1)->setPermissions(\OCP\Constants::PERMISSION_ALL);
$this->shareManager->createShare($share);
$node = $rootFolder->get('container/shared single file.txt');
$share = $this->shareManager->newShare();
$share->setNode($node)->setShareType(\OCP\Share::SHARE_TYPE_USER)->setSharedWith(self::TEST_FILES_SHARING_API_USER2)->setSharedBy(self::TEST_FILES_SHARING_API_USER1)->setPermissions(\OCP\Constants::PERMISSION_ALL & ~(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_DELETE));
$this->shareManager->createShare($share);
// login as user2
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
// retrieve the shared storage
$secondView = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2);
list($this->sharedStorage, ) = $secondView->resolvePath('files/shareddir');
$this->sharedCache = $this->sharedStorage->getCache();
}
示例3: isset
OCP\JSON::callCheck();
OC_JSON::checkLoggedIn();
$l = \OC::$server->getL10N('settings');
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
$displayName = (string) $_POST["displayName"];
$userstatus = null;
if (OC_User::isAdminUser(OC_User::getUser())) {
$userstatus = 'admin';
}
$isUserAccessible = false;
$subadminUserObject = \OC::$server->getUserManager()->get(\OC_User::getUser());
$targetUserObject = \OC::$server->getUserManager()->get($username);
if ($subadminUserObject !== null && $targetUserObject !== null) {
$isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($subadminUserObject, $targetUserObject);
}
if ($isUserAccessible) {
$userstatus = 'subadmin';
}
if ($username === OC_User::getUser() && OC_User::canUserChangeDisplayName($username)) {
$userstatus = 'changeOwnDisplayName';
}
if (is_null($userstatus)) {
OC_JSON::error(array("data" => array("message" => $l->t("Authentication error"))));
exit;
}
// Return Success story
if (OC_User::setDisplayName($username, $displayName)) {
OC_JSON::success(array("data" => array("message" => $l->t('Your full name has been changed.'), "username" => $username, 'displayName' => $displayName)));
} else {
OC_JSON::error(array("data" => array("message" => $l->t("Unable to change full name"), 'displayName' => OC_User::getDisplayName($username))));
}
示例4: update_display_name
private static function update_display_name($uid, $displayName)
{
// I inject directly into the database here rather than using the method setDisplayName(),
// which doesn't work. -CB
// because we're using the user_saml backend, and not the default one - see app.php. - FO
//$query = OC_DB::prepare('UPDATE `*PREFIX*users` SET `displayname` = ? WHERE LOWER(`uid`) = ?');
//$query->execute(array($displayName, $uid));
OC_User::setDisplayName($uid, $displayName);
}
示例5: update_display_name
function update_display_name($uid, $displayName)
{
OC_User::setDisplayName($uid, $displayName);
}