|
|
|
@ -4,8 +4,8 @@ from zope import component |
|
|
|
|
from .utils import authz_restrict_to_staff, authz_restrict_to_syscom, \ |
|
|
|
|
user_is_in_group, requires_authentication_no_realm, \ |
|
|
|
|
create_streaming_response, development_only, is_truthy |
|
|
|
|
from ceo_common.errors import BadRequest |
|
|
|
|
from ceo_common.interfaces import ILDAPService |
|
|
|
|
from ceo_common.errors import BadRequest, UserAlreadySubscribedError, UserNotSubscribedError |
|
|
|
|
from ceo_common.interfaces import ILDAPService, IConfig |
|
|
|
|
from ceod.transactions.members import ( |
|
|
|
|
AddMemberTransaction, |
|
|
|
|
ModifyMemberTransaction, |
|
|
|
@ -99,7 +99,10 @@ def renew_user(username: str): |
|
|
|
|
def unexpire(user): |
|
|
|
|
if user.shadowExpire: |
|
|
|
|
user.set_expired(False) |
|
|
|
|
user.subscribe_to_mailing_list(member_list) |
|
|
|
|
try: |
|
|
|
|
user.subscribe_to_mailing_list(member_list) |
|
|
|
|
except UserAlreadySubscribedError: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
if body.get('terms'): |
|
|
|
|
user.add_terms(body['terms']) |
|
|
|
@ -144,6 +147,9 @@ def expire_users(): |
|
|
|
|
if not dry_run: |
|
|
|
|
for member in members: |
|
|
|
|
member.set_expired(True) |
|
|
|
|
member.unsubscribe_from_mailing_list(member_list) |
|
|
|
|
try: |
|
|
|
|
member.unsubscribe_from_mailing_list(member_list) |
|
|
|
|
except UserNotSubscribedError: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
return json.jsonify([member.uid for member in members]) |
|
|
|
|