Merge pull request #18355 from nextcloud/backport/17935/stable17

[stable17] adding share type circles
This commit is contained in:
Roeland Jago Douma 2019-12-12 10:49:12 +01:00 committed by GitHub
commit 387d216214
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -34,6 +34,7 @@ use OCP\IRequest;
use OCP\ISession;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;
use OCP\Share\IShare;
use Sabre\DAV\Auth\Backend\AbstractBasic;
/**
@ -97,7 +98,10 @@ class PublicAuth extends AbstractBasic {
// 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) {
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')
@ -112,7 +116,7 @@ class PublicAuth extends AbstractBasic {
}
return false;
}
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) {
} else if ($share->getShareType() === IShare::TYPE_REMOTE) {
return true;
} else {
return false;

View file

@ -1329,8 +1329,9 @@ class Manager implements IManager {
* @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;
$passwordProtected = $share->getShareType() !== IShare::TYPE_LINK
|| $share->getShareType() !== IShare::TYPE_EMAIL
|| $share->getShareType() !== IShare::TYPE_CIRCLE;
if (!$passwordProtected) {
//TODO maybe exception?
return false;