Ejemplo n.º 1
0
                    print("Has authorizations:", user_authorizations)
                    #if contact is not member
                    if not is_member:
                        #add contact to Non-Member membership level
                        while (1):
                            if WA_API.SetContactMembership(
                                    contact['Id'], '813239'):
                                break
                            time.sleep(5)
                        #TODO:approve membership
                    auth_group_list = []
                    for auth in user_authorizations:
                        auth_group_list.append(auth_map[auth])
                    print(auth_group_list)
                    while (1):
                        if WA_API.SetMemberGroups(contact['Id'],
                                                  auth_group_list):
                            break
                        time.sleep(5)
                    #read list of authorizations from contact membership field
                    #add contact to appropriate groups according to authorizations
                contactIDs.pop()
                time.sleep(1)

            except KeyboardInterrupt:
                raise
            except:
                raise
                print('CAUGHT EXCEPTION; CONTINUING')
        print(contactIDs)
        converter.WriteUnprocessedIDs(contactIDs)
        #result = WA_API.GetContactById(test_user_id)
Ejemplo n.º 2
0
                    if not has_key:
                        contactIDs.pop()
                        continue
                    if has_key:
                        print("Has key")
                        #if contact is not member
                        if not is_member:
                            #add contact to Non-Member membership level
                            while (1):
                                if WA_API.SetContactMembership(
                                        contact['Id'], '813239'):
                                    break
                                time.sleep(5)
                            #TODO:approve membership
                        while (1):
                            if WA_API.SetMemberGroups(contact['Id'], [435189]):
                                WA_API.UpdateContactField(
                                    contact['Id'], 'KeyID', MCP_user['nfcID'])
                                print('added to door auth group')
                                break
                            time.sleep(5)
                contactIDs.pop()
                time.sleep(1)

            except KeyboardInterrupt:
                raise
            except:
                raise
                print('CAUGHT EXCEPTION; CONTINUING')
        print(contactIDs)
        converter.WriteUnprocessedIDs(contactIDs)