Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Access Control Decorator | Decorator Practice Lab
Quizzes & Challenges
Quizzes
Challenges
/
Python Decorators Explained

bookChallenge: Access Control Decorator

Tarefa

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.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 3
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

bookChallenge: Access Control Decorator

Deslize para mostrar o menu

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 3
single

single

some-alt