21 lines
650 B
Python
21 lines
650 B
Python
from typing import Union, List
|
|
|
|
from zope import component
|
|
|
|
from ..AbstractTransaction import AbstractTransaction
|
|
from ceo_common.interfaces import ILDAPService
|
|
|
|
|
|
class UpdateProgramsTransaction(AbstractTransaction):
|
|
"""Transaction to sync the 'program' attribute in CSC LDAP with UW LDAP."""
|
|
|
|
def __init__(self, members: Union[List[str], None]):
|
|
super().__init__()
|
|
self.members = members
|
|
self.ldap_srv = component.getUtility(ILDAPService)
|
|
|
|
def child_execute_iter(self):
|
|
users_updated = self.ldap_srv.update_programs(members=self.members)
|
|
yield 'update_programs'
|
|
self.finish(users_updated)
|