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


PHP OC_User类代码示例

本文整理汇总了PHP中OC_User的典型用法代码示例。如果您正苦于以下问题:PHP OC_User类的具体用法?PHP OC_User怎么用?PHP OC_User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OC_User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 public function tearDown()
 {
     $u = new OC_User();
     foreach ($this->users as $user) {
         $u->deleteUser($user);
     }
     foreach ($this->tmpfiles as $file) {
         \OC_Helper::rmdirr($file);
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:10,代码来源:migrate.php

示例2: authenticate

 public function authenticate(Sabre_DAV_Server $server, $realm)
 {
     $config = array("introspectionEndpoint" => $this->introspectionEndpoint, "realm" => $realm);
     try {
         $resourceServer = new RemoteResourceServer($config);
         $tokenIntrospection = $resourceServer->verifyRequest(apache_request_headers(), $_GET);
         $this->currentUser = $tokenIntrospection->getSub();
         OC_User::setUserid($this->currentUser);
         OC_Util::setupFS($this->currentUser);
         return true;
     } catch (RemoteResourceServerException $e) {
         switch ($e->getMessage()) {
             case "insufficient_entitlement":
             case "insufficient_scope":
                 $server->httpResponse->setHeader('WWW-Authenticate', $e->getAuthenticateHeader());
                 throw new Sabre_DAV_Exception_Forbidden($e->getDescription());
             case "invalid_request":
                 throw new Sabre_DAV_Exception_NotAuthenticated($e->getDescription());
             case "invalid_token":
             case "no_token":
                 $server->httpResponse->setHeader('WWW-Authenticate', $e->getAuthenticateHeader());
                 throw new Sabre_DAV_Exception_NotAuthenticated($e->getDescription());
             case "internal_server_error":
                 throw new Sabre_DAV_Exception($e->getDescription());
         }
     }
 }
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:27,代码来源:OC_Connector_Sabre_OAuth.php

示例3: __construct

 public function __construct($AppName, IRequest $Request, $CurrentUID, IL10N $L10N)
 {
     parent::__construct($AppName, $Request);
     $this->CurrentUID = $CurrentUID;
     $this->L10N = $L10N;
     if (strcmp(Config::getSystemValue('dbtype'), 'pgsql') == 0) {
         $this->DbType = 1;
     }
     $this->CanCheckForUpdate = Tools::CanCheckForUpdate();
     $this->Settings = new Settings();
     $this->Settings->SetKey('WhichDownloader');
     $this->WhichDownloader = $this->Settings->GetValue();
     $this->WhichDownloader = is_null($this->WhichDownloader) ? 'ARIA2' : $this->WhichDownloader;
     $this->Settings->SetKey('AllowProtocolHTTP');
     $this->AllowProtocolHTTP = $this->Settings->GetValue();
     $this->AllowProtocolHTTP = is_null($this->AllowProtocolHTTP) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolHTTP, 'Y') == 0;
     $this->Settings->SetKey('AllowProtocolFTP');
     $this->AllowProtocolFTP = $this->Settings->GetValue();
     $this->AllowProtocolFTP = is_null($this->AllowProtocolFTP) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolFTP, 'Y') == 0;
     $this->Settings->SetKey('AllowProtocolYT');
     $this->AllowProtocolYT = $this->Settings->GetValue();
     $this->AllowProtocolYT = is_null($this->AllowProtocolYT) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolYT, 'Y') == 0;
     $this->Settings->SetKey('AllowProtocolBT');
     $this->AllowProtocolBT = $this->Settings->GetValue();
     $this->AllowProtocolBT = is_null($this->AllowProtocolBT) || \OC_User::isAdminUser($this->CurrentUID) ? true : strcmp($this->AllowProtocolBT, 'Y') == 0;
 }
开发者ID:venjek,项目名称:ocdownloader,代码行数:26,代码来源:index.php

示例4: register

 public function register()
 {
     $loginRecord = function ($user) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('core', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:login success", Util::INFO);
     };
     $logoutRecord = function () {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('core', "user:" . User::getDisplayName() . " role:" . $this->UserRole . " action:logout success", Util::INFO);
     };
     $createRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:creates " . $node->getName() . " success", Util::INFO);
     };
     $deleteRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:deletes " . $node->getName() . " success", Util::INFO);
     };
     $renameRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:renames " . $node->getName() . " success", Util::INFO);
     };
     $touchRecord = function ($node) {
         $UserRole = \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), "settings", "role", "undefined");
         Util::writeLog('activity', "user:" . User::getDisplayName() . " role:" . $UserRole . " action:touches " . $node->getName() . " success", Util::INFO);
     };
     Util::connectHook('OCP\\Share', 'post_shared', 'OCA\\Activity_Logging\\UserHooks', 'share');
     $this->userManager->listen('\\OC\\User', 'postLogin', $loginRecord);
     $this->userManager->listen('\\OC\\User', 'logout', $logoutRecord);
     $this->UserFolder->listen('\\OC\\Files', 'postCreate', $createRecord);
     $this->UserFolder->listen('\\OC\\Files', 'postDelete', $deleteRecord);
     $this->UserFolder->listen('\\OC\\Files', 'postRename', $renameRecord);
 }
开发者ID:inwinstack,项目名称:owncloud-activity_logging,代码行数:33,代码来源:userhooks.php

示例5: testBasic

 function testBasic()
 {
     $uid = uniqid();
     $this->assertEquals(OC_Calendar_Calendar::allCalendars($uid), array());
     OC_User::setUserId($uid);
     $calId1 = OC_Calendar_Calendar::addCalendar($uid, 'test');
     $all = OC_Calendar_Calendar::allCalendars($uid);
     $this->assertEquals(count($all), 1);
     $this->assertEquals($all[0]['id'], $calId1);
     $this->assertEquals($all[0]['displayname'], 'test');
     $this->assertEquals($all[0]['uri'], 'test');
     $this->assertEquals($uid, $all[0]['userid']);
     $calId2 = OC_Calendar_Calendar::addCalendar($uid, 'test');
     $this->assertNotEquals($calId1, $calId2);
     $all = OC_Calendar_Calendar::allCalendars($uid);
     $this->assertEquals(count($all), 2);
     $this->assertEquals($all[1]['id'], $calId2);
     $this->assertEquals($all[1]['displayname'], 'test');
     $this->assertEquals($all[1]['uri'], 'test1');
     //$cal1=OC_Calendar_Calendar::find($calId1);
     //$this->assertEquals($cal1,$all[0]);
     OC_Calendar_Calendar::deleteCalendar($calId1);
     OC_Calendar_Calendar::deleteCalendar($calId2);
     $this->assertEquals(OC_Calendar_Calendar::allCalendars($uid), array());
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:25,代码来源:calendar.php

示例6: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     // cleanup test user
     \OC_User::deleteUser(self::TEST_ENCRYPTION_TRASHBIN_USER1);
     \OC\Files\Filesystem::getLoader()->removeStorageWrapper('oc_trashbin');
     parent::tearDownAfterClass();
 }
开发者ID:samj1912,项目名称:repo,代码行数:7,代码来源:trashbin.php

示例7: usersInGroup

 public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0)
 {
     if ($gid !== self::GroupName) {
         return array();
     }
     return \OC_User::getUsers($search, $limit, $offset);
 }
开发者ID:RomanKreisel,项目名称:group_everyone,代码行数:7,代码来源:app.php

示例8: getUserLang

 /**
  * Gets the language of the user, including anonymous 
  *
  * @return The user language
  */
 public static function getUserLang()
 {
     $config = \OC::$server->getConfig();
     $lang = \OC_L10N::findLanguage();
     $userLang = $config->getUserValue(\OC_User::getUser(), 'core', 'lang', $lang);
     return $userLang;
 }
开发者ID:RepoHell,项目名称:agreedisclaimer,代码行数:12,代码来源:utils.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     if (!getenv('RUN_OBJECTSTORE_TESTS')) {
         $this->markTestSkipped('objectstore tests are unreliable in some environments');
     }
     // reset backend
     \OC_User::clearBackends();
     \OC_User::useBackend('database');
     // create users
     $users = array('test');
     foreach ($users as $userName) {
         $user = \OC::$server->getUserManager()->get($userName);
         if ($user !== null) {
             $user->delete();
         }
         \OC::$server->getUserManager()->createUser($userName, $userName);
     }
     // main test user
     \OC_Util::tearDownFS();
     \OC_User::setUserId('');
     \OC\Files\Filesystem::tearDown();
     \OC_User::setUserId('test');
     $config = \OC::$server->getConfig()->getSystemValue('objectstore');
     $this->objectStorage = new ObjectStoreToTest($config['arguments']);
     $config['objectstore'] = $this->objectStorage;
     $this->instance = new ObjectStoreStorage($config);
 }
开发者ID:TechArea,项目名称:core,代码行数:28,代码来源:swift.php

示例10: updateChartsForUsers

 /**
  * Update all charts for all users
  */
 public function updateChartsForUsers()
 {
     $users = \OC_User::getUsers();
     foreach ($users as $userName) {
         $this->updateChartsForUser($userName);
     }
 }
开发者ID:heinekentap,项目名称:ocusagecharts,代码行数:10,代码来源:chartupdaterservice.php

示例11: validateUserPass

 /**
  * Validates a username and password
  *
  * This method should return true or false depending on if login
  * succeeded.
  *
  * @param string $username
  * @param string $password
  *
  * @return bool
  */
 protected function validateUserPass($username, $password)
 {
     $linkItem = \OCP\Share::getShareByToken($username, false);
     \OC_User::setIncognitoMode(true);
     $this->share = $linkItem;
     if (!$linkItem) {
         return false;
     }
     // check if the share is password protected
     if (isset($linkItem['share_with'])) {
         if ($linkItem['share_type'] == \OCP\Share::SHARE_TYPE_LINK) {
             // Check Password
             $forcePortable = CRYPT_BLOWFISH != 1;
             $hasher = new \PasswordHash(8, $forcePortable);
             if (!$hasher->CheckPassword($password . $this->config->getSystemValue('passwordsalt', ''), $linkItem['share_with'])) {
                 return false;
             } else {
                 return true;
             }
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:37,代码来源:publicauth.php

示例12: __construct

 public function __construct($global = false)
 {
     $this->prefix = OC_Util::getInstanceId() . '/';
     if (!$global) {
         $this->prefix .= OC_User::getUser() . '/';
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:7,代码来源:xcache.php

示例13: __construct

 /**
  * @brief Constructor.
  * @param $app The application identifier e.g. 'contacts' or 'calendar'.
  * @param $user The user whos data the object will operate on. This
  *   parameter should normally be omitted but to make an app able to
  *   update categories for all users it is made possible to provide it.
  * @param $defcategories An array of default categories to be used if none is stored.
  */
 public function __construct($app, $user = null, $defcategories = array())
 {
     $this->app = $app;
     $this->user = is_null($user) ? OC_User::getUser() : $user;
     $categories = trim(OC_Preferences::getValue($this->user, $app, self::PREF_CATEGORIES_LABEL, ''));
     $this->categories = $categories != '' ? unserialize($categories) : $defcategories;
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:15,代码来源:vcategories.php

示例14: tearDown

 protected function tearDown()
 {
     $result = \OC_User::deleteUser(self::$user);
     $this->assertTrue($result);
     $this->logout();
     parent::tearDown();
 }
开发者ID:rosarion,项目名称:core,代码行数:7,代码来源:ajax_rename.php

示例15: testGet

 /**
  * @dataProvider getData
  */
 public function testGet($user, $start, $count, $expected)
 {
     $_GET['start'] = $start;
     $_GET['count'] = $count;
     \OC_User::setUserId($user);
     $sessionUser = \OC::$server->getUserSession()->getUser();
     $this->assertInstanceOf('OCP\\IUser', $sessionUser);
     $this->assertEquals($user, $sessionUser->getUID());
     $activityManager = new ActivityManager($this->getMock('OCP\\IRequest'), $this->getMock('OCP\\IUserSession'), $this->getMock('OCP\\IConfig'));
     $activityManager->registerExtension(function () {
         return new Extension(\OCP\Util::getL10N('activity', 'en'), $this->getMock('\\OCP\\IURLGenerator'));
     });
     $this->overwriteService('ActivityManager', $activityManager);
     $result = \OCA\Activity\Api::get(array('_route' => 'get_cloud_activity'));
     $this->restoreService('ActivityManager');
     $this->assertEquals(100, $result->getStatusCode());
     $data = $result->getData();
     $this->assertEquals(sizeof($expected), sizeof($data));
     while (!empty($expected)) {
         $assertExpected = array_shift($expected);
         $assertData = array_shift($data);
         foreach ($assertExpected as $key => $value) {
             $this->assertArrayHasKey($key, $assertData);
             if ($value !== null) {
                 $this->assertEquals($value, $assertData[$key]);
             }
         }
     }
 }
开发者ID:ynott,项目名称:activity,代码行数:32,代码来源:apitest.php


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