farseer-cli 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: farseer-data-permissions
|
|
3
|
+
description: How data access decides which numbers each user of a Farseer workspace sees, and how to explain, plan, check or change it. Covers the workspace switch, each user group's Data access switch, restricting a group to some members of a dimension, hidden variables and per-group overrides, how a user's groups add up, what admins and the Default group see, and View as. Use when the user asks who can see what, why someone sees too much or too little, wants a team limited to some regions, entities or other members, wants a variable such as salaries hidden, or is about to turn data access on. Sharing decides which sheets and dashboards a user can open; this skill is about what they see inside them.
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Data access
|
|
9
|
+
|
|
10
|
+
Data access decides **what a user sees inside** the sheets and dashboards they can open: which members of each dimension, and which variables. Sharing still decides **which** items they can open at all. The usual setup is one sheet shared with everyone, with data access giving each group its own view of it: the same sheet, seen through different glasses, instead of one copy per team. Paths below are under `/api/v3`.
|
|
11
|
+
|
|
12
|
+
## The rules
|
|
13
|
+
|
|
14
|
+
1. **Admins see everything.** Super users and members of the **Super Admins** and **Admins** groups always see all data, hidden variables included. Only they change data access, and while it is on, only they read it.
|
|
15
|
+
2. **The workspace switch**, "Data access" above the Groups table in Users & groups (`GET /dataAccess`, `PUT /dataAccess`). Off, everyone sees everything, hidden variables included, as before data access existed. On, the group rules below apply. Switching it off or on keeps every group's settings.
|
|
16
|
+
3. **Each group's switch**, the Data access column of the Groups table. A group starts with it off, and while it is off the group gives its members nothing. **Default**, the group everyone is in, is always off, so a user who is only in Default sees nothing. Super Admins and Admins are always on.
|
|
17
|
+
4. **A group with its switch on sees all data except hidden variables**, and is then narrowed:
|
|
18
|
+
- **Restrictions** limit one dimension to some of its members: **Only** the listed members, where members added later stay hidden, or **All except** the listed ones, where members added later are shown. **Restrict further** adds a restriction on another dimension.
|
|
19
|
+
- **Variable overrides** (Variables → Edit) set a variable to **Show** or **Hide** for this group, or leave it at its **Default**.
|
|
20
|
+
- A switched-on group with no restriction is marked "Members see all data". It is a warning to check, not an error.
|
|
21
|
+
5. **Hidden variables.** A variable is visible by default. Marked **Hidden by default** in Edit variable, it is seen only by the groups that Show it, and by admins.
|
|
22
|
+
6. **Groups add up.** A user sees everything that any of their switched-on groups gives. Membership only ever widens the view: one group cannot take away what another gives, and a Hide in one group does not hide a variable that another of the user's groups shows. To narrow someone's view, take them out of a group or change that group's rules; never add a group to restrict them.
|
|
23
|
+
7. **No switched-on group, no data.** A user, an API key's service user or a public share link that is in no switched-on group sees no data at all.
|
|
24
|
+
|
|
25
|
+
## What a restricted user sees
|
|
26
|
+
|
|
27
|
+
- Members they may not see are gone: no row or column for them, and totals add up only the members they see. A Revenue total of 270 over North, South and East reads 210 for a user limited to North and South.
|
|
28
|
+
- A hidden variable's row keeps its name and shows no values.
|
|
29
|
+
- In Users & groups, a user who sees no data at all is marked with a red sign next to their View as button.
|
|
30
|
+
- A user restricted by data access, anyone but an admin while it is on, still enters values in the cells they see. They cannot change the model's structure (members, variables, tables), run imports or use goal seeking top down, whatever their other permissions: those stay with admins.
|
|
31
|
+
|
|
32
|
+
## Explaining why someone sees what they see
|
|
33
|
+
|
|
34
|
+
While data access is on, reading it needs an admin's sign-in; anyone else gets 403.
|
|
35
|
+
|
|
36
|
+
1. `GET /dataAccess` answers `{"enabled": true}` or `false`. Off, everyone sees everything: stop here.
|
|
37
|
+
2. `GET /users` lists every user with `id`, `email` and `dataAdmin`. A data admin sees everything.
|
|
38
|
+
3. `GET /userGroups` lists every group as `{"id", "name", "userIds"}`. The groups whose `userIds` hold the user's `id` are theirs.
|
|
39
|
+
4. `GET /dataAccess/groups` lists one entry per group: `{"userGroupId", "enabled", "fullAccess", "variables": {"show": [GID], "hide": [GID]} or null, "dimensions": [{"tableGid", "rule", "members": [GID]}]}`. A `rule` of `include` is Only, `exclude` is All except. `farseer variables list --json` and `farseer dimensions members TABLE --json` list the gids to read these by; a member's `parentId` is its table's gid.
|
|
40
|
+
5. Take the user's groups with `enabled` true and add up what they give (rule 6).
|
|
41
|
+
|
|
42
|
+
The usual answers:
|
|
43
|
+
|
|
44
|
+
- **Sees nothing:** none of their groups is switched on, or they are only in Default.
|
|
45
|
+
- **Sees too much:** one of their groups has no restriction, or Shows the variable. Every group counts, so look at all of them, not only the one the user mentions.
|
|
46
|
+
- **Cannot open the sheet at all:** that is sharing, not data access. Share the sheet with them, or with a group they are in.
|
|
47
|
+
|
|
48
|
+
## Changing data access
|
|
49
|
+
|
|
50
|
+
Only admins change data access, and only super users change who is in a group. A group's change applies at once to all its members, and the workspace switch to everyone: before you write, tell the user exactly what will change and for whom, and go on only when they confirm.
|
|
51
|
+
|
|
52
|
+
- **The workspace switch:** `PUT /dataAccess` with `{"enabled": true}` or `{"enabled": false}`.
|
|
53
|
+
- **A group:** `PUT /dataAccess/groups/{userGroupId}` with the group's whole definition. It replaces what the group had: a restriction or an override left out is removed. Read the group's entry from `GET /dataAccess/groups`, change only what you need, and send all of it back. To limit Sales to North and South and show it the hidden Salary:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{"enabled": true, "variables": {"show": [SALARY_GID], "hide": []},
|
|
57
|
+
"dimensions": [{"tableGid": REGION_TABLE_GID, "rule": "include", "members": [NORTH_GID, SOUTH_GID]}]}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Super Admins and Admins always have full access, and Default always stays off; theirs cannot be changed.
|
|
61
|
+
- **A variable's default:** read it with `GET /entities/{gid}/VAR`, set `variable.visibility` to `"hidden"` or `"visible"`, remove `variable.referencedBy`, and send the object back with `POST /entities/mutate` as `{"updated": [OBJECT]}`. `referencedBy` is read-only: an update that keeps it is refused with 400.
|
|
62
|
+
- **Membership:** `POST /userGroups/{id}/users` adds and `DELETE /userGroups/{id}/users` removes, both with `{"userIds": [USER_ID]}`.
|
|
63
|
+
|
|
64
|
+
Every change is in the audit log, under the `DATA_ACCESS.` types for rules, switches and visibility.
|
|
65
|
+
|
|
66
|
+
## Before turning data access on
|
|
67
|
+
|
|
68
|
+
Once the workspace switch is on, nobody outside Super Admins and Admins sees anything until a group gives it to them. Set up and switch on the groups first, then turn on the workspace switch, then check a member of each group with View as.
|
|
69
|
+
|
|
70
|
+
- **Integrations and scheduled imports** run as an API key's service user, and a service user is restricted like anyone else. One that runs imports or changes structure must be in Admins: an import is refused to a restricted caller, even one in a switched-on group. One that only reads or writes cell values can be in a switched-on group instead. In no switched-on group, its reads return nothing and its cell writes change nothing, without an error.
|
|
71
|
+
- **Public share links** are in no group, so they show no data.
|
|
72
|
+
- **Jobs already queued** keep the access their caller had when they were queued.
|
|
73
|
+
|
|
74
|
+
## Checking a user's view: View as
|
|
75
|
+
|
|
76
|
+
View as is in the app, for admins. Start it from Users & groups → Users → **View as** on the user's row, or from any sheet with **Share → ⋯ → View as**. The app reloads showing exactly what that user sees, read-only, under a "Viewing as" banner; **Exit** in the banner returns to your own view. An admin who is not a super user cannot view as a super user or another admin.
|
|
77
|
+
|
|
78
|
+
After a change, ask an admin to check it with View as. From the API, answer from the rules above instead.
|
|
79
|
+
|
|
80
|
+
## When a call fails
|
|
81
|
+
|
|
82
|
+
- **403 on `/dataAccess`:** the caller is not an admin. Ask someone in Super Admins or Admins to make the change, or to give the access.
|
|
83
|
+
- **A membership change is refused:** only super users change who is in a group.
|
|
84
|
+
- **400 on `/entities/mutate`:** the object still holds `variable.referencedBy`, or it is not the whole object read back.
|
|
85
|
+
- **A group's change is refused:** Super Admins, Admins and Default cannot be changed. Otherwise check each gid against the variable and member lists.
|