pyceo/ceo_common/interfaces/IUWLDAPService.py

26 lines
742 B
Python
Raw Normal View History

2021-08-03 10:09:07 -04:00
from typing import List, Union
2021-07-23 20:08:22 -04:00
from zope.interface import Interface
class IUWLDAPService(Interface):
"""Represents the UW LDAP database."""
2021-08-03 10:09:07 -04:00
def get_user(username: str):
2021-07-23 20:08:22 -04:00
"""
Return the LDAP record for the given user, or
None if no such record exists.
:rtype: Union[UWLDAPRecord, None]
"""
2021-08-03 10:09:07 -04:00
def get_programs_for_users(usernames: List[str]) -> List[Union[str, None]]:
"""
Return the programs for the given users from UWLDAP.
If no record or program is found for a user, their entry in
the returned list will be None.
Example:
get_programs_for_users(['user1', 'user2', 'user3'])
-> ['program1', None, 'program2']
"""