< Zpět na seznam úloh

Z5 Autentizace

Vašim úkolem je napsat funkci authorize_access, která hlídá přístup k prostředkům na firemní síti. Funkce dostává tři parametry typu str:

Abych řešení uznal, musí navíc plnit několik formalit:

Vaší kreativitě se meze nekladou. Jestli potřebujete inspiraci pro akce, podívejte se na Wikipedii na stránku CRUD.

Program:
def authorize_access(person, object, action):
if person == "ceo":
return True
if action == "delete":
return False
if object == "webpage":
return authorize_webpage(person, action)
return True

def authorize_webpage(person, action):
if action == "edit" and person != "admin":
return False
return True

Výstup
Načítám Python...