osf.io icon indicating copy to clipboard operation
osf.io copied to clipboard

[ENG-2247] Creates a Node quota_status v1 endpoint for WB to enforce storage limits

Open UdayVarkhedkar opened this issue 4 years ago • 4 comments

Purpose

Provides Waterbutler with an endpoint to check if a node has exceeded storage limits prior to conducting file operations

Changes

  • Adds an endpoint (api/v1/<guid>/osfstorage/quota_status/) for WB to check the over_quota status of a node
  • Adds tests for the new endpoint

QA Notes

Dev Tested (Endpoint can only be accessed by WB)

Documentation

N/A

Side Effects

N/A

Ticket

JIRA Ticket

UdayVarkhedkar avatar Sep 29 '20 20:09 UdayVarkhedkar

Drive-by: Did you mean to include your other API PR in with this one?

brianjgeiger avatar Sep 30 '20 18:09 brianjgeiger

I rebased this PR upon the other API PR because of some of the None storage_usage handling and re-numbering of the StorageEnum.

UdayVarkhedkar avatar Sep 30 '20 18:09 UdayVarkhedkar

@Johnetordoff Some of your feedback is actually for https://github.com/CenterForOpenScience/osf.io/pull/9483 (which this PR is based upon). I'll incorporate those changes there.

We'll talk about why a distinct endpoint is necessary for WB tomorrow and I can write up a Notion doc detailing why - the gist is that get_auth is sent on an operation basis rather than a user intent basis (i.e. A user-facing move is two file operations, an upload and delete). For certain moves/copies within the same OSFStorage instance, they should be allowed regardless of storage caps because they are internal and not increasing the storage used. Permitting these operations through get_auth is difficult because the get_auth calls for the underlying file operations are independent. I believe we identified a way it could be managed but it was ultimately decided that the additional flexibility of a distinct endpoint would be better.

UdayVarkhedkar avatar Sep 30 '20 18:09 UdayVarkhedkar

Excellent work! just address Fitz's comments and we good.

Johnetordoff avatar Oct 01 '20 14:10 Johnetordoff