pyceo/ceo_common/interfaces/ILDAPService.py

36 lines
1.0 KiB
Python

from zope.interface import Interface
from .IUser import IUser
from .IGroup import IGroup
class ILDAPService(Interface):
"""An interface to the LDAP database."""
def get_user(username: str) -> IUser:
"""Retrieve the user with the given username."""
def add_user(user: IUser) -> IUser:
"""
Add the user to the database.
A new UID and GID will be generated and returned in the new user.
"""
def get_group(cn: str, is_club: bool = False) -> IGroup:
"""Retrieve the group with the given cn (Unix group name)."""
def add_group(group: IGroup) -> IGroup:
"""
Add the group to the database.
The GID will not be changed and must be valid.
"""
def modify_user(old_user: IUser, new_user: IUser):
"""Replace old_user with new_user."""
def modify_group(old_group: IGroup, new_group: IGroup):
"""Replace old_group with new_group."""
def add_sudo_role(uid: str):
"""Create a sudo role for the club with this UID."""