Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
persist-credentials: false

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
distribution: temurin
java-version: ${{ matrix.java }}
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '24.22.1'
node-version: '24.22.3'

- name: Build the web client
working-directory: oie-web-client
Expand Down Expand Up @@ -209,7 +209,7 @@ jobs:
persist-credentials: false

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
distribution: temurin
java-version: ${{ matrix.java }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
persist-credentials: false

- name: Set up JDK 17
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
distribution: temurin
java-version: '17'
Expand Down
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Then:
```bash
mvn clean install # 'mvn package' at the root also works (verified on a fresh repo; the release workflow uses it) — install additionally puts the jars in ~/.m2
```
The packaging step downloads Node.js v24.21.0 (frontend-maven-plugin), installs the web UI's dependencies with `npm ci`, builds `webadmin/web/plugin.js` (gitignored), and runs the web UI's unit tests in the test phase, so the first build needs network access beyond Maven Central.
Output: `package/target/rbac-1.3.0.zip`
The packaging step downloads Node.js v24.22.3 (frontend-maven-plugin), installs the web UI's dependencies with `npm ci`, builds `webadmin/web/plugin.js` (gitignored), and runs the web UI's unit tests in the test phase, so the first build needs network access beyond Maven Central.
Output: `package/target/rbac-1.4.0.zip`

## Architecture

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Running OIE 4.6.0? Use [rbac 1.1.4](https://github.com/diridium-com/role-based-a

Web admin ready: the same zip ships both UIs. Role management and role-based task gating work in the desktop (Swing) Administrator and in the [OIE Web Administrator](https://github.com/diridium-com/role-based-access-control/wiki/Web-Administrator), with matching behavior in each. The web UI's permission gating is also more complete than Swing's, which cannot hide buttons inside panel bodies (an engine limitation that applies to all plugins); either way, denied operations always fail server-side. On servers where the Web Administrator isn't used, the web module is inert.

Data Pruner uses its own View Settings, Save Settings, and Start / Stop grants; channel Start/Stop permission does not grant pruning access. The web manifest marks RBAC as an authorization plugin so compatible web clients can stop startup if it cannot load. Failed permission loads stay closed until both permission APIs recover. Recovery restores the Roles tab when View Roles is granted. A page that showed Access denied while permissions were failing has to be opened again. [Web client 1.1.0](https://github.com/gibson9583/oie-web-client/releases/tag/v1.1.0) or later is also required to hide Data Pruner actions and restricted navigation correctly; rbac 1.3.0 was tested against web client 1.1.0 and 1.3.0.
Data Pruner uses its own View Settings, Save Settings, and Start / Stop grants; channel Start/Stop permission does not grant pruning access. The web manifest marks RBAC as an authorization plugin so compatible web clients can stop startup if it cannot load. Failed permission loads stay closed until both permission APIs recover. Recovery restores the Roles tab when View Roles is granted. A page that showed Access denied while permissions were failing has to be opened again. [Web client 1.1.0](https://github.com/gibson9583/oie-web-client/releases/tag/v1.1.0) or later is also required to hide Data Pruner actions and restricted navigation correctly; rbac 1.4.0 was tested against web client 1.1.0 and 1.3.0.

An unavailable permission snapshot gets at most three automatic retries, 15 seconds apart. Subsequent task checks retain the throttled lazy retry, and signing out cancels pending retries.

Expand All @@ -26,7 +26,7 @@ Full documentation is in the [wiki](https://github.com/diridium-com/role-based-a

- JDK 17
- Maven 3.x
- Network access on the first build: the engine jar script below downloads the OIE distribution, and the packaging step downloads Node.js v24.21.0 (via frontend-maven-plugin) to build the web administrator UI in `webadmin/`
- Network access on the first build: the engine jar script below downloads the OIE distribution, and the packaging step downloads Node.js v24.22.3 (via frontend-maven-plugin) to build the web administrator UI in `webadmin/`

## Build

Expand All @@ -49,7 +49,7 @@ This runs the Java tests and the web UI's unit tests; `-DskipTests` skips both.
The distributable zip lands at:

```
package/target/rbac-1.3.0.zip
package/target/rbac-1.4.0.zip
```

## Testing
Expand All @@ -62,7 +62,7 @@ package/target/rbac-1.3.0.zip
To run `e2e` locally you need Java 17 or later, Docker for every database but Derby, and the OIE distribution for the POM's `mc.version` (`oie_unix_4_7_0.tar.gz` from the engine's release):

```bash
python3 e2e/run.py --db postgres --zip package/target/rbac-1.3.0.zip \
python3 e2e/run.py --db postgres --zip package/target/rbac-1.4.0.zip \
--tarball oie_unix_4_7_0.tar.gz --work /tmp/rbac-e2e-1
```

Expand Down
14 changes: 10 additions & 4 deletions e2e/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
from oie import Api

PASSWORD = "Rbac-e2e-" + b.new_id()[:12] + "!"
# The schema version each release in upgrade-sources.txt leaves behind, and the latest one. A release added there
# without an entry here fails the upgrade's schema-step check.
SCHEMA_LEFT_BY = {"1.1.2": 2, "1.1.3": 2, "1.1.4": 2, "1.2.0": 2, "1.3.0": 4}
LATEST_SCHEMA = 4
# rbac writes these at WARN on purpose: every refusal, the blocked deletion of the last admin user, the made-up grant
# the unregistered-grant check gives a role, and, on an engine that doesn't label them, the operations the label checks
# call as a role without the label's permission.
Expand Down Expand Up @@ -333,16 +337,18 @@ def upgrade(r, engine, db, dbname, new_zip, old_zip, upgrade_engine=None, **_):
got = b.user_role(api, uid)
r.check(f"{name} holds the admin role again", admin_role and got and got["id"] == admin_role["id"], str(got))
else:
# Releases before schema step v3 left SQL Server's text columns VARCHAR; every release before v4 lacks the
# restricted column, which v4 adds and sets for the roles that have channel rows.
# The upgrade runs every schema step after the one the old release left: v3 converts SQL Server's text columns
# to NVARCHAR (on SQL Server only), and v4 adds the restricted column and sets it for the roles that have
# channel rows. Releases up to 1.2.0 left version 2; 1.3.0 left 4, so upgrading from it runs none.
steps = re.findall(r"Applying RBAC schema (v\d)", after)
want = ["v3", "v4"] if db.server == "sqlserver" else ["v4"]
left = SCHEMA_LEFT_BY.get(old_version, 0)
want = [f"v{n}" for n in range(left + 1, LATEST_SCHEMA + 1) if n != 3 or db.server == "sqlserver"]
r.check(f"the upgrade ran schema steps {want}", steps == want, f"ran {steps}")
now = b.roles(api)
others = {rid: role for rid, role in snapshot.items() if not role["isAdmin"]}
r.check("every non-admin role is kept as it was", {rid: now.get(rid) for rid in others} == others,
f"{others} -> {now}")
r.check("v4 set the restricted flag for the role with channel rows and not for the others",
r.check("the role with channel rows is restricted and the others aren't",
now.get(rid, {}).get("restricted") is True
and all(role["restricted"] is False for rid2, role in now.items() if rid2 != rid), str(now))
old_admin = next(role for role in snapshot.values() if role["isAdmin"])
Expand Down
2 changes: 2 additions & 0 deletions e2e/upgrade-sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
# 1.1.3: built for OIE 4.6.0, the Oracle fix.
# 1.1.4: the last release for OIE 4.6.0.
# 1.2.0: the first release for OIE 4.7.0.
# 1.3.0: role export and import, and a restricted role that can have no channel (schema version 4).
1.1.2 59bd1e9729c7badb193bbb9ecc4765870b37561ae7ea106c7e72cd3072e2f7ba https://github.com/diridium-com/role-based-access-control/releases/download/v1.1.2/rbac-1.1.2.zip
1.1.3 d77e894fa93117609bb72baf73cf62fb3ea5fc31943e417d7280e440580aad57 https://github.com/diridium-com/role-based-access-control/releases/download/v1.1.3/rbac-1.1.3.zip
1.1.4 7e3ce2a9c55c399b4f7db04e73a4b5d4d8dab8f9f9522d3d44c2ae0ed1d7749d https://github.com/diridium-com/role-based-access-control/releases/download/v1.1.4/rbac-1.1.4.zip
1.2.0 b622861432b16739bd2c9b94e30ba529ecf6c343addbe91ed57cfe53646f3488 https://github.com/diridium-com/role-based-access-control/releases/download/v1.2.0/rbac-1.2.0.zip
1.3.0 f540cc77ebfadda88147f07fce412caff41abf30ad302ddca61f0b3f422d0cfd https://github.com/diridium-com/role-based-access-control/releases/download/v1.3.0/rbac-1.3.0.zip
2 changes: 1 addition & 1 deletion oie.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Enforces role-based access control with dynamic roles, per-permission grants, and channel-level restrictions.",
"type": "plugin",
"ui": ["web", "swing"],
"version": "1.3.0",
"version": "1.4.0",
"minEngineVersion": "4.7.0",
"maxEngineVersion": "4.7.0",
"filename": "rbac-{version}.zip",
Expand Down
2 changes: 1 addition & 1 deletion package/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<id>install-node-and-npm</id>
<phase>generate-resources</phase>
<goals><goal>install-node-and-npm</goal></goals>
<configuration><nodeVersion>v24.22.1</nodeVersion></configuration>
<configuration><nodeVersion>v24.22.3</nodeVersion></configuration>
</execution>
<!-- ci, not install: installs exactly what package-lock.json pins and
fails if package.json and the lockfile disagree. -->
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<packaging>pom</packaging>

<properties>
<revision>1.3.0</revision>
<revision>1.4.0</revision>

<plugin.supported.mc.versions>${mc.version}</plugin.supported.mc.versions>

Expand Down
52 changes: 17 additions & 35 deletions webadmin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions webadmin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rbac-webadmin",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -9,7 +9,7 @@
"e2e": "playwright test"
},
"devDependencies": {
"@playwright/test": "^1.61.0",
"@playwright/test": "^1.65.1",
"esbuild": "^0.28.2"
}
}
2 changes: 1 addition & 1 deletion webadmin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "rbac",
"name": "Role-Based Access Control",
"version": "1.3.0",
"version": "1.4.0",
"author": "Diridium Technologies Inc.",
"description": "Role management and role-based UI hiding for the web administrator: a Role-Based Access Control settings tab (roles, permission grants, channel restrictions, user assignments) plus task-permission enforcement that hides navigation and task buttons the user's role does not grant. Web administrator UI for the role-based-access-control engine plugin.",
"oie": { "apiMin": "4.6" },
Expand Down
Loading