mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
47 lines
1016 B
Python
47 lines
1016 B
Python
|
|
def get_api(api):
|
|
try:
|
|
mod = __import__(api)
|
|
except ImportError:
|
|
raise DoesNotExist('Error creating service')
|
|
|
|
for i in api.split(".")[1:]:
|
|
mod = getattr(mod, i)
|
|
|
|
return getattr(mod, mod.ServiceClass)()
|
|
|
|
|
|
class BaseService():
|
|
"""
|
|
Base Service class, all service classes should inherit from this
|
|
|
|
"""
|
|
|
|
settings = { 'require_user': True,
|
|
'require_password': True,
|
|
'provide_login': False }
|
|
|
|
def add_user(self, username, password):
|
|
""" Add a user """
|
|
pass
|
|
|
|
def delete_user(self, username):
|
|
""" Delete a user """
|
|
pass
|
|
|
|
def disable_user(self, username):
|
|
""" Disable a user """
|
|
pass
|
|
|
|
def enable_user(self, username, password):
|
|
""" Enable a user """
|
|
pass
|
|
|
|
def check_user(self, username):
|
|
""" Check if the username exists """
|
|
pass
|
|
|
|
def login(username):
|
|
""" Login the user and provide cookies back """
|
|
pass
|