Data model and access

Addresses and uses

An address belongs to a user. What it is used for, and by whom, is recorded separately as uses: a use is a site ID plus a type. Site ID 0 is the member’s own address book; any other site ID means the address has been given to that site’s organisation as that type. One address can carry several uses, for example residential in the member’s book and postal for two clubs. There is at most one current address per user, site and type: giving another address the same site and type takes it from the old one.

Who can read

Who can edit

The owner and the admin capability can edit any of the owner’s addresses. Site staff who can read an address may edit it only while the member has not taken it into their own book: an address staff entered (for example from an import) is created with a use for that site only and becomes the member’s once they confirm it.

Leaving and deletion

Organisations are entitled to their members’ addresses, so members are not offered a way to withdraw a site’s use; they maintain their addresses instead. When a member leaves, the site’s uses are deleted (remove_site_uses()); the addresses stay with the member. Removing a user from a site does the same. Deleting a user from the network deletes their addresses, uses and points.

Validation

Each save records a validation status: valid, incomplete (a field the country requires is empty), invalid (the postcode does not match the country’s pattern, or the country is unknown) or unchecked (the library is not installed). A save is never refused on these grounds.