Skip to content

Add support for user roles - #4750

Open
xkello wants to merge 1 commit into
masterfrom
feature/add-support-for-user-roles
Open

xkello wants to merge 1 commit into
masterfrom
feature/add-support-for-user-roles

Conversation

@xkello

@xkello xkello commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #4648

Adds the @mm_project_role variable, which returns the current user's role on the open project, so expressions and default values can depend on it.

What changed

  • VariablesManager::setProjectVariables() sets mm_project_role from the role cached in the project metadata, next to the other mm_project_* variables.
  • removeMerginProjectVariables() also removes mm_project_role.
  • The variable is refreshed when the server reports a new role (projectRoleUpdated) and on sign in or sign out (authChanged).
  • New TestVariablesManager::testProjectRoleVariable().

Behaviour

  • Returns the role as text: reader, editor, writer or owner.
  • Works offline using the cached role, and is updated after syncing.
  • Empty when signed out, and not set for projects that are not Mergin projects.

@xkello
xkello requested a review from Withalion October 13, 2026 06:55
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38890653555

Coverage increased (+0.2%) to 60.097%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 14 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

14 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
mm/app/variablesmanager.cpp 13 87.32%
mm/app/layerfeaturesmodel.cpp 1 81.77%

Coverage Stats

Coverage Status
Relevant Lines: 15841
Covered Lines: 9520
Line Coverage: 60.1%
Coverage Strength: 93.96 hits per line

💛 - Coveralls

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 74061 dmg Expires: 11/01/2027 #7406
linux Build 📬 Mergin Maps 74321 x86_64 Expires: 11/01/2027 #7432
win64 Build 📬 Mergin Maps 66081 win64 Expires: 11/01/2027 #6608
Android Build 📬 Mergin Maps 871851 APK [arm64-v8a] Expires: 11/01/2027 #8718
📬 QR code Google Play Store #8718
Android Build 📬 Mergin Maps 871811 APK [armeabi-v7a] Expires: 11/01/2027 #8718
📬 QR code Google Play Store #8718
iOS Build ❌ Build failed or not found. #9658

Comment on lines +146 to +148
QFile qgzFile( projectDir + "/" + projectName + ".qgz" );
QVERIFY( qgzFile.open( QIODevice::WriteOnly ) );
qgzFile.close();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the point of this block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creates an empty .qgz so LocalProjectsManager::findQgisProjectFile() finds a project file

@Withalion

Copy link
Copy Markdown
Collaborator

Also rebase it on current master for iOS to pass as well

@xkello
xkello force-pushed the feature/add-support-for-user-roles branch from fd3a5e7 to b53964d Compare October 16, 2026 10:57
@github-actions

Copy link
Copy Markdown

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 74181 dmg Expires: 14/01/2027 #7418
linux Build 📬 Mergin Maps 74441 x86_64 Expires: 14/01/2027 #7444
win64 Build 📬 Mergin Maps 66201 win64 Expires: 14/01/2027 #6620
Android Build 📬 Mergin Maps 873011 APK [armeabi-v7a] Expires: 14/01/2027 #8730
📬 QR code Google Play Store #8730
Android Build 📬 Mergin Maps 873051 APK [arm64-v8a] Expires: 14/01/2027 #8730
📬 QR code Google Play Store #8730
iOS Build 📬 Build number: 26.10.967011 #9670

@xkello
xkello requested a review from tomasMizera October 19, 2026 11:43
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