2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-28 11:57:37 +00:00

Put missing file under git tracking

This commit is contained in:
Jarrod Johnson 2013-09-06 15:47:39 -04:00
parent 39c17330f3
commit 596692a033

24
confluent/auth.py Normal file
View File

@ -0,0 +1,24 @@
# authentication and authorization routines for confluent
import confluent.config as config
def authorize(name, element):
#TODO: actually use the element to ascertain if this user is good enough
try:
if '/' in name:
tenant, user = name.split('/', 1)
tenant = config.get_tenant_id(tenant)
user = config.get_user(user, tenant)
elif name in config.get_tenant_names():
tenant = config.get_tenant_id(name)
user = config.get_user(name, tenant)
else:
user = config.get_user(name, 0)
tenant = 0
return (tenant, user)
except:
print "uh oh"
return None