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.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
@ -98,16 +104,16 @@ class MembershipworksMember(Member):
def to_DoorMember(self, door):
doorLevels = [k for k, v in self.extraLevels.items() if door.name in v]
if (
door.name not in self.doorAccess
or self.onHold
or self.formerMember
or not self.limitedOperations
):
schedules = []
else:
if door.name in self.doorAccess and not self.onHold and not self.formerMember:
# members should get their normal schedules
if self.limitedOperations:
schedules = self.schedules + doorLevels
# members should get only the staffed hours schedule
if self.staffedLimitedOperations:
schedules += ["Staffed Hours"]
dm = DoorMember(
door,
forename=self.forename,
@ -336,7 +342,7 @@ def main():
config = Config()
membershipworks = config.membershipworks
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(