Microservices - Authentication and Authorization
In this RBAC microservice code:
What is the output and why?
def has_permission(user_roles, permission):
for role in user_roles:
if permission in role_permissions.get(role, []):
return True
return False
role_permissions = {"admin": ["read", "write"], "user": ["read"]}
print(has_permission([], "read"))What is the output and why?
