Skip to content

[Core] Fix BasicSecurityRealm for registry users added by other modules - #367

Draft
tipatterson-dev wants to merge 2 commits into
masterfrom
bugfix/core/366-realm-state-save
Draft

tipatterson-dev wants to merge 2 commits into
masterfrom
bugfix/core/366-realm-state-save

Conversation

@tipatterson-dev

Copy link
Copy Markdown
Member

Fixes #366.

What changed

BasicSecurityRealm no longer assumes that every registry entry is a PermissionsConfig. It is the only file changed in src/main. No API change.

  • Save: writes only PermissionsConfig entries. The document is built before the file is opened, so a failed save leaves the existing file as it is.
  • Load: skips unknown IDs, entries of another class and unknown properties. A bad file is reported as SensorHubException; the node starts and the file is kept.
  • Permission updates: for a user of another class or an unknown ID, the realm changes nothing and logs a warning.

Behaviour to know

The realm holds run-time permissions only for PermissionsConfig entries. A user of another class gets its access from its roles. A module that wants its users to hold run-time permissions makes its user class extend UserConfig.

Tests

  • New TestBasicSecurityRealm (9 tests).
  • All osh-core module tests pass.
  • Checked on a live node with a module that adds its own users: node stop, the next start, and CS API creates.

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.

[Core] BasicSecurityRealm fails on registry users added by other modules

1 participant