using IShare::

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
This commit is contained in:
Maxence Lange 2019-12-04 22:11:18 -01:00
parent c1558af16d
commit 0f32f8119e
2 changed files with 8 additions and 7 deletions

View File

@ -34,6 +34,7 @@ use OCP\IRequest;
use OCP\ISession; use OCP\ISession;
use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager; use OCP\Share\IManager;
use OCP\Share\IShare;
use Sabre\DAV\Auth\Backend\AbstractBasic; use Sabre\DAV\Auth\Backend\AbstractBasic;
/** /**
@ -98,9 +99,9 @@ class PublicAuth extends AbstractBasic {
// check if the share is password protected // check if the share is password protected
if ($share->getPassword() !== null) { if ($share->getPassword() !== null) {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK if ($share->getShareType() === IShare::TYPE_LINK
|| $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL || $share->getShareType() === IShare::TYPE_EMAIL
|| $share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { || $share->getShareType() === IShare::TYPE_CIRCLE) {
if ($this->shareManager->checkPassword($share, $password)) { if ($this->shareManager->checkPassword($share, $password)) {
return true; return true;
} else if ($this->session->exists('public_link_authenticated') } else if ($this->session->exists('public_link_authenticated')
@ -115,7 +116,7 @@ class PublicAuth extends AbstractBasic {
} }
return false; return false;
} }
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) { } else if ($share->getShareType() === IShare::TYPE_REMOTE) {
return true; return true;
} else { } else {
return false; return false;

View File

@ -1444,9 +1444,9 @@ class Manager implements IManager {
* @return bool * @return bool
*/ */
public function checkPassword(\OCP\Share\IShare $share, $password) { public function checkPassword(\OCP\Share\IShare $share, $password) {
$passwordProtected = $share->getShareType() !== \OCP\Share::SHARE_TYPE_LINK $passwordProtected = $share->getShareType() !== IShare::TYPE_LINK
|| $share->getShareType() !== \OCP\Share::SHARE_TYPE_EMAIL || $share->getShareType() !== IShare::TYPE_EMAIL
|| $share->getShareType() !== \OCP\Share::SHARE_TYPE_CIRCLE; || $share->getShareType() !== IShare::TYPE_CIRCLE;
if (!$passwordProtected) { if (!$passwordProtected) {
//TODO maybe exception? //TODO maybe exception?
return false; return false;