Customers Module
Overview
Platform Customers are always companies. Users within each organisation are assigned permissions to carry out tasks based on their roles.
Although we are building for the Inventory service, we have to be mindful of how the Logistics service works so that we can migrate that user system to this when the time comes.
Organisation as Customers
Organisations are essentially our customers and they are created currently by customer service staff who will onbard them individually.
Eventually we will operate using a self signup service, where the account owner will sign up the business and then add users of their organisation to the platform.
Organisations
In addition to customers orgnisations, we will also allow customers to create shell organisations, which are companies with whom they are connected for business reasons (this may be something like a storage business or a logistics business of some kind)
Business Units
An organisation can have one or more business units associated with it. To be able to manage where contracts are allocated, a business unit may have (if it is a farm or store) additional meta data associated, and these are stored as part of a Business directly linked with a business unit
Organisation Users
Users are people with accounts that they use to login and perform actions around the platform. Account owners create users belonging to their company and assign permissions at the time of account creation.
Admin users
These are Hectare staff and are created and managed via a /customers/admin api
Different from customers, admin users are not attached to an organisation.
Created using a different endpoint, admin users can only be created by another admin user.
Admin users also need to have a hectare email address, this is so eventually we will use federated logins.
Capabilities
Customers
- Create a customer from signup
- Create a shell customer from invite
- Create a full customer from invite
- Check a customer exists
- @todo Admin Get all customers
- @todo remove a customer (and their records)
Organisation
- Create an organistion (only admin but really should not exist in isolation from creating a customer)
- Get all organisations
- Get a single organisation
- Remove an organisation (should not be done in isolation)
Businesses
- get a business that's been assigned to a business unit
Business Units
- Create business unit
- Retrieve a business unit
- Patch a business unit
- Delete a business unit
Roles
Users
- Create a user
- Get all users in an organisation
- Get a single user
- Remove a user from an organisation
Todo
In light of MVP, the customer self signup endpoint will only be used by Admin users to sign up customers. To facilitate this, the open endpoint will be restricted to admins, and the accounts, whilst still autoconfirmed will need to send out a password to the account owner.
- Admin users need to be able to get a list of all users (currently only users who match the calling users organisation are listed, as admin users dn't have a matching organisation this does nto return any values)
- GetOrganisations and GetOrganisation we need to confirm whether we need to add restrictions to connected organisations or their own organisation when using these endpoints
- Regression Tests identified for each customer capability in line with MVP