Skip to content

Access managment according to user #5

@lokhandeganesh

Description

@lokhandeganesh
# Add protection to docs with multiple users
DocShield(
	app=app,
	credentials={
		"admin": settings.docshield_admin_pass,
		 "developer":settings.docshielde_pass,
	}
)

@app.get("/")
def root():
    logger.info("Hi, Welcome to FastAPI application")
    return {"message": "Hello World pushing out to ubuntu"}

@app.post("/posts/{id}")
def create_post():
    logger.info(f"Post with id-{id} created")
    return {"message": "Post created"}

I have two users defined in DocShield 1- admin, 2- develper
now according to there role they should see assigned API routes

eg. In swagger URL
Admin can access both routes
Developer can only access root route (or as required)

How can we define roles like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions