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 05, 2021 by Andrea Pavlovic's avatar Andrea Pavlovic
Show whitespace changes
Inline Side-by-side
Customers.md
View page @ aae0177f
......@@ -3,7 +3,7 @@
Unlike the other data, customers (private individual or company) are stored in a specific manner, so that
* clients (=private individuals) can log in
* a client may have different permissions
* a client may have different agendas (access rights)
* a vehicle may be owned by either a client or a company
This means that we added plugins to the general queries and transitions, to make it easier or possible at all to administrate and query the data correctly.
......@@ -56,7 +56,29 @@ Companies can be retrieved with the equivalent query:
## Client Agendas
There are three client agendas: "admin" (ID: 10), "employee" (ID:) and "customer".
There are three client agendas: "admin" (ID: 10), "employee" (ID: 11) and "customer" (ID: 9).
These IDs should not change, but they could in theory.
To list them:
```
#!json
POST {{url}}/data/system/agenda/query
{}
```
To find one:
```
#!json
POST {{url}}/data/system/agenda/query
{
"conds": {"name": "employee"}
}
```
"admin" and "employee" clients have full access to all customer data, employees may have limited access to some edit options.
......@@ -85,6 +107,45 @@ Admin Customers are those who have the agenda "admin" assigned to them. So, to l
```
Note that this query only returns the relevant data for the main query - core.customer. The join is used for filtering only. "prefetch" instead of "join" would return the data from system.client and system.assignment as well.
### Add Agenda
```
#!json
# POST {{url}}/data/system/assignment/transitions/create
{
"agenda": 10,
"assigned_client": 34
}
```
## Remove Agenda
First, find the id of the assignment of the client to the agenda you want to remove:
```
#!json
# POST {{url}}/data/system/assignment/query
{
"conds": {
"agenda" : 10,
"assigned_client": 5
},
"attrs" : {"columns" : "id"}
}
```
Then delete the entry using that id:
```
#!json
# POST {{url}}/data/system/assignment/transitions/12/delete
{}
```
## Administration
### Create Client
......@@ -253,18 +314,3 @@ To list all clients assigned to a company, join system.client via owning_client
"join" : {"owning_client" : "assignment__core_customer__assigned_client"}}
}
```
\ No newline at end of file
### Add Admin to Client
```
#!json
# POST {{url}}/data/system/assignment/transitions/create
{
"agenda": 10,
"assigned_client": 34
}
```
## Remove Admin for Client
\ No newline at end of file
Clone repository
  • Customers
  • Home
  • Queries
  • Test_Setup
  • Vehicles
  • v2