Restricting access of some roles to some specific pages

@bp.route("/products/wishlist", methods=["GET"])
@login_required
@roles_required(
    "ADMIN",
    "CUSTOMER_STORE_MANAGER"
)
def product_wishlist():
    return product_wishlist_page()

I have role restrictions like this where each page has some role requirements, what I need to do is restricting some roles so they could have access to only some specific pages, for example when CUSTOMER_STORE_MANAGER logins into the webpage, they should only be able to view the product_wishlist

I thought about defining pages for each role and check if they are trying to access to pages which they have authorization. But I wonder if there is a more convenient way to do this in Flask?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation