Introducing a new way to review your PRs.

Read the announcement

frappe / insights

Open Source Business Intelligence Tool

View on GitHub

25 documents · Updated Nov 23, 2026

docs / access-and-collaboration

Access and collaboration

Insights controls access through the signed-in user and uses that identity to join roles, ownership, direct shares, and team membership. This model lets people work together on workbooks, queries, charts, dashboards, and alerts while keeping data-source access separate from access to an analytical asset.

Access model

Session identity

The current Frappe session identifies the actor for every Insights request. An Insights user can use protected application actions, while an Insights admin has wider control over users, teams, and resources; the Administrator and System Manager also receive admin treatment in the access layer. The same identity is used to resolve ownership, direct shares, team membership, and the user’s view history. For unattended execution, the recorded publishing user supplies the permission context because no person is present in the session. See Authorization and user administration for the detailed permission rules.

References: insights/decorators.py• L13-46 insights/permissions.py• L36-69 insights/permissions.py• L433-450 insights/…/insights_team.py• L166-199 insights/…/__init__.py• L29-61

Resource access

Insights combines several access paths rather than treating all resources as isolated records. A person can reach an asset because they own it, because it is shared with them or with the organization, because it belongs to a workbook, chart, or dashboard that they can use, or because a team grants the resource. Team permissions add a separate path for data sources and tables. This relationship allows a shared dashboard to expose the analytical work behind it without making unrelated resources visible.

The access setting controls whether team membership limits team-based resources. When it is off, data sources and tables are broadly available to Insights users. Ownership and explicit sharing still govern workbooks and other analytical assets. When it is on, a user must have a matching team grant for protected sources, tables, charts, or dashboards.

Links between analytical resources also carry access meaning. A chart cannot be linked to a query that its author cannot read, and a dashboard cannot include a chart that the acting user cannot read. These checks stop a new link from widening access to content that the actor could not already use.

The resource chain is summarized below. A read or write decision still depends on the permission requested and on the current session.

flowchart LR
    U[Session user] --> R[Role and admin status]
    U --> O[Ownership]
    U --> S[Direct or organization share]
    U --> T[Team membership]
    O --> W[Workbook]
    S --> W
    T --> D[Data source and table access]
    T --> C[Charts]
    T --> B[Dashboards]
    W --> Q[Queries]
    W --> C
    W --> B
    C --> Q
    B --> C
    B --> Q
    Q --> A[Alerts]

References: insights/permissions.py• L70-142 insights/permissions.py• L153-202 insights/permissions.py• L204-339 insights/permissions.py• L341-407 insights/permissions.py• L409-430 insights/…/insights_settings.json• L73-84

Data access boundaries

Asset access does not replace access to the data that an asset uses. Team grants can name a data source or a table, and a table grant can also carry a row filter. The data-source layer applies the user’s normal Frappe row rules when it previews or counts data, so a user does not gain access to rows only because another user shared a workbook or dashboard.

References: insights/…/insights_team.py• L87-133 insights/…/insights_team.py• L241-324 insights/…/test_data_source_permissions.py• L26-89

User workflows

User discovery

The user directory supports sharing and user administration. By default, it lists enabled users with an Insights role and exposes only the profile fields needed for that work. A site can disable lookup for ordinary members; in that mode, a member can still share by entering a known address, while an admin keeps the full directory for management.

References: insights/…/user.py• L16-96 insights/…/insights_settings.json• L136-153 insights/…/test_permissions.py• L149-210

User invitation

An Insights admin starts onboarding by sending an invitation to one or more email addresses. The invitation remains pending for one day, then becomes invalid if it was not accepted. Acceptance creates the Frappe user when needed, grants the Insights User role, and signs the new user into Insights.

The invitation state is part of the user-management view. Pending and expired invitations can appear beside active users for admins, but they are not active access grants until acceptance completes.

References: insights/…/user.py• L217-267 insights/…/insights_user_invitation.py• L8-60 insights/…/insights_user_invitation.py• L62-98 insights/…/insights_user_invitation.json• L16-54

Profile changes

Users can update their own profile. An admin can update another user’s profile, but a normal member cannot use the profile endpoint to change someone else’s details. This keeps user administration tied to the same session identity that governs resource access.

References: insights/…/user.py• L269-282

Team workflows

Team membership

An Insights team groups users around a shared access need. Each team has members and resource grants, and a user can belong to more than one team. The effective access for a user is the union of the resources granted by all of that user’s teams.

The team listing returns an empty result when the signed-in user can read no teams. This is a valid empty state rather than an error. Team creation, membership changes, resource selection, and deletion are admin workflows. The built-in Admin team is special: it cannot be renamed or deleted, it must keep at least one member, and its membership tracks the Insights Admin role.

See Teams and resource access for the team resource model and management experience.

References: insights/…/user.py• L99-215 insights/…/insights_team.py• L16-78 insights/…/insights_team.json• L10-36

Team-based access

When team permissions are enabled, a member sees the data sources and tables granted to at least one of their teams. Teams can also grant selected charts and dashboards. Granting a data source makes its tables available; granting selected tables gives narrower access. Ownership and direct sharing remain valid paths for analytical resources.

Changes to team membership or grants invalidate the cached access view. New requests then use the updated team state, so collaboration changes affect later reads and writes without changing the resource itself.

References: insights/…/insights_team.py• L105-133 insights/…/insights_team.py• L166-222 insights/permissions.py• L144-193 insights/permissions.py• L257-275 insights/permissions.py• L317-339 insights/permissions.py• L409-430 insights/permissions.py• L400-417

Collaboration workflows

Workbook sharing

A workbook is the main collaboration boundary for analytical work. Its owner can grant a named Insights user read or write access, or share it with the organization for view or edit access. The share operation replaces the old recipient list with the new one and rejects people who do not have an Insights role, with Administrator allowed for system-created workbooks.

Queries, charts, and dashboards linked to a workbook follow its access path. A read-only workbook share lets a collaborator use the work without giving them write access to change the workbook.

See Workbooks and analytical assets for the workbook lifecycle.

References: insights/…/workbooks.py• L9-24 insights/…/workbooks.py• L30-89 insights/…/workbooks.py• L131-239 insights/permissions.py• L204-228

Dashboard and chart sharing

Dashboards and charts can also have their own user, organization, or public sharing state. Dashboard sharing grants view access to named users or the organization, while the public flag enables a guest-facing view. A public dashboard makes its linked charts and their linked queries available through the shared presentation path.

This gives teams two useful collaboration patterns: share a working asset with known Insights users, or publish a finished view for people who do not have an Insights session. Public access is limited to supported dashboard, chart, and query relationships.

See Dashboards and visualization for the presentation flow.

References: insights/…/insights_dashboard_v3.py• L165-260 insights/…/shared.py• L6-32 insights/…/shared.py• L35-130 insights/permissions.py• L230-339 insights/permissions.py• L457-489

Access change flow

When a person opens or changes an Insights resource, the system evaluates the session before it returns data or saves a share. It also checks access-bearing links when a chart or dashboard is changed. The collaboration path is:

  1. Identify the session user.
  2. Confirm the user has an Insights role or admin status.
  3. Resolve ownership, direct or organization shares, and team membership.
  4. Check the requested permission on the target resource.
  5. Check changed chart and dashboard links against the linked resources.
  6. Check the data source and table boundary when the resource reads data.
  7. Return the resource or reject the action with a permission error.

The flow keeps asset collaboration and data protection linked without making them the same rule.

References: insights/decorators.py• L142-167 insights/permissions.py• L55-123 insights/permissions.py• L433-489 insights/…/insights_team.py• L241-309 insights/…/insights_dashboard_v3.py• L202-260

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to the Insights roles or admin definition must stay aligned with the protected API decorator, app access check, and the special Admin team.
  • Changes to team listing or visibility must preserve the valid empty state for users who can read no teams.
  • Changes to team membership or resource grants must preserve cache invalidation. Otherwise, a user can keep an old access result after an admin changes a team.
  • Changes to workbook share payloads must keep direct-user shares, organization shares, and owner visibility consistent with the permission query rules.
  • Changes to dashboard public or organization access must preserve the link from public dashboards to their charts and queries.
  • Changes to table restrictions must preserve both data preview behavior and query execution behavior. Asset sharing must not bypass row-level limits.
  • Changes to invitation status or expiry must stay aligned between the email link, acceptance endpoint, and the admin user directory.
  • Changes to chart or dashboard link checks must preserve the rule that a new link cannot grant access to an unreadable query or chart.
  • Changes to unattended query execution must preserve the permission context of the recorded publishing user.

Important failure modes

TriggerConsequenceGuard
A request comes from a user without an Insights roleProtected Insights APIs and resources reject the requestThe role check and document permission hooks run from the session identity
Team permissions are enabled but the user has no team grant for a source or tableThe resource is not visible or data access failsAdd the user to a team and grant the needed source or table
A team listing has no readable teamsThe team view must show no teams rather than failTreat an empty team result as a valid access state
A workbook is shared with a non-Insights userThe share is refused and the recipient gains no accessShare only active Insights users or invite the person first
An invitation is accepted after its one-day lifetimeThe invitation becomes expired and login does not completeSend a new invitation
A user has workbook access but lacks access to its data tableThe asset may open, but data preview or execution is blockedGrant the required table or source access and any needed row scope
A member attempts to change team membership or share an asset without share permissionThe update is rejectedUse an Insights admin for team changes or the resource owner/share grant for asset changes
A chart is linked to a query that the acting user cannot readThe chart save is rejectedGrant query access before changing the chart link
A dashboard includes a chart that the acting user cannot readThe dashboard save is rejectedGrant chart access before adding it to the dashboard
Unattended execution loses access to a referenced queryThe run fails because it is checked as the recorded publishing userKeep the publishing user’s access valid for the life of the scheduled content

Key files

FileWhy to read it
insights/permissions.pyDefines the central relationship between session users, ownership, shares, teams, linked resources, and resource permissions.
insights/decorators.pyShows how protected API calls require an Insights role.
insights/…/user.pyDescribes user lookup, invitations, profile updates, team listing, and team management actions.
insights/…/insights_team.pyExplains team membership, admin-team behavior, resource grants, and data restrictions.
insights/…/insights_user_invitation.pyDefines the invitation lifecycle from email delivery through acceptance.
insights/…/workbooks.pyShows the user and organization sharing boundary for workbooks.
insights/…/insights_dashboard_v3.pyShows direct, organization, and public dashboard access.
insights/…/shared.pyDefines which dashboard, chart, and query relationships support guest-facing access.
insights/…/insights_settings.jsonLists the site-level switches that affect team permissions, user lookup, and downloads.