Challenge: Implement Authorization
Complete the challenge of implementing authorization in an Angular application.
We'll cover the following
Problem statement
Suppose there is an e-commerce web application. In your application, there are the following roles:
User
Admin
Anonymous (a user who is not logged in)
Requirements
In the initial code setup provided below, you are required to implement the authorization in the application with the following constraints:
If the logged in person’s role is “user,” then they can view and buy the products.
If the logged in person’s role is “admin,” then they can create, view, delete, and update the price of products.
If the person is not logged in, then their role is “anonymous,” and they can only view the products.
Expected output
The output should be the following:
User
If the role is “user” and the person selects the product from the “Product List,” they can see the “Buy Now” button under “Product Details,” as shown below:
Get hands-on with 1200+ tech skills courses.