doorUpdater: Add "Staffed Hours Only" limited operations role

Also fix new name for old "access permitted during limited operations"
role, which now allows for access during limited operations using the
member's normal access hours
This commit is contained in:
Adam Goldsmith 2020-05-17 21:32:07 -04:00
parent 50952bdb46
commit 2eacb46353

View File

@ -74,7 +74,13 @@ class MembershipworksMember(Member):
self.onHold = data["Account on Hold"] != "" self.onHold = data["Account on Hold"] != ""
self.limitedOperations = ( self.limitedOperations = (
data["Access Permitted During Limited Operations"] == "Y" data[
"Access Permitted Using Membership Level Schedule During COVID-19 Limited Operations"
]
== "Y"
)
self.staffedLimitedOperations = (
data["Access Permitted During COVID-19 Staffed Period Only"] == "Y"
) )
self.formerMember = formerMember self.formerMember = formerMember
@ -98,15 +104,15 @@ class MembershipworksMember(Member):
def to_DoorMember(self, door): def to_DoorMember(self, door):
doorLevels = [k for k, v in self.extraLevels.items() if door.name in v] doorLevels = [k for k, v in self.extraLevels.items() if door.name in v]
if ( schedules = []
door.name not in self.doorAccess if door.name in self.doorAccess and not self.onHold and not self.formerMember:
or self.onHold # members should get their normal schedules
or self.formerMember if self.limitedOperations:
or not self.limitedOperations schedules = self.schedules + doorLevels
):
schedules = [] # members should get only the staffed hours schedule
else: if self.staffedLimitedOperations:
schedules = self.schedules + doorLevels schedules += ["Staffed Hours"]
dm = DoorMember( dm = DoorMember(
door, door,
@ -336,7 +342,7 @@ def main():
config = Config() config = Config()
membershipworks = config.membershipworks membershipworks = config.membershipworks
membershipworks_attributes = ( membershipworks_attributes = (
"_id,nam,phn,eml,lvl,lbl,xws,xms,xsc,xas,xfd,xac,xcf,xeh,xse,xlo" "_id,nam,phn,eml,lvl,lbl,xws,xms,xsc,xas,xfd,xac,xcf,xeh,xse,xlo,xxc"
) )
memberData = membershipworks.get_members( memberData = membershipworks.get_members(