Skip to content

ECHO-263 Make public images or videos visible#172

Merged
ussaama merged 1 commit intomainfrom
make-public-assets-visible
Jun 3, 2025
Merged

ECHO-263 Make public images or videos visible#172
ussaama merged 1 commit intomainfrom
make-public-assets-visible

Conversation

@ussaama
Copy link
Copy Markdown
Contributor

@ussaama ussaama commented Jun 3, 2025

  • Added a new "Public" folder in folders.json for better organization.
  • Introduced permissions for the "directus_files" collection, allowing read access based on folder hierarchy.
  • Updated GraphQL specifications to include new queries and mutations for aspects and project report notification participants.
  • Modified OpenAPI specifications to support new endpoints for managing aspect items.
  • Improved system subscriptions to include aspect and project report notification participants events.

Summary by CodeRabbit

  • New Features
    • Introduced a "Public" folder for organizing files.
    • Added new permission allowing users to read files located in the "Public" folder or its subfolders, with access to specific file details.

…ures

- Added a new "Public" folder in folders.json for better organization.
- Introduced permissions for the "directus_files" collection, allowing read access based on folder hierarchy.
- Updated GraphQL specifications to include new queries and mutations for aspects and project report notification participants.
- Modified OpenAPI specifications to support new endpoints for managing aspect items.
- Improved system subscriptions to include aspect and project report notification participants events.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 3, 2025

Walkthrough

This change introduces a "Public" folder entry in the folders collection and adds a granular read permission for files in folders named "Public" (including up to two ancestor levels). The new permission specifies accessible fields and applies a default public policy, with no changes to exported or public entities.

Changes

File(s) Summary
echo/directus/sync/collections/folders.json Added a "Public" folder object with a unique sync ID and no parent.
echo/directus/sync/collections/permissions.json Introduced a read permission for directus_files where the folder or its ancestors' names contain "Public".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Directus
    participant Permissions Engine
    participant Folders

    User->>Directus: Request to read file metadata
    Directus->>Permissions Engine: Check read permission for file
    Permissions Engine->>Folders: Retrieve folder and ancestor names
    Folders-->>Permissions Engine: Return folder hierarchy
    Permissions Engine-->>Directus: Approve if "Public" in any folder name (up to 2 ancestors)
    Directus-->>User: Return allowed file fields if permitted
Loading

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ussaama ussaama changed the title Enhance Directus sync configuration with new aspect and folder struct… ECHO-263 Make public images or videos visible Jun 3, 2025
@ussaama ussaama requested a review from spashii June 3, 2025 12:01
@linear
Copy link
Copy Markdown

linear bot commented Jun 3, 2025

@ussaama ussaama enabled auto-merge June 3, 2025 12:02
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a16e3c and 284bb79.

⛔ Files ignored due to path filters (3)
  • echo/directus/sync/specs/item.graphql is excluded by !echo/directus/sync/specs/**
  • echo/directus/sync/specs/openapi.json is excluded by !echo/directus/sync/specs/**
  • echo/directus/sync/specs/system.graphql is excluded by !echo/directus/sync/specs/**
📒 Files selected for processing (2)
  • echo/directus/sync/collections/folders.json (1 hunks)
  • echo/directus/sync/collections/permissions.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: ci-check-server
🔇 Additional comments (2)
echo/directus/sync/collections/folders.json (1)

1-7:

Details

✅ Verification successful

LGTM – “Public” folder sync entry looks good!
Root‐level folder added with parent: null and a unique _syncId. Verify that the name matches exactly what your permissions filter expects (case-sensitivity could matter).

To double-check for duplicates or name mismatches, run:


🏁 Script executed:

#!/bin/bash
# Search for folder named "Public"
rg -n '"name":\s*"Public"' echo/directus/sync/collections/folders.json

Length of output: 96


✅ Thrusters green: “Public” folder is unique
• echo/directus/sync/collections/folders.json:3 shows the sole “Public” entry
• Name matches exactly—case-sensitive filter satisfied

All systems go—LGTM!

echo/directus/sync/collections/permissions.json (1)

78-110: LGTM – explicit field whitelist is clear.
You’ve whitelisted many attributes, including uploaded_by and storage metadata. Confirm these fields align with your public policy and won’t leak PII or internal details.

Please audit the field list against your privacy/GDPR requirements.

Comment on lines +38 to +75
{
"collection": "directus_files",
"action": "read",
"permissions": {
"_and": [
{
"_or": [
{
"folder": {
"name": {
"_contains": "Public"
}
}
},
{
"folder": {
"parent": {
"name": {
"_contains": "Public"
}
}
}
},
{
"folder": {
"parent": {
"parent": {
"name": {
"_contains": "Public"
}
}
}
}
}
]
}
]
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

LGTM – permission filter nesting is consistent!
The new directus_files.read rule correctly checks the folder name at three levels of ancestry. You could simplify by removing the redundant outer _and, but consistency with other rules is also valuable. Ensure _contains: "Public" behaves case-insensitively in your Directus version so all “Public” folders (and their ancestors) are captured.

Example flattening:

- "permissions": { "_and": [ { "_or": [ … ] } ] }
+ "permissions": { "_or": [ … ] }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/permissions.json between lines 38 and 75, the
permission filter for directus_files.read uses an outer _and with a single _or
condition inside, which is redundant. To simplify, remove the outer _and and
keep only the _or array with the three folder name checks. Also, verify that the
_contains operator is case-insensitive in your Directus version to ensure all
relevant "Public" folders are matched.

@ussaama ussaama added this pull request to the merge queue Jun 3, 2025
Merged via the queue into main with commit 26db1de Jun 3, 2025
7 checks passed
spashii pushed a commit that referenced this pull request Nov 18, 2025
Enhance Directus sync configuration with new aspect and folder structures

- Added a new "Public" folder in folders.json for better organization.
- Introduced permissions for the "directus_files" collection, allowing read access based on folder hierarchy.
- Updated GraphQL specifications to include new queries and mutations for aspects and project report notification participants.
- Modified OpenAPI specifications to support new endpoints for managing aspect items.
- Improved system subscriptions to include aspect and project report notification participants events.
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