MobiariDocs

Access rules

Limit what a group or a person can do beyond the permission sets, with a maximum amount, hours, a reach or only their own records.

An access rule takes away a piece of what the permission sets give. The set says what the person may do (refund orders, use the POS, view conversations); the rule says how far: up to an amount, only during certain hours, only on certain channels or locations, only on the records assigned to them. A rule is a policy of the organization: it only applies once attached to a group or a person, in this store, in some stores or in the whole organization. Rules never grant new access and never apply to the owner. After reading this page you can create the four kinds of rule, ask the assistant for one, test its effect against the store's history, attach and detach a rule, and check with Why can't they? what it is refusing.

Before you start

  • To see the rules, you need the View team permission. To create, edit, attach or delete, Manage access. The owner has all of them.
  • A rule is attached to a group (everyone in it) or to a person (a member or a service account). The store owner and the organization owner are left out: rules do not apply to them.
  • Every rule needs an Explanation: the text the team reads when the rule refuses something.
  • When several rules reach the same person, all of them apply. Two reach rules on the same thing intersect: the person only sees what is in both.

The four kinds

KindWhat it doesExample
Amount limitWhoever the rule reaches does an action only up to an amount.Cashiers may only refund orders up to R$ 200.00.
HoursWhoever the rule reaches does the picked actions only within a time window, in the store's time zone.Sellers may only use the POS between 08:00 and 20:00.
ReachWhoever the rule reaches sees and touches only the picked records of one kind: sales channels, pickup locations, inventory locations, conversation channels, ad accounts or pipelines. The orders, conversations and deals tied to them follow the same rule.The branch team only reaches the "Centro" pickup location.
Own records onlyWhoever the rule reaches sees only customers, deals or conversations assigned to them.Each seller only reaches the deals assigned to them.

The amount limit applies to refunds today

The amount rule needs the action to report how much is at stake. Today only Refund orders does; on other permissions the limit has no effect. Other actions with an amount come over time.

Create a rule

  1. Go to Settings → Team and access, Policies tab. Rules, permission sets and Cedar policies share one list; filter by Rule to see only them.
  2. Click New policy and pick Rule.
  3. Give it a Name (for example "Cashier refund limit") and pick the Rule kind.
  4. Fill in what the kind asks for:
    • Amount limit: the Permission and the Maximum amount (R$).
    • Hours: From and Until (whole hours, store time) and the Permissions that only apply within them. A start after the end crosses midnight: from 22:00 until 06:00.
    • Reach: under What to limit, the record kind, and under Records reached, which ones. Check at least one.
    • Own records only: under Records, customers, deals or conversations.
  5. Under Who and where, say who the rule is attached to and where it applies:
    • Attached to: A group or A person, then which.
    • Where it applies: This store, Some stores (check which) or Whole organization.
  6. Under Explanation, write the sentence the team will read, or click Suggest text for the panel to build one from what you filled in ("Cashiers may only refund orders up to R$ 200.00"). Adjust it as you like.
  7. To double-check, click Validate: the panel says whether the rule is valid and shows, under Show the rendered Cedar, what it becomes inside.
  8. Click Create and attach.

The rule is created and attached in one go, and applies at once to whoever it reaches. To change the limit, open the rule from the list and click Edit: the change applies to everyone the rule is attached to. On the rule's page, Attached to shows who receives it; Attach takes the same rule to more people and Remove takes the attachment away from someone (see Team and access). Simulate applies the rule to the last 30 days of decisions for a group or person. Delete removes the rule and all its attachments; the warning says how many.

Write with the assistant

Instead of filling in the form field by field, describe the rule in your own words. At the top of New rule, under Write with the assistant:

  1. Write the request in the text box, for example "Maria only sees the orders of the Itaim store" or "cashiers only refund up to R$ 200". The examples below the box fill in the text with one click.
  2. Click Write rule. It takes a few seconds: the assistant knows the groups, the people, the stores, the channels, the locations and the permissions, and builds the rule with them.
  3. The form shows up filled in: the Rule kind, the kind's fields, Who and where and the Explanation. When none of the four kinds fits, the assistant writes the rule in Cedar and the kind becomes Cedar.
  4. Check everything. Under The assistant warns, it lists what it could not express or had to assume (a name matching two people, an amount left implicit). Adjust whatever you want in the form.
  5. Right below shows the Test against history of the built rule (see the next section). Check the Name and click Create and attach.

If the request describes what someone may do ("the agency only touches marketing") rather than a limit, the assistant answers with a permission set: click Open as a permission set to continue in the set editor, already filled in.

Nothing is saved until you click Create and attach. If the assistant answers that it could not write the rule, the reason shows in the box itself: rephrase the request or build the rule with the form. If the box says the assistant is not configured on this server, the form keeps working as usual.

Test against history

Before creating a rule, see what it would have changed. With the form filled in and someone picked under Attached to, click Test against history at the bottom of the dialog. The panel takes this store's access decisions of the last 30 days (up to a thousand, without the owner's), applies the rule to each one as if attached to that group or person, with the records as they are today, and shows:

  • A summary line: "In the last 30 days: 142 decisions evaluated, 3 would now be refused, 0 would now be allowed". Decisions whose record was deleted are left out and counted apart.
  • The list of decisions that would change, newest first: who, which permission, which record, when, and the decision before and after. Those that would now be refused are marked red; those that would now be allowed, green (it only happens with a permit in Cedar, since the four kinds only take access away). The list shows up to 50; the summary counts them all.

When editing a rule, pick under Test as who the test simulates: the saved rule leaves the replay and the edited version enters. A test with no changes does not mean the rule is wrong: maybe nobody tried what it limits. The test saves nothing and does not stop you from creating the rule. When you change a form field, the result goes away: click Test against history again.

Rules in Cedar

The Cedar kind takes the policy text directly in the language the panel uses inside, for people who know it or for cases the four kinds do not cover. Whoever receives the policy is written as ?principal (principal in ?principal): the panel fills it with the group or person of each attachment. The text is validated against the store's schema before saving: a policy that allows something never exceeds your own access in the stores where it applies, and the owner cannot be named. You do not need to write Cedar by hand: under Write with the assistant, describe what you want and the assistant writes the text; you just check it with Validate and Test against history.

Test with "Why can't they?"

When someone gets "no permission" and you want to know whether a rule did it, in Settings → Team and access click Explain an access at the top of the screen (or Why can't they? on the person's page). In the Why can't they? window, pick the person under Who and the action under Permission. If a rule refused, it shows under What denies it as Rule: rule name, with the group it came through in parentheses. If the result is Allowed right now, no rule reaches that person on that action at this moment (an hours rule, for example, only refuses outside the hours).

If something goes wrong

  • Invalid rule when saving or validating: the message says why: a permission that does not exist, no record checked, equal hours. In Cedar, a syntax error, a permit that exceeds your own access or a text without ?principal.
  • "The rule was created but not attached": the rule exists, but the attachment failed (for example, the chosen person is not in the organization yet). Attach it in Settings → Team and access, on the person or the group.
  • The rule refuses nothing: check in the attachments column whether it is attached to anyone, whether to the right group or person, whether it applies in this store and whether the person is not the owner. Rules do not apply to the owner.
  • The person does not see records they should: more than one reach rule hits them and the intersection came out empty. On the Policies tab, with the Rule filter, check what each one marks.

Next steps

On this page