Skip to content

Feat/issue 935 mm project role - #943

Merged
MarcelGeo merged 3 commits into
masterfrom
feat/issue-935-mm-project-role
Sep 17, 2026
Merged

MarcelGeo merged 3 commits into
masterfrom
feat/issue-935-mm-project-role

Conversation

@harminius

@harminius harminius commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Resolves #935
Depends on MerginMaps/python-api-client#323

Adds @mm_project_role, a project-scoped QGIS variable holding the current user's role on the active Mergin Maps project.

The value comes from the project's own metadata, so it resolves offline and costs nothing to read.

  • Add @mm_project_role — the variable is written alongside the other mm_project_* variables, and re-read after project_status() (so it follows a role change even when there is nothing to sync), after a completed sync, and when a project is opened or created.
  • Refresh project role from the server — asks the server for the current role and stores it, on every project switch and once when the client first appears. Project switching is the main path. The call in create_manager() covers the project QGIS restores at startup, which is read before initGui has built a client to ask with. Prefers project_info_v2, which carries the role without the file list, and falls back to v1

Any failure leaves the stored role alone so an offline start behaves as before.

image

@harminius
harminius force-pushed the feat/issue-935-mm-project-role branch from 38a257a to badef90 Compare September 17, 2026 10:31
@MarcelGeo
MarcelGeo merged commit 0e77e04 into master Sep 17, 2026
8 checks passed
@MarcelGeo
MarcelGeo deleted the feat/issue-935-mm-project-role branch September 17, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add @mm_project_role QGIS variable for the current user's project role

2 participants