generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LGA-3224 Add in Authorisation to the API (#65)
* Add in Authorisation to the API * Add command to list and update user scopes * Add documentation for scopes
- Loading branch information
Showing
12 changed files
with
304 additions
and
29 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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""user scopes | ||
Revision ID: d4223a91f1de | ||
Revises: c4b9d0057513 | ||
Create Date: 2024-11-21 11:33:22.255372 | ||
""" | ||
|
||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "d4223a91f1de" | ||
down_revision: Union[str, None] = "c4b9d0057513" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column("users", sa.Column("scopes", sa.JSON(), nullable=True)) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("users", "scopes") | ||
# ### end Alembic commands ### |
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
title: Scopes | ||
--- | ||
|
||
## Scopes | ||
There are four scopes which each correspond to a http method: | ||
- create | ||
- read | ||
- update | ||
- delete | ||
|
||
Scopes are only assignable by the CLA team and you need to request which scopes you api requires as part of your account creation process | ||
|
||
### Adding/updating user scopes | ||
The following overwrites the current user scopes with the ones given | ||
`python manage.py user-scopes-add <username> --scope=create --scope=read --scope=update` | ||
|
||
### Listing user scopes | ||
To get a list of current scopes assign to a user do | ||
`python manage.py user-scopes-list <username>` | ||
|
||
### List routes with scopes | ||
To get a list of all the routes which includes their scopes do | ||
`python manage.py routes-list` |
Oops, something went wrong.