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
Hide whitespace changes
Inline Side-by-side
Customers.md
View page @ aae0177f
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Unlike the other data, customers (private individual or company) are stored in a specific manner, so that Unlike the other data, customers (private individual or company) are stored in a specific manner, so that
* clients (=private individuals) can log in * 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 * 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. 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: ...@@ -56,7 +56,29 @@ Companies can be retrieved with the equivalent query:
## Client Agendas ## 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. "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 ...@@ -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. 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 ## Administration
### Create Client ### Create Client
...@@ -252,19 +313,4 @@ To list all clients assigned to a company, join system.client via owning_client ...@@ -252,19 +313,4 @@ To list all clients assigned to a company, join system.client via owning_client
"prefetch" : "owning_client", "prefetch" : "owning_client",
"join" : {"owning_client" : "assignment__core_customer__assigned_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