diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/PreviewManager.php | 28 | ||||
-rw-r--r-- | lib/private/User/Session.php | 23 | ||||
-rw-r--r-- | lib/public/IPreview.php | 12 | ||||
-rw-r--r-- | lib/public/IUserSession.php | 17 |
4 files changed, 40 insertions, 40 deletions
diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 621c45f28c5..b0858643d53 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -149,34 +149,6 @@ class PreviewManager implements IPreview { } /** - * return a preview of a file - * - * @param string $file The path to the file where you want a thumbnail from - * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image - * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image - * @param boolean $scaleUp Scale smaller images up to the thumbnail size or not. Might look ugly - * @return \OCP\IImage - * @deprecated 11 Use getPreview - */ - public function createPreview($file, $maxX = 100, $maxY = 75, $scaleUp = false) { - try { - $userRoot = $this->rootFolder->getUserFolder($this->userId)->getParent(); - $node = $userRoot->get($file); - if (!($file instanceof File)) { - throw new NotFoundException(); - } - - $preview = $this->getPreview($node, $maxX, $maxY); - } catch (\Exception $e) { - return new \OC_Image(); - } - - $previewImage = new \OC_Image(); - $previewImage->loadFromData($preview->getContent()); - return $previewImage; - } - - /** * Returns a preview of a file * * The cache is searched first and if nothing usable was found then a preview is diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 13519d97ef4..ba909c81053 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -315,6 +315,29 @@ class Session implements IUserSession, Emitter { } /** + * @return mixed + */ + public function getImpersonatingUserID(): ?string { + + return $this->session->get('oldUserId'); + + } + + public function setImpersonatingUserID(bool $useCurrentUser = true): void { + if ($useCurrentUser === false) { + $this->session->remove('oldUserId'); + return; + } + + $currentUser = $this->getUser(); + + if ($currentUser === null) { + throw new \OC\User\NoUserException(); + } + $this->session->set('oldUserId', $currentUser->getUID()); + + } + /** * set the token id * * @param int|null $token that was used to log in diff --git a/lib/public/IPreview.php b/lib/public/IPreview.php index ba32300a284..6989871d29b 100644 --- a/lib/public/IPreview.php +++ b/lib/public/IPreview.php @@ -80,18 +80,6 @@ interface IPreview { public function hasProviders(); /** - * Return a preview of a file - * @param string $file The path to the file where you want a thumbnail from - * @param int $maxX The maximum X size of the thumbnail. It can be smaller depending on the shape of the image - * @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image - * @param boolean $scaleUp Scale smaller images up to the thumbnail size or not. Might look ugly - * @return \OCP\IImage - * @since 6.0.0 - * @deprecated 11 Use getPreview - */ - public function createPreview($file, $maxX = 100, $maxY = 75, $scaleUp = false); - - /** * Returns a preview of a file * * The cache is searched first and if nothing usable was found then a preview is diff --git a/lib/public/IUserSession.php b/lib/public/IUserSession.php index d7bf5f9a385..b3c470e5be5 100644 --- a/lib/public/IUserSession.php +++ b/lib/public/IUserSession.php @@ -42,6 +42,7 @@ namespace OCP; interface IUserSession { /** * Do a user login + * * @param string $user the username * @param string $password the password * @return bool true if successful @@ -52,6 +53,7 @@ interface IUserSession { /** * Logs the user out including all the session data * Logout, destroys session + * * @return void * @since 6.0.0 */ @@ -80,4 +82,19 @@ interface IUserSession { * @since 8.0.0 */ public function isLoggedIn(); + + /** + * get getImpersonatingUserID + * + * @return string|null + * @since 18.0.0 + */ + public function getImpersonatingUserID(): ?string; + + /** + * set setImpersonatingUserID + * + * @since 18.0.0 + */ + public function setImpersonatingUserID(bool $useCurrentUser = true): void; } |