Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

fix(api): grant board owners read access to board images

joshistoast7af9bd10251f
diff --git a/invokeai/app/api/routers/_access.py b/invokeai/app/api/routers/_access.py
index 987e5ee077..bd0d984feb 100644
--- a/invokeai/app/api/routers/_access.py
+++ b/invokeai/app/api/routers/_access.py
@@ -48,8 +48,12 @@ def assert_image_read_access(image_name: str, current_user: CurrentUserOrDefault
Access is granted when ANY of these hold:
- The user is an admin.
- The user owns the image.
+ - The user owns the board the image sits on.
- The image sits on a shared or public board.
- The image sits on a board explicitly shared with the user.
+
+ Board-backed images defer to `assert_board_read_access` so individual image
+ reads stay consistent with board listings (including board_id="all").
"""
if current_user.is_admin:
return
@@ -62,14 +66,8 @@ def assert_image_read_access(image_name: str, current_user: CurrentUserOrDefault
board_id = ApiDependencies.invoker.services.board_image_records.get_board_for_image(image_name)
if board_id is not None:
- try:
- board = ApiDependencies.invoker.services.boards.get_dto(board_id=board_id)
- if board.board_visibility in (BoardVisibility.Shared, BoardVisibility.Public):
- return
- except Exception:
- pass
- if ApiDependencies.invoker.services.board_records.is_board_shared_with_user(board_id, current_user.user_id):
- return
+ assert_board_read_access(board_id, current_user)
+ return
raise HTTPException(status_code=403, detail="Not authorized to access this image")
diff --git a/invokeai/frontend/webv2/public/locales/en-GB.json b/invokeai/frontend/webv2/public/locales/en-GB.json
index ee1d8bb0ee..0967ef424b 100644
--- a/invokeai/frontend/webv2/public/locales/en-GB.json
+++ b/invokeai/frontend/webv2/public/locales/en-GB.json
@@ -1,157 +1 @@
-{
- "commandPalette": {
- "title": "Command palette",
- "buttonLabel": "Command palette",
- "buttonTooltip": "Command palette ({{hotkey}})",
- "inputLabel": "Search commands and settings",
- "resultsLabel": "Command palette results",
- "placeholders": {
- "root": "Search commands, settings, and more…",
- "scope": "Search {{label}}…",
- "stage": "Pick a value…"
- },
- "actions": {
- "backToAll": "Back to all results",
- "closeScope": "Close {{label}} — back to all results",
- "openInSettings": "Open in Settings",
- "openModelManager": "Open in Model Manager",
- "revealInGallery": "Reveal in Gallery"
- },
- "footer": {
- "back": "Back",
- "close": "Close",
- "navigate": "Navigate",
- "pick": "Pick",
- "run": "Run",
- "scope": "Scope"
- },
- "states": {
- "couldNotSearch": "Couldn't search {{label}}",
- "invalidDate": "Invalid date: “{{value}}”",
- "noItemsYet": "No {{label}} yet",
- "noResults": "No results for “{{query}}”",
- "partialFailure": "{{count}} results. {{failed}} searches failed.",
- "resultCount": "{{count}} results.",
- "retrySearch": "Retry {{label}} search",
- "searching": "Searching…",
- "searchingSection": "{{label}} — Searching…"
- },
- "date": {
- "aWeekAgo": "A week ago",
- "date": "Date",
- "day": "{{date}}",
- "formatHint": "Or type a date — YYYY-MM-DD, 7d, 2w, 1m",
- "from": "From {{date}}",
- "pastWeek": "Past week",
- "range": "{{from}} – {{to}}",
- "through": "Through {{date}}",
- "today": "Today",
- "yesterday": "Yesterday"
- },
- "syntax": {
- "commands": "Type > for commands",
- "commandsAndDates": "Type > for commands · from:/date: to filter by date"
- },
- "search": {
- "byDate": "Search {{label}} by date",
- "forQuery": "Search {{label}} for “{{query}}”",
- "in": "Search in",
- "provider": "Search {{label}}…"
- },
- "groups": {
- "app": "App",
- "boards": "Boards",
- "canvas": "Canvas",
- "commands": "Commands",
- "date": "Date",
- "gallery": "Gallery",
- "generation": "Generation",
- "images": "Images",
- "layout": "Layout",
- "models": "Models",
- "navigation": "Navigation",
- "promptHistory": "Prompt history",
- "queue": "Queue",
- "queueItems": "Queue items",
- "recent": "Recent",
- "settings": "Settings",
- "viewer": "Viewer",
- "workflows": "Workflows"
- },
- "launchpad": {
- "goToModels": "Go to Models",
- "goToNodes": "Go to Nodes",
- "goToProjects": "Go to Projects",
- "goToUsers": "Go to Users",
- "openEditor": "Open Editor"
- },
- "appEntries": {
- "keyboardShortcuts": "Keyboard Shortcuts",
- "openSettings": "Open Settings"
- },
- "providers": {
- "boardSubtitle": "Board · {{count}} image",
- "boardSubtitle_other": "Board · {{count}} images",
- "defaultWorkflow": "Default workflow",
- "images": "Images",
- "models": "Models",
- "noTitle": "Untitled generation",
- "promptHistory": "Prompt history",
- "queueItems": "Queue items",
- "uncategorized": "Uncategorized",
- "workflow": "Workflow",
- "workflows": "Workflows"
- },
- "queueStatuses": {
- "canceled": "Canceled",
- "completed": "Completed",
- "failed": "Failed",
- "in_progress": "In progress",
- "pending": "Pending",
- "waiting": "Waiting"
- },
- "settings": {
- "current": "Current",
- "off": "Off",
- "on": "On",
- "sections": {
- "appearance": "Appearance",
- "behavior": "Behavior",
- "developer": "Developer",
- "hotkeys": "Hotkeys",
- "project": "Project",
- "queue": "Queue",
- "workflow": "Workflow",
- "workspace": "Workspace"
- },
- "settingsSection": "Settings: {{section}}",
- "toggles": {
- "confirmImageDeletion": "Confirm Image Deletion",
- "developerLogEnabled": "Developer Logging",
- "enableInformationalPopovers": "Informational Popovers",
- "enableModelDescriptions": "Model Descriptions",
- "reduceMotion": "Reduce Motion",
- "showFocusRegionHighlight": "Show Focus Region Highlight",
- "workflowShowMinimap": "Show Workflow Minimap",
- "workflowSnapToGrid": "Snap Workflow Nodes to Grid",
- "workflowValidateConnections": "Validate Workflow Connections"
- },
- "values": {
- "activeProject": "Active Project",
- "allProjects": "All Projects",
- "curved": "Curved",
- "language": "Language",
- "queueJobsScope": "Queue Jobs Scope",
- "square": "Square",
- "theme": "Theme",
- "workflowEdgeStyle": "Workflow Edge Style"
- }
- },
- "workflowLoad": {
- "couldNotLoad": "Could not load the workflow.",
- "failed": "Failed to load workflow",
- "loaded": "Loaded “{{name}}” from library",
- "warning": "Workflow load warning"
- }
- }
-}
+{}
diff --git a/tests/app/routers/test_multiuser_authorization.py b/tests/app/routers/test_multiuser_authorization.py
index 2719351673..ab20a31711 100644
--- a/tests/app/routers/test_multiuser_authorization.py
+++ b/tests/app/routers/test_multiuser_authorization.py
@@ -489,6 +489,33 @@ class TestImageReadAuth:
r = client.get("/api/v1/images/i/explicit-share-img", headers=_auth(user2_token))
assert r.status_code != status.HTTP_403_FORBIDDEN
+ def test_board_owner_can_read_contributor_image_on_private_board(
+ self, client: TestClient, mock_invoker: Invoker, user1_token: str, user2_token: str
+ ):
+ """A board owner should be able to read an image another user contributed to
+ their board, even after the board returns to private — matching the visibility
+ the board_id="all" listing already grants."""
+ user2 = mock_invoker.services.users.get_by_email("[email protected]")
+ assert user2 is not None
+ board_id = _create_board(client, user1_token, "Owner Read Board")
+ _set_board_visibility(client, user1_token, board_id, "public")
+ _save_image(mock_invoker, "contributor-img", user2.user_id)
+ mock_invoker.services.board_image_records.add_image_to_board(board_id=board_id, image_name="contributor-img")
+ _set_board_visibility(client, user1_token, board_id, "private")
+
+ # The owner sees the image in the board_id="all" listing...
+ r = client.get("/api/v1/images/names?board_id=all", headers=_auth(user1_token))
+ assert r.status_code == status.HTTP_200_OK
+ assert "contributor-img" in r.json()["image_names"]
+
+ # ...and individual-image authorization agrees with the listing.
+ r = client.get("/api/v1/images/i/contributor-img/metadata", headers=_auth(user1_token))
+ assert r.status_code == status.HTTP_200_OK
+
+ # The contributor keeps read access to their own image.
+ r = client.get("/api/v1/images/i/contributor-img/metadata", headers=_auth(user2_token))
+ assert r.status_code == status.HTTP_200_OK
+
def test_non_owner_cannot_read_image_metadata(
self, client: TestClient, mock_invoker: Invoker, user1_token: str, user2_token: str
):