summaryrefslogtreecommitdiff
path: root/src/authn.py
diff options
context:
space:
mode:
authorKristofer Hallin <kristofer@sunet.se>2021-09-23 11:56:34 +0200
committerKristofer Hallin <kristofer@sunet.se>2021-09-23 11:56:34 +0200
commit0398e77a809abcaf78c6f7d3e6064a5bee50be23 (patch)
tree04e66c666fee6f40762cc4586bba345557227765 /src/authn.py
parent838d36e7cab2f11322d4c3c211407a73ebc712b9 (diff)
Use CouchDB, this might break things.
Diffstat (limited to 'src/authn.py')
-rwxr-xr-xsrc/authn.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/authn.py b/src/authn.py
index 8227e2c..d57e382 100755
--- a/src/authn.py
+++ b/src/authn.py
@@ -17,6 +17,7 @@ class Authz:
def write_p(self):
return 'w' in self._perms
+
class User:
def __init__(self, username, pw, authz):
self._username = username
@@ -37,18 +38,19 @@ class User:
def read_perms(self):
acc = []
- for k,v in self._authz.items():
+ for k, v in self._authz.items():
if v.read_p():
acc.append(k)
return acc
def write_perms(self):
acc = []
- for k,v in self._authz.items():
+ for k, v in self._authz.items():
if v.write_p():
acc.append(k)
return acc
+
class UserDB:
def __init__(self, yamlfile):
self._users = {}
@@ -105,5 +107,6 @@ def self_test():
assert(len(wp) == 1)
assert('sunet.se' in wp)
+
if __name__ == '__main__':
self_test()