Conversation
c622e28 to
fbfa6e6
Compare
This reverts commit 740391c.
* Add OPA client for admin rights checking
- New OPA client module (src/lib/server/opa.ts) using plain fetch
- Separate handleOpaAdmin middleware hook (fail-closed)
- Admin status exposed to client via event.locals.isAdmin and $page.data
- Prometheus metrics: opa_request_duration_seconds + opa_request_total
- Helm chart for OPA 1.16.2 (dev/opa/)
- Sample Rego policy with admin email domain check
- Dev setup: alice is admin (alice@admin.example.com)
- Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars
* Replace custom OPA fetch client with @open-policy-agent/opa SDK
Uses OPAClient.evaluate() with fromResult callback instead of raw fetch.
Same external interface (checkAdmin), same error handling (fail-closed).
* fix YAML format
* fix YAML format
* fix YAML format
* fix: handle bare boolean responses from OPA admin check
The fromResult callback expected { admin: true } but OPA may return a
bare boolean. Now handles both formats.
* chore: remove merge artifact feature flags
Remove unused archivePreviewMaxBytes and commented-out env vars
(INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no
corresponding code.
---------
Co-authored-by: F3l1x1vo <fli@ordix.de>
286a34a to
7a7d76c
Compare
* #270 add bookmark dialog * add edit bookmarks dialog * fix cancel editing bookmark * fix darkmode for icons, cursor pointer over boxes * update product icons to use colored versions where possible * scaled icons down to 64x64 * Revert "scaled icons down to 64x64" This reverts commit 740391c. * revert image downscale, use svelte enhanced image component to downscale images * #271 overhaul dashboard layout design * fix unit test * Add OPA client for admin rights checking (#276) * Add OPA client for admin rights checking - New OPA client module (src/lib/server/opa.ts) using plain fetch - Separate handleOpaAdmin middleware hook (fail-closed) - Admin status exposed to client via event.locals.isAdmin and $page.data - Prometheus metrics: opa_request_duration_seconds + opa_request_total - Helm chart for OPA 1.16.2 (dev/opa/) - Sample Rego policy with admin email domain check - Dev setup: alice is admin (alice@admin.example.com) - Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars * Replace custom OPA fetch client with @open-policy-agent/opa SDK Uses OPAClient.evaluate() with fromResult callback instead of raw fetch. Same external interface (checkAdmin), same error handling (fail-closed). * fix YAML format * fix YAML format * fix YAML format * fix: handle bare boolean responses from OPA admin check The fromResult callback expected { admin: true } but OPA may return a bare boolean. Now handles both formats. * chore: remove merge artifact feature flags Remove unused archivePreviewMaxBytes and commented-out env vars (INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no corresponding code. --------- Co-authored-by: F3l1x1vo <fli@ordix.de> * chore: dedupe packages * #270 add admin check to pinning, add OPA tests * fix unit test * #270 show pin for all only to admins * fix unit test * pull from feat/app-bookmark-dialog * pull from feat/app-bookmark-dialog --------- Co-authored-by: dklOrdix <dkl@ordix.de>
… as tools inside the cockpit (#283) * #270 add bookmark dialog * add edit bookmarks dialog * fix cancel editing bookmark * fix darkmode for icons, cursor pointer over boxes * update product icons to use colored versions where possible * scaled icons down to 64x64 * Revert "scaled icons down to 64x64" This reverts commit 740391c. * revert image downscale, use svelte enhanced image component to downscale images * #275 allow users to pin bookmarks * #275 #280 add bookmarks to sidebar navigation, show external apps in cockpit * fix unit test * Add OPA client for admin rights checking (#276) * Add OPA client for admin rights checking - New OPA client module (src/lib/server/opa.ts) using plain fetch - Separate handleOpaAdmin middleware hook (fail-closed) - Admin status exposed to client via event.locals.isAdmin and $page.data - Prometheus metrics: opa_request_duration_seconds + opa_request_total - Helm chart for OPA 1.16.2 (dev/opa/) - Sample Rego policy with admin email domain check - Dev setup: alice is admin (alice@admin.example.com) - Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars * Replace custom OPA fetch client with @open-policy-agent/opa SDK Uses OPAClient.evaluate() with fromResult callback instead of raw fetch. Same external interface (checkAdmin), same error handling (fail-closed). * fix YAML format * fix YAML format * fix YAML format * fix: handle bare boolean responses from OPA admin check The fromResult callback expected { admin: true } but OPA may return a bare boolean. Now handles both formats. * chore: remove merge artifact feature flags Remove unused archivePreviewMaxBytes and commented-out env vars (INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no corresponding code. --------- Co-authored-by: F3l1x1vo <fli@ordix.de> * fix unit test * Add OPA client for admin rights checking (#276) * Add OPA client for admin rights checking - New OPA client module (src/lib/server/opa.ts) using plain fetch - Separate handleOpaAdmin middleware hook (fail-closed) - Admin status exposed to client via event.locals.isAdmin and $page.data - Prometheus metrics: opa_request_duration_seconds + opa_request_total - Helm chart for OPA 1.16.2 (dev/opa/) - Sample Rego policy with admin email domain check - Dev setup: alice is admin (alice@admin.example.com) - Configurable via STACKABLE_COCKPIT_OPA_ENABLED/URL/TIMEOUT env vars * Replace custom OPA fetch client with @open-policy-agent/opa SDK Uses OPAClient.evaluate() with fromResult callback instead of raw fetch. Same external interface (checkAdmin), same error handling (fail-closed). * fix YAML format * fix YAML format * fix YAML format * fix: handle bare boolean responses from OPA admin check The fromResult callback expected { admin: true } but OPA may return a bare boolean. Now handles both formats. * chore: remove merge artifact feature flags Remove unused archivePreviewMaxBytes and commented-out env vars (INFINITE_SCROLL, CUT_COPY, PASTE, RENAME, MOVE) that have no corresponding code. --------- Co-authored-by: F3l1x1vo <fli@ordix.de> * fix auth port, implement open in new tab option, fix custom link resolve * #270 add admin check to pinning, add OPA tests * fix unit test * #270 show pin for all only to admins * fix unit test * pull from feat/app-bookmark-dialog --------- Co-authored-by: dklOrdix <dkl@ordix.de>
# Conflicts: # TECH_DEBT.md # src/lib/server/auth.ts
|
|
Bohreromir
left a comment
There was a problem hiding this comment.
Unless I do miss something the whole PinForEveryone does not work as its only stored in LocalStorage. Opa could then be removed too.
I havent yet read the whole thing, but I think this is enough for the meantime.
Feel free to ask for any clarifications.
| pinned, | ||
| // Only admins can set the "pin for everyone" flag; non-admins keep the | ||
| // existing value (e.g. when editing a bookmark pinned by an admin). | ||
| pinnedForEveryone: isAdmin ? pinnedForEveryone : (bookmark?.pinnedForEveryone ?? false) |
There was a problem hiding this comment.
Okay, I didn't knew that. So the way is forward is: merge this and s3-file-browser, then create a new pr in which its saved to the db?
Do we have an Issue for that?
|
@Bohreromir #278 (comment) |
|
|
||
| # OPA (Open Policy Agent) — admin rights checking | ||
| # STACKABLE_COCKPIT_OPA_ENABLED=true # Enable OPA admin checks (default: true) | ||
| # STACKABLE_COCKPIT_OPA_ENABLED=true # Enable OPA admin checks (default: false) |
There was a problem hiding this comment.
still does not line up. Env is set to true, comment here says false and the comment in src/lib/server/feature-flags.ts says false too. Its three places that need to line up
This PR adds a bookmark modal for adding and editing bookmarks. Currently, they are saved in localStorage (not a database like we hoped. The database is a v1 feature of the S3 Storage Browser and not yet available on the parent branch). Migrating these bookmarks to the database is an issue for later (#277).
The bookmarks are currently shown in a section on the dashboard but we will change the display of these as well (#271)
Closes #270