86 lines
2.7 KiB

from typing import List, Dict
from zope.interface import Interface, Attribute
class IUser(Interface):
"""Represents a Unix user."""
# LDAP attributes
uid = Attribute('user identifier')
cn = Attribute('common name')
login_shell = Attribute('login shell')
uid_number = Attribute('uid number')
gid_number = Attribute('gid number')
home_directory = Attribute('home directory')
program = Attribute('academic program')
position = Attribute('executive position')
terms = Attribute('list of terms for which this person was a member')
non_member_terms = Attribute('list of terms for which this person was '
'a club rep')
mail_local_addresses = Attribute('email aliases')
# Non-LDAP attributes
ldap3_entry = Attribute('cached ldap3.Entry instance for this user')
def get_forwarding_addresses(self) -> List[str]:
"""Get the forwarding addresses for this user."""
def set_forwarding_addresses(self, addresses: List[str]):
"""Set the forwarding addresses for this user."""
def is_club() -> bool:
Returns True if this is the Unix user for a club.
Returns False if this is the Unix user for a member.
def add_to_ldap():
Add a new record to LDAP for this user.
A new UID number and GID number will be created.
def add_to_kerberos(password: str):
"""Add a new Kerberos principal for this user."""
def remove_from_kerberos():
"""Remove this user from Kerberos."""
def add_terms(terms: List[str]):
"""Add member terms for this user."""
def add_non_member_terms(terms: List[str]):
"""Add non-member terms for this user."""
def add_position(position: str):
"""Add a position to this user."""
def remove_position(position: str):
"""Remove a position from this user."""
def change_password(password: str):
"""Replace this user's password."""
def replace_login_shell(login_shell: str):
"""Replace this user's login shell."""
def create_home_dir():
"""Create a new home directory for this user."""
def delete_home_dir():
"""Delete this user's home dir."""
def subscribe_to_mailing_list(mailing_list: str):
"""Subscribe this user to the mailing list."""
def unsubscribe_from_mailing_list(mailing_list: str):
"""Unsubscribe this user from the mailing list."""
def to_dict(get_forwarding_addresses: bool = False) -> Dict:
Serialize this user into a dict.
If get_forwarding_addresses is True, the forwarding addresses
for the user will also be returned, if present.