24 lines
376 B
Python
24 lines
376 B
Python
PASSWORDS = {
|
|
"a": "a",
|
|
"b": "b",
|
|
"c": "c"
|
|
}
|
|
|
|
PGROUPS = {
|
|
"a": ["p11111", "p22222"],
|
|
"b": ["p33333"]
|
|
}
|
|
|
|
|
|
def get_data(username, password):
|
|
if PASSWORDS.get(username) != password:
|
|
raise RuntimeError(f'authentication failed for user "{username}"')
|
|
|
|
return {
|
|
"username": username,
|
|
"pgroups": PGROUPS.get(username, [])
|
|
}
|
|
|
|
|
|
|