Skip to content

Commit

Permalink
using IShare::
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <[email protected]>
  • Loading branch information
ArtificialOwl committed Dec 5, 2019
1 parent c1558af commit 0f32f81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions apps/dav/lib/Connector/PublicAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use OCP\ISession;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IShare;
use Sabre\DAV\Auth\Backend\AbstractBasic;

/**
Expand Down Expand Up @@ -98,9 +99,9 @@ protected function validateUserPass($username, $password) {
// check if the share is password protected
if ($share->getPassword() !== null) {

if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK
|| $share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL
|| $share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) {
if ($share->getShareType() === IShare::TYPE_LINK
|| $share->getShareType() === IShare::TYPE_EMAIL
|| $share->getShareType() === IShare::TYPE_CIRCLE) {
if ($this->shareManager->checkPassword($share, $password)) {
return true;
} else if ($this->session->exists('public_link_authenticated')
Expand All @@ -115,7 +116,7 @@ protected function validateUserPass($username, $password) {
}
return false;
}
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) {
} else if ($share->getShareType() === IShare::TYPE_REMOTE) {
return true;
} else {
return false;
Expand Down
6 changes: 3 additions & 3 deletions lib/private/Share20/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1444,9 +1444,9 @@ protected function checkExpireDate($share) {
* @return bool
*/
public function checkPassword(\OCP\Share\IShare $share, $password) {
$passwordProtected = $share->getShareType() !== \OCP\Share::SHARE_TYPE_LINK
|| $share->getShareType() !== \OCP\Share::SHARE_TYPE_EMAIL
|| $share->getShareType() !== \OCP\Share::SHARE_TYPE_CIRCLE;
$passwordProtected = $share->getShareType() !== IShare::TYPE_LINK
|| $share->getShareType() !== IShare::TYPE_EMAIL
|| $share->getShareType() !== IShare::TYPE_CIRCLE;
if (!$passwordProtected) {
//TODO maybe exception?
return false;
Expand Down

0 comments on commit 0f32f81

Please sign in to comment.