Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A abocar
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • cct
  • abocar
  • Wiki
  • Customers

Customers · Changes

Page history
Edited online authored Mar 02, 2021 by Andrea Pavlovic's avatar Andrea Pavlovic
Hide whitespace changes
Inline Side-by-side
Customers.md
View page @ 1cd6e4fc
# Clients / Customers / Companies # 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 * private customers (=client) can log in
* a client may have different permissions * a client may have different permissions
...@@ -12,13 +12,13 @@ This means that we added plugins to the general queries and transitions, to make ...@@ -12,13 +12,13 @@ This means that we added plugins to the general queries and transitions, to make
## Customers - Clients vs Companies ## 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. 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 #!json
...@@ -41,26 +41,29 @@ additional attributes are stored and can be joined to the entry in core.customer ...@@ -41,26 +41,29 @@ additional attributes are stored and can be joined to the entry in core.customer
"attrs": {"prefetch" : "owning_client"} "attrs": {"prefetch" : "owning_client"}
} }
``` ```
### List Companies
Companies can be retrieved with the equivalent query: Companies can be retrieved with the equivalent query:
``` ```
#!json #!json
#POST /data/core/customer/query #POST /data/core/customer/query
{ {
"conds" : {"me.is_private" : 0}, "conds" : {"me.is_private" : 0}
"attrs": {"prefetch" : "owning_client"}
} }
``` ```
(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***. "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 ### 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). 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 ...@@ -90,7 +93,7 @@ Parameters (type, required etc) are found in the universe under $.plugins.custom
``` ```
#!json #!json
#POST /plugins/customer_private_add #POST /plugins/customer_client_add
{ {
"salutation" : "Mr", "salutation" : "Mr",
"first_name":"John", "first_name":"John",
......
Clone repository
  • Customers
  • Home
  • Queries
  • Test_Setup
  • Vehicles
  • v2