Skip to content

Commit 3641463

Browse files
Add Member Upgrade Auto Onfloor Group Membership
If a member has onfloor status conditional will now automatically add that member to the appropriate LDAP group during the FreshmanAccount upgrade process.
1 parent ffd8905 commit 3641463

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

conditional/blueprints/member_management.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from conditional.util.ldap import ldap_set_roomnumber
3636
from conditional.util.ldap import ldap_set_active
3737
from conditional.util.ldap import ldap_set_inactive
38+
from conditional.util.ldap import ldap_set_onfloor
3839
from conditional.util.ldap import ldap_set_housingpoints
3940
from conditional.util.ldap import ldap_set_current_student
4041
from conditional.util.ldap import ldap_set_non_current_student
@@ -506,11 +507,12 @@ def member_management_upgrade_user():
506507
fhm.meeting_id))
507508
db.session.delete(fhm)
508509

510+
new_account = ldap_get_member(uid)
509511
if acct.onfloor_status:
510512
db.session.add(OnFloorStatusAssigned(uid, datetime.now()))
513+
ldap_set_onfloor(new_account)
511514

512515
if acct.room_number:
513-
new_account = ldap_get_member(uid)
514516
ldap_set_roomnumber(new_account, acct.room_number)
515517

516518
db.session.delete(acct)

conditional/util/ldap.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ def ldap_set_non_current_student(account):
132132
ldap_get_current_students.cache_clear()
133133
ldap_get_member.cache_clear()
134134

135+
def ldap_set_onfloor(account):
136+
_ldap_add_member_to_group(account, 'onfloor')
137+
ldap_get_onfloor_members.cache_clear()
138+
ldap_get_member.cache_clear()
135139

136140
def ldap_get_roomnumber(account):
137141
try:

0 commit comments

Comments
 (0)