Skip to content

Feature: "All containers" toggle for admins sitewide; add additional docker build failsafe's. #374

Open
cmyers-mieweb wants to merge 4 commits into
mainfrom
cmyers_issue112
Open

Feature: "All containers" toggle for admins sitewide; add additional docker build failsafe's. #374
cmyers-mieweb wants to merge 4 commits into
mainfrom
cmyers_issue112

Conversation

@cmyers-mieweb

@cmyers-mieweb cmyers-mieweb commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Issue: #374

This pull request introduces an "All Containers" admin view to the container management system, allowing admins to see every container on a site, including the owner of each container. It also refactors the Docker Compose setup to prevent race conditions during dependency installation, and extends the API, client types, and OpenAPI schema to support the new functionality.

Admin "All Containers" View and API Enhancements:

  • Added a new /sites/{siteId}/containers/all API endpoint (admin-only) that returns all containers for a site, including the owner field, with support for filtering by nodeId, hostname, and username. [1] [2] [3] [4]
  • Updated the OpenAPI schema to document the new endpoint, the owner field on containers, and the new query parameters. [1] [2] [3]
  • Updated the backend container serialization and query logic to include the owner field and to support flexible filtering for both user and admin list endpoints. [1] [2] [3] [4]

Frontend: Containers List Page and API Integration:

  • Enhanced the ContainersListPage to support an "all"/"mine" toggle (visible to admins), display the container owner in the "All" view, and handle new query parameters for filtering. [1] [2] [3] [4] [5] [6] [7] [8]
  • Updated client-side types and queries to handle the owner field and the new listAllContainers API. [1] [2] [3]

Docker Compose Dependency Installation Improvements:

  • Refactored the Docker Compose setup so only the node service runs npm ci (with --ignore-scripts and manual patching), preventing race conditions and ensuring reliable dependency setup for both server and client. The client service now waits for node to finish before building. [1] [2] [3]
image image image image

Issue: #112

Expose an admin-only API and UI to list every container on a site and add owner metadata. Server: add apiAdmin, include owner in serialized containers, introduce CONTAINER_INCLUDE and buildContainerListWhere to centralize eager-loading and filtering, reuse includes for list/show routes, and add GET /sites/{siteId}/containers/all (with username/nodeId/hostname filters). Client: add route /containers/all and scope prop to ContainersListPage, query keys and listAllContainers API call, owner type, admin toggle to switch between "Mine" and "All", and show owner column when viewing all. OpenAPI: document owner property, nodeId query param, and new /containers/all path. Compose: make the node service the single owner of npm installs (use --ignore-scripts + patch-package) and make the client wait for node to finish to avoid concurrent install races. images/proxmox-ve: handle partially-created LXC configs by checking for lingering create locks and missing arch, tearing down remnants and recreating to avoid wedging boots.
Comment thread compose.yml Outdated
Comment thread images/proxmox-ve/create-manager.sh Outdated
Comment thread create-a-container/openapi.v1.yaml Outdated
Allow listing containers by owner via a `user` query param and propagate that across API, client, and docs. Server: add resolveUsernameFilter to enforce admin-only access for `user='*'` or other owners, apply the username constraint to the existing /containers endpoint, and remove the legacy /containers/all route; update OpenAPI to document the new `user` query and 403 response. Client: update query keys and listContainers to send the `user` param, change routing to use ?user=* for the "All" view, and make ContainersListPage read the user query param so the view is bookmarkable. Dev environment: adjust compose.yml to use node:24-trixie and run npm installs/builds in the client service (simplify install steps and watch behavior). images/proxmox-ve: clarify create-manager.sh comments and simplify the partial-create detection logic to rely on the create lock. These changes make owner-scoped listing explicit, bookmarkable, and consistently enforced.
@runleveldev

Copy link
Copy Markdown
Collaborator

It's not a blocker to this PR, but can we see why the job for the preview container failed and get another issue opened. https://github.com/mieweb/opensource-server/actions/runs/28060284274/job/83073005593?pr=374

* @param {{ user: string, isAdmin: boolean }} session - req.session
* @returns {string|undefined} username to filter by, or undefined for "all"
*/
function resolveUsernameFilter(requestedUser, session) {

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.

I think this function should work differently. I'm thinking of the permissions like a venn-diagram. The two circles are "Requested User" and "Containers you have access to". For an admin (who has access to all containers) they always get the middle bit. For a non-admin, who only has access to their own containers, the venn-diagram should be a circle, but if they request a user other than themselves they get nothing instead. What I'm trying to get at is I don't want this to be a hard 403 failure for someone who's non admin. Consider

Is Admin Requested User Returned Containers
N Own Own
N All Own
N Someone else None
Y Own Own
Y All All
Y Someone else Theirs

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.

The low-level idea here is to leave the door open for a more complex permission model in the future. There's a universe where we want a non-admin gets access to containers they don't own but still let them filter by username using this same mechanism.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

resolveUsernameFilter now returns the requester's own username for non-admins requesting user=* (instead of 403). Admins still get all owners, however requesting a specific other owner still 403s.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

once this merges I'll work on "group" functionality and container sharing between individuals and created groups

Comment thread create-a-container/openapi.v1.yaml Outdated
Owner filter. Omitted/empty returns the requesting user's own
containers (default). `*` returns every owner on the site and a
specific username returns that owner's containers; both are
admin-only and yield 403 for non-admins (except requesting yourself).

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.

Per my other comment, rather than returning 403, I want the returned list to be the logical intersection of containers I have access to and containers I requested. See that comment for more details.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

see above

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.

2 participants