Skip to content

Add authorize check to egg feature modals#2459

Open
Boy132 wants to merge 1 commit into
mainfrom
boy132/egg-features-permission-checks
Open

Add authorize check to egg feature modals#2459
Boy132 wants to merge 1 commit into
mainfrom
boy132/egg-features-permission-checks

Conversation

@Boy132

@Boy132 Boy132 commented Jul 16, 2026

Copy link
Copy Markdown
Member

No description provided.

@Boy132 Boy132 self-assigned this Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Feature schemas now define authorization using a user and server. Console filters unauthorized actions during boot and prevents unauthorized feature mounting. Individual schemas use permission checks or unconditional authorization.

Changes

Feature authorization

Layer / File(s) Summary
Schema authorization contract and implementations
app/Extensions/Features/FeatureSchemaInterface.php, app/Extensions/Features/Schemas/*
The schema interface requires authorize(User $user, Server $server): bool; feature schemas implement permission-based or unconditional authorization, and GSL token and Java version actions remove their disabled-schema checks.
Console authorization enforcement
app/Filament/Server/Pages/Console.php
boot() skips unauthorized feature actions, while mountFeature() returns before mounting or replacing an unauthorized feature action.

Sequence Diagram(s)

sequenceDiagram
  participant Console
  participant FeatureSchema
  participant User
  participant Server
  Console->>FeatureSchema: authorize(user(), Server)
  FeatureSchema->>User: Check permission for Server
  User-->>FeatureSchema: Return boolean
  FeatureSchema-->>Console: Authorization result
  Console->>Console: Cache or mount action when authorized
Loading

Possibly related PRs

  • pelican-dev/panel#2175: Both changes modify Console::mountFeature() control flow before feature actions are mounted or replaced.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided, so there isn't enough text to assess beyond the topic. Add a short description stating what changed and why, such as the new authorize checks for feature modals.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding authorization checks to egg feature modals.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Filament/Server/Pages/Console.php`:
- Around line 71-74: In app/Filament/Server/Pages/Console.php lines 71-74,
update boot() to assign user() to $user before iterating, and skip feature
caching when the user is null or unauthorized; in lines 94-96, update
mountFeature() to assign user() to $user and return early when it is null or
unauthorized before mounting the action. Pass only the validated User instance
to authorize().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0b5698b1-51a6-43a4-9c7d-4b7f594af68e

📥 Commits

Reviewing files that changed from the base of the PR and between 1f2ff09 and a9fb64f.

📒 Files selected for processing (7)
  • app/Extensions/Features/FeatureSchemaInterface.php
  • app/Extensions/Features/Schemas/GSLTokenSchema.php
  • app/Extensions/Features/Schemas/JavaVersionSchema.php
  • app/Extensions/Features/Schemas/MinecraftEulaSchema.php
  • app/Extensions/Features/Schemas/PIDLimitSchema.php
  • app/Extensions/Features/Schemas/SteamDiskSpaceSchema.php
  • app/Filament/Server/Pages/Console.php

Comment thread app/Filament/Server/Pages/Console.php
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