Challenge: Access Control Decorator
Swipe to start coding
Write a decorator called require_admin that restricts access to the decorated function. The function should only run if the global variable IS_ADMIN is True. If IS_ADMIN is not True, the decorator must raise a PermissionError. The decorator must work for any function it decorates.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Can you explain that in simpler terms?
What are the main benefits of this?
Are there any common issues I should watch out for?
Awesome!
Completion rate improved to 5.88
Challenge: Access Control Decorator
Свайпніть щоб показати меню
Swipe to start coding
Write a decorator called require_admin that restricts access to the decorated function. The function should only run if the global variable IS_ADMIN is True. If IS_ADMIN is not True, the decorator must raise a PermissionError. The decorator must work for any function it decorates.
Рішення
Дякуємо за ваш відгук!
single