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


PHP User::getUser方法代码示例

本文整理汇总了PHP中OCP\User::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getUser方法的具体用法?PHP User::getUser怎么用?PHP User::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCP\User的用法示例。


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

示例1: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('weather', $urlParams);
     $container = $this->getContainer();
     /**
      * Core
      */
     $container->registerService('UserId', function (IContainer $c) {
         return \OCP\User::getUser();
     });
     /**
      * Database Layer
      */
     $container->registerService('CityMapper', function (IContainer $c) {
         return new CityMapper($c->query('ServerContainer')->getDb());
     });
     $container->registerService('SettingsMapper', function (IContainer $c) {
         return new SettingsMapper($c->query('ServerContainer')->getDb());
     });
     /**
      * Controllers
      */
     $container->registerService('CityController', function (IContainer $c) {
         return new CityController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('CityMapper'), $c->query('SettingsMapper'));
     });
     $container->registerService('SettingsController', function (IContainer $c) {
         return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('SettingsMapper'), $c->query('CityMapper'));
     });
     $container->registerService('WeatherController', function (IContainer $c) {
         return new WeatherController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('CityMapper'), $c->query('SettingsMapper'));
     });
 }
开发者ID:nerzhul,项目名称:owncloud-weather,代码行数:32,代码来源:application.php

示例2: __construct

	public function __construct (array $urlParams=array()) {
		parent::__construct('ownnote', $urlParams);

		$container = $this->getContainer();

		/**
		 * Controllers
		 */
		$container->registerService('PageController', function(IContainer $c) {
			return new PageController(
				$c->query('AppName'), 
				$c->query('Request'),
				$c->query('UserId')
			);
		});

                $container->registerService('OwnnoteApiController', function($c){
                        return new OwnnoteApiController(
                                $c->query('AppName'),
                                $c->query('Request')
                        );
                });


		/**
		 * Core
		 */
		$container->registerService('UserId', function(IContainer $c) {
			return \OCP\User::getUser();
		});		
		
	}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:32,代码来源:application.php

示例3: export

 /**
  * @NoAdminRequired
  * @NoCSRFRequired
  */
 public function export()
 {
     $data = $this->data->export();
     $fileName = User::getUser() . ".csv";
     $Download = new DataDownloadResponse($data, $fileName, 'text/csv');
     return $Download;
 }
开发者ID:yheric455042,项目名称:owncloud82,代码行数:11,代码来源:sharinggroupscontroller.php

示例4: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('documents', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('UserController', function ($c) {
         return new UserController($c->query('AppName'), $c->query('Request'));
     });
     $container->registerService('SessionController', function ($c) {
         return new SessionController($c->query('AppName'), $c->query('Request'), $c->query('Logger'), $c->query('UserId'));
     });
     $container->registerService('DocumentController', function ($c) {
         return new DocumentController($c->query('AppName'), $c->query('Request'), $c->query('CoreConfig'), $c->query('L10N'), $c->query('UserId'));
     });
     $container->registerService('SettingsController', function ($c) {
         return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('CoreConfig'), $c->query('Logger'), $c->query('L10N'), $c->query('UserId'));
     });
     /**
      * Core
      */
     $container->registerService('Logger', function ($c) {
         return $c->query('ServerContainer')->getLogger();
     });
     $container->registerService('CoreConfig', function ($c) {
         return $c->query('ServerContainer')->getConfig();
     });
     $container->registerService('L10N', function ($c) {
         return $c->query('ServerContainer')->getL10N($c->query('AppName'));
     });
     $container->registerService('UserId', function () {
         return \OCP\User::getUser();
     });
 }
开发者ID:Ebimedia,项目名称:owncloud,代码行数:35,代码来源:application.php

示例5: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('tasks', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('PageController', function ($c) {
         return new PageController($c->query('AppName'), $c->query('Request'), $c->query('UserId'));
     });
     $container->registerService('CollectionsController', function ($c) {
         return new CollectionsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('L10N'), $c->query('Settings'));
     });
     $container->registerService('ListsController', function ($c) {
         return new ListsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'));
     });
     $container->registerService('SettingsController', function ($c) {
         return new SettingsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('Settings'));
     });
     $container->registerService('TasksController', function ($c) {
         return new TasksController($c->query('AppName'), $c->query('Request'), $c->query('UserId'));
     });
     /**
      * Core
      */
     $container->registerService('UserId', function ($c) {
         return \OCP\User::getUser();
     });
     $container->registerService('L10N', function ($c) {
         return $c->query('ServerContainer')->getL10N($c->query('AppName'));
     });
     $container->registerService('Settings', function ($c) {
         return $c->query('ServerContainer')->getConfig();
     });
 }
开发者ID:msbt,项目名称:tasks,代码行数:35,代码来源:application.php

示例6: post_write_hook

 public static function post_write_hook($params)
 {
     $user = \OCP\User::getUser();
     if (!empty($user)) {
         Trashbin::resizeTrash($user);
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:7,代码来源:Hooks.php

示例7: getACL

 /**
  * Returns a list of ACE's for this node.
  *
  * Each ACE has the following properties:
  *   * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
  *     currently the only supported privileges
  *   * 'principal', a url to the principal who owns the node
  *   * 'protected' (optional), indicating that this ACE is not allowed to
  *      be updated.
  *
  * @return array
  */
 public function getACL()
 {
     $readprincipal = $this->getOwner();
     $writeprincipal = $this->getOwner();
     $createprincipal = $this->getOwner();
     $deleteprincipal = $this->getOwner();
     $uid = AddrBook::extractUserID($this->getOwner());
     //\OCP\Config::setUserValue($uid, 'contactsplus', 'syncaddrbook', $this->addressBookInfo['uri']);
     $readWriteACL = array(array('privilege' => '{DAV:}read', 'principal' => 'principals/' . \OCP\User::getUser(), 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => 'principals/' . \OCP\User::getUser(), 'protected' => true));
     if ($uid !== \OCP\USER::getUser()) {
         $sharedAddressbook = \OCP\Share::getItemSharedWithBySource(ContactsApp::SHAREADDRESSBOOK, ContactsApp::SHAREADDRESSBOOKPREFIX . $this->addressBookInfo['id']);
         if ($sharedAddressbook) {
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE && $sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE && $sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE) {
                 return $readWriteACL;
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE) {
                 $createprincipal = 'principals/' . \OCP\USER::getUser();
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_READ) {
                 $readprincipal = 'principals/' . \OCP\USER::getUser();
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE) {
                 $writeprincipal = 'principals/' . \OCP\USER::getUser();
             }
             if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE) {
                 $deleteprincipal = 'principals/' . \OCP\USER::getUser();
             }
         }
     } else {
         return parent::getACL();
     }
     return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write-content', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}bind', 'principal' => $createprincipal, 'protected' => true), array('privilege' => '{DAV:}unbind', 'principal' => $deleteprincipal, 'protected' => true));
 }
开发者ID:sahne123,项目名称:contactsplus,代码行数:45,代码来源:addressbook.php

示例8: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('bookmarks', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      * @param OC\AppFramework\Utility\SimpleContainer $c The Container instance
      *													 that handles the request
      */
     $container->registerService('WebViewController', function ($c) {
         return new WebViewController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('ServerContainer')->getURLGenerator(), $c->query('ServerContainer')->getDb());
     });
     $container->registerService('BookmarkController', function ($c) {
         return new BookmarkController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('ServerContainer')->getDb());
     });
     $container->registerService('TagsController', function ($c) {
         return new TagsController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('ServerContainer')->getDb());
     });
     $container->registerService('PublicController', function ($c) {
         return new PublicController($c->query('AppName'), $c->query('Request'), $c->query('ServerContainer')->getDb(), $c->query('ServerContainer')->getUserManager());
     });
     /**
      * Core
      */
     $container->registerService('UserId', function () {
         return \OCP\User::getUser();
     });
 }
开发者ID:woodworker,项目名称:bookmarks,代码行数:28,代码来源:application.php

示例9: testPrepareParameters

 /**
  * @dataProvider prepareParametersData
  */
 public function testPrepareParameters($params, $filePosition, $stripPath, $highlightParams, $expected, $createFolder = '')
 {
     if ($createFolder !== '') {
         $this->view->mkdir('/' . \OCP\User::getUser() . '/files/' . $createFolder);
     }
     $this->assertEquals($expected, $this->parameterHelper->prepareParameters($params, $filePosition, $stripPath, $highlightParams));
 }
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:10,代码来源:parameterhelpertest.php

示例10: __construct

 public function __construct($imagePath, $user = null, $square = false)
 {
     if (!Filesystem::isValidPath($imagePath)) {
         return;
     }
     if (is_null($user)) {
         $this->view = Filesystem::getView();
         $this->user = \OCP\User::getUser();
     } else {
         $this->view = new View('/' . $user . '/files');
         $this->user = $user;
     }
     $this->useOriginal = (substr($imagePath, -4) === '.svg' or substr($imagePath, -5) === '.svgz');
     if ($this->useOriginal) {
         $this->path = $imagePath;
     } else {
         $galleryDir = \OC_User::getHome($this->user) . '/gallery/' . $this->user . '/';
         if (strrpos($imagePath, '.')) {
             $extension = substr($imagePath, strrpos($imagePath, '.') + 1);
             $image = substr($imagePath, 0, strrpos($imagePath, '.'));
         } else {
             $extension = '';
             $image = $imagePath;
         }
         if ($square) {
             $extension = 'square.' . $extension;
         }
         $this->path = $galleryDir . $image . '.' . $extension;
         if (!file_exists($this->path)) {
             $this->create($imagePath, $square);
         }
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:33,代码来源:thumbnail.php

示例11: __construct

 public function __construct(array $urlParams = array())
 {
     parent::__construct('maps', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('PageController', function ($c) {
         return new PageController($c->query('AppName'), $c->query('Request'), $c->query('UserId'), $c->query('CacheManager'), $c->query('LocationManager'));
     });
     $container->registerService('LocationController', function ($c) {
         return new LocationController($c->query('AppName'), $c->query('Request'), $c->query('LocationManager'), $c->query('UserId'));
     });
     $container->registerService('CacheManager', function ($c) {
         return new CacheManager($c->query('ServerContainer')->getDb());
     });
     $container->registerService('LocationManager', function ($c) {
         return new LocationManager($c->query('ServerContainer')->getDb());
     });
     /**
      * Core
      */
     $container->registerService('UserId', function ($c) {
         return \OCP\User::getUser();
     });
     $container->registerService('Db', function () {
         return new Db();
     });
 }
开发者ID:amin-hedayati,项目名称:maps,代码行数:29,代码来源:application.php

示例12: __construct

 public function __construct($user = null, $addressBooksTableName = '*PREFIX*addressbook', $backendsTableName = '*PREFIX*addressbooks_backend', $dbBackend = null)
 {
     $this->user = $user ? $user : \OCP\User::getUser();
     $this->addressBooksTableName = $addressBooksTableName;
     $this->backendsTableName = $backendsTableName;
     $this->dbBackend = $dbBackend ? $dbBackend : new Backend\Database($user);
 }
开发者ID:varun2013,项目名称:owncloud-contacts,代码行数:7,代码来源:app.php

示例13: getShortcode

function getShortcode($url) {
	$shortcode = '';
	$query = OCP\DB::prepare('SELECT shortcode FROM *PREFIX*shorten WHERE url=?');
	$results = $query->execute(Array($url))->fetchAll();
	if ($results) {
		foreach($results as $result) {
			$shortcode = $result['shortcode'];	
		}
	}
	if ($shortcode == "") {
		$shortcode = rand_chars(6);
		$found = true;
		while ($found) {
			$query = OCP\DB::prepare('SELECT id FROM *PREFIX*shorten WHERE shortcode=?');
			$results = $query->execute(Array($shortcode))->fetchAll();
			if (!$results) {
				$found = false;
				$uid = \OCP\User::getUser();
				$query = OCP\DB::prepare('INSERT INTO *PREFIX*shorten (uid, shortcode, url) VALUES (?,?,?)');
				$query->execute(Array($uid,$shortcode,$url));
				$id = OCP\DB::insertid('*PREFIX*shorten');
			} else
				$shortcode = rand_chars(6);
		}
	}
	return $shortcode;
}
开发者ID:ArcherSys,项目名称:ArcherSysOSCloud7,代码行数:27,代码来源:makeurl.php

示例14: __construct

 public function __construct()
 {
     $timeNow = time();
     //test
     $checkOffset = new \DateTime(date('d.m.Y', $timeNow), new \DateTimeZone(self::$tz));
     $calcSumWin = $checkOffset->getOffset();
     $this->nowTime = strtotime(date('d.m.Y H:i', $timeNow)) + $calcSumWin;
     if (\OC::$server->getSession()->get('public_link_token')) {
         $linkItem = \OCP\Share::getShareByToken(\OC::$server->getSession()->get('public_link_token', false));
         if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
             if ($linkItem['item_type'] === App::SHARECALENDAR) {
                 $sPrefix = App::SHARECALENDARPREFIX;
             }
             if ($linkItem['item_type'] === App::SHAREEVENT) {
                 $sPrefix = App::SHAREEVENTPREFIX;
             }
             if ($linkItem['item_type'] === App::SHARETODO) {
                 $sPrefix = App::SHARETODOPREFIX;
             }
             $itemSource = App::validateItemSource($linkItem['item_source'], $sPrefix);
             $rootLinkItem = Calendar::find($itemSource);
             $this->aCalendars[] = $rootLinkItem;
         }
     } else {
         if (\OCP\User::isLoggedIn()) {
             $this->aCalendars = Calendar::allCalendars(\OCP\User::getUser());
             $this->checkAlarm();
         }
     }
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:30,代码来源:alarm.php

示例15: __construct

 /**
  * Define your dependencies in here
  */
 public function __construct(array $urlParams = array())
 {
     parent::__construct('user_files_restore', $urlParams);
     $container = $this->getContainer();
     /**
      * Controllers
      */
     $container->registerService('PageController', function ($c) {
         return new PageController($c->query('AppName'), $c->query('Request'), $c->query('L10N'), $c->query('RequestService'), $c->query('UserId'));
     });
     $container->registerService('RequestController', function ($c) {
         return new RequestController($c->query('AppName'), $c->query('Request'), $c->query('L10N'), $c->query('RequestMapper'), $c->query('UserId'));
     });
     /**
      * Services
      */
     $container->registerService('RequestService', function ($c) {
         return new RequestService($c->query('RequestMapper'), $c->query('UserId'), $c->query('L10N'));
     });
     /**
      * Database Layer
      */
     $container->registerService('RequestMapper', function ($c) {
         return new RequestMapper($c->query('ServerContainer')->getDb(), $c->query('L10N'));
     });
     /**
      * Core
      */
     $container->registerService('UserId', function ($c) {
         return \OCP\User::getUser();
     });
     $container->registerService('L10N', function ($c) {
         return $c->query('ServerContainer')->getL10N($c->query('AppName'));
     });
 }
开发者ID:CNRS-DSI-Dev,项目名称:user_files_restore,代码行数:38,代码来源:user_files_restore.php


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