Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow storage wrappers to through a forbidden exception with retry information for clients #20494

Merged
merged 1 commit into from
Nov 18, 2015

Conversation

nickvergessen
Copy link
Contributor

Current response on webdav requests:

<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:o="http://owncloud.org/ns">
  <s:exception>OCA\DAV\Connector\Sabre\Exception\Forbidden</s:exception>
  <s:message>Access to this resource has been forbidden by law.</s:message>
  <o:retry xmlns:o="o:">true</o:retry>
  <o:reason xmlns:o="o:">Access to this resource has been forbidden by law.</o:reason>
</d:error>

@DeepDiver1975 @icewind1991
Required for FW storage wrapper.

Currently reason === exception message, not sure if we want to keep it like that, but for now that should be fine so we can continue the actual work.

@@ -235,6 +237,8 @@ public function move($sourcePath, $destinationPath) {
}
} catch (StorageNotAvailableException $e) {
throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
} catch (ForbiddenException $ex) {
throw new Forbidden($ex->getMessage(), $ex->getRetry());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this DAVForbiddenException everywhere to avoid confusion ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure it helps a lot. DAV could still be the app or sabre...

@PVince81
Copy link
Contributor

Code looks good otherwise 👍

* @return int
*/
public function getHTTPCode() {
return 403;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like the perfect use case for HTTP 451: Unavailable For Legal Reasons 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to overload - base already implements this as 403

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I didn't extend in the beginning, so this was just a left over. will fix in a minute

@icewind1991
Copy link
Contributor

👍 looks good

@DeepDiver1975
Copy link
Member

I'm missing tests 👿

@nickvergessen
Copy link
Contributor Author

@DeepDiver1975 added some tests to the dav stuff to test exception convertion and exception serialization

DeepDiver1975 added a commit that referenced this pull request Nov 18, 2015
Allow storage wrappers to through a forbidden exception with retry information for clients
@DeepDiver1975 DeepDiver1975 merged commit aba1199 into master Nov 18, 2015
@DeepDiver1975 DeepDiver1975 deleted the storage-forbidden-exception branch November 18, 2015 08:13
@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants