Add some docstrings.

This commit is contained in:
Pedro Algarvio 2010-12-15 18:27:47 +00:00
parent 6c99204828
commit d44f59a0e7
2 changed files with 13 additions and 0 deletions

View File

@ -72,6 +72,16 @@ class AuthManager(component.Component):
pass pass
def peek(self, username): def peek(self, username):
"""
Peeks users based on username and returns their auth level
:param username: str, username
:returns: int, the auth level for this user
:rtype: int
:raises BadLoginError: if the username does not exist or password does not match
"""
if username not in self.__auth: if username not in self.__auth:
# Let's try to re-load the file.. Maybe it's been updated # Let's try to re-load the file.. Maybe it's been updated
self.__load_auth_file() self.__load_auth_file()

View File

@ -254,6 +254,9 @@ class DelugeRPCProtocol(Protocol):
)) ))
if method == "daemon.peek": if method == "daemon.peek":
# This is a special case and used in the initial connection process
# We need to peek the user here in order to get an auth level back
# and see if the user exists.
try: try:
ret = component.get("AuthManager").peek(*args, **kwargs) ret = component.get("AuthManager").peek(*args, **kwargs)
if ret: if ret: