|
|
|
# Clients / Customers / Companies
|
|
|
|
|
|
|
|
Unlike the other data, customers (private individual or company) are store in a specific manner, so that
|
|
|
|
Unlike the other data, customers (private individual or company) are stored in a specific manner, so that
|
|
|
|
|
|
|
|
* private customers (=client) can log in
|
|
|
|
* a client may have different permissions
|
| ... | ... | @@ -12,13 +12,13 @@ This means that we added plugins to the general queries and transitions, to make |
|
|
|
|
|
|
|
## Customers - Clients vs Companies
|
|
|
|
|
|
|
|
All customers are in **core.customer**. The "is_private" flag distinguishes actual people ("client") from companies.
|
|
|
|
All customers are in **core.customer**. The "is_private" flag distinguishes actual people ("client") from companies. Storing them both in the same entity allows us to use either as an owner of a vehicle without any further adaptations.
|
|
|
|
|
|
|
|
Clients have an attribute "owning_client" (refers **system.client**) and can log in with their email address. A user may belong to one or more companies.
|
|
|
|
Clients have an attribute "owning_client" (refers **system.client**, where lots of attributes [i.e. first name, last name] are stored) and can log in with their email address. A user may belong to one or more companies.
|
|
|
|
|
|
|
|
Companies do not have an "owning_client" and cannot log in. Any client belonging to a company may see the company's data.
|
|
|
|
|
|
|
|
### List Customers
|
|
|
|
### List Clients
|
|
|
|
|
|
|
|
```
|
|
|
|
#!json
|
| ... | ... | @@ -41,26 +41,29 @@ additional attributes are stored and can be joined to the entry in core.customer |
|
|
|
"attrs": {"prefetch" : "owning_client"}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### List Companies
|
|
|
|
|
|
|
|
Companies can be retrieved with the equivalent query:
|
|
|
|
```
|
|
|
|
#!json
|
|
|
|
|
|
|
|
#POST /data/core/customer/query
|
|
|
|
{
|
|
|
|
"conds" : {"me.is_private" : 0},
|
|
|
|
"attrs": {"prefetch" : "owning_client"}
|
|
|
|
"conds" : {"me.is_private" : 0}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
(Joins/Prefetch are left joins, so this works as long as the user has access to the entity)
|
|
|
|
|
|
|
|
## Client groups
|
|
|
|
## Client Agendas
|
|
|
|
|
|
|
|
There are two client groups: "admin" and "customer".
|
|
|
|
There are three client agendas: "admin" (ID: 10), "employee" (ID:) and "customer".
|
|
|
|
|
|
|
|
"admin" clients have full access to all **core.*** data.
|
|
|
|
"admin" and "employee" clients have full access to all customer data, employees may have limited access to some edit options.
|
|
|
|
|
|
|
|
"customer" clients have access to their and their companies' entries in **core.customer**, **core.vehicle***.
|
|
|
|
|
|
|
|
Which API endpoint are available for a client is visible in the universe.
|
|
|
|
|
|
|
|
### List Admin Customers
|
|
|
|
|
|
|
|
Admin Customers are those who have the agenda "admin" assigned to them. So, to list them, first join "owning_client" and then for this client, the assignments ("system__assignment__assigned_client"). Then filter out agenda "admin" (which has ID 10).
|
| ... | ... | @@ -90,7 +93,7 @@ Parameters (type, required etc) are found in the universe under $.plugins.custom |
|
|
|
```
|
|
|
|
#!json
|
|
|
|
|
|
|
|
#POST /plugins/customer_private_add
|
|
|
|
#POST /plugins/customer_client_add
|
|
|
|
{
|
|
|
|
"salutation" : "Mr",
|
|
|
|
"first_name":"John",
|
| ... | ... | |