当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_User::setDisplayName方法代码示例

本文整理汇总了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();
 }
开发者ID:Romua1d,项目名称:core,代码行数:34,代码来源:cache.php

示例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();
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:40,代码来源:cache.php

示例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))));
}
开发者ID:rajeshpillai,项目名称:core,代码行数:31,代码来源:changedisplayname.php

示例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);
 }
开发者ID:AARNet,项目名称:user_saml,代码行数:9,代码来源:hooks.php

示例5: update_display_name

function update_display_name($uid, $displayName)
{
    OC_User::setDisplayName($uid, $displayName);
}
开发者ID:fproject,项目名称:apps,代码行数:4,代码来源:hooks.php


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