Skip to main content

This is a function that takes an array of users as an argument and checks if the role is an admin

Project description

Admin Protected Route

This is a function that takes an array of users as an argument and checks if the role is an admin. If that isn't the case, the function returns an unauthorized status code and message. Otherwise, the user is permitted to use the function.

How to use the decorator to protect routes

example:

from arrotechtools import admin_required


@jwt_required
@admin_required(users)
def signup():
    ...

The decorator takes a dictionary of users as an argument.

Author

Harun Gachanja G.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

arrotechtools-0.0.1-py3-none-any.whl (3.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page