-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement account restriction (#1053)
API implementation for account restriction: Adds middleware to check if account is restricted Moves and adds user tag based tests to auth.spec.js If user account has HasAccountRestricted user tag, they can no longer (even if they are PSA enabled) Adds some documentation to the readme
- Loading branch information
Alexandra Stoica
authored
Mar 24, 2022
1 parent
c7d562e
commit 6f6f279
Showing
13 changed files
with
433 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,10 @@ The given API has a set of three different authentication levels: | |
|
||
The 👮 API methods are only allowed with a Magic Token, and consequently only available via https://web3.storage | ||
|
||
### Account restriction | ||
|
||
If a user's account is restricted, it means that they might have gone over the storage limit assigned to them. This restriction disables several actions such as uploading files, adding and replacing pin requests, or publishing a name record. Note that even if the account has [pinning service API access](https://docs.web3.storage/how-tos/pinning-services-api/#requesting-access), account restriction will disable adding and replacing of pins. It is however still possible to delete pins and create/delete API tokens. For more information, please email <[email protected]>. | ||
|
||
### 🔒 `POST /car` | ||
|
||
Upload a CAR file for a root CID. _Authenticated_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,15 @@ export class PinningUnauthorizedError extends HTTPError { | |
} | ||
PinningUnauthorizedError.CODE = 'ERROR_PINNING_UNAUTHORIZED' | ||
|
||
export class AccountRestrictedError extends HTTPError { | ||
constructor (msg = 'This account is restricted, email [email protected] for more information.') { | ||
super(msg, 403) | ||
this.name = 'AccountRestrictedError' | ||
this.code = AccountRestrictedError.CODE | ||
} | ||
} | ||
AccountRestrictedError.CODE = 'ERROR_ACCOUNT_RESTRICTED' | ||
|
||
export class TokenNotFoundError extends HTTPError { | ||
constructor (msg = 'API token no longer valid') { | ||
super(msg, 401) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.