Files
rspade_system/storage-broken/rsx-tmp/cache/js-sanitized/rsx_permission.php.sanitized
root 77b4d10af8 Refactor filename naming system and apply convention-based renames
Standardize settings file naming and relocate documentation files
Fix code quality violations from rsx:check
Reorganize user_management directory into logical subdirectories
Move Quill Bundle to core and align with Tom Select pattern
Simplify Site Settings page to focus on core site information
Complete Phase 5: Multi-tenant authentication with login flow and site selection
Add route query parameter rule and synchronize filename validation logic
Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs
Implement filename convention rule and resolve VS Code auto-rename conflict
Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns
Implement RPC server architecture for JavaScript parsing
WIP: Add RPC server infrastructure for JS parsing (partial implementation)
Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation
Add JQHTML-CLASS-01 rule and fix redundant class names
Improve code quality rules and resolve violations
Remove legacy fatal error format in favor of unified 'fatal' error type
Filter internal keys from window.rsxapp output
Update button styling and comprehensive form/modal documentation
Add conditional fly-in animation for modals
Fix non-deterministic bundle compilation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 19:10:02 +00:00

77 lines
2.3 KiB
Plaintext
Executable File

<?php
/**
* CODING CONVENTION:
* This file follows the coding convention where variable_names and function_names
* use snake_case (underscore_wherever_possible).
*/
namespace Rsx;
use Illuminate\Http\Request;
use App\RSpade\Core\Permission\Permission_Abstract;
use App\RSpade\Core\Session\Session;
/**
* Default permission class for RSX applications
*
* All permission methods must be public static and follow this signature:
* public static function method_name(Request $request, array $params, ...$args): mixed
*
* Return values:
* - true or null: Allow access (continue to route)
* - false: Deny access (will trigger 403 or redirect based on #[Auth] parameters)
* - Response object: Return custom response (e.g., redirect with custom logic)
*/
class Permission extends Permission_Abstract
{
/**
* Allow access to anybody (authenticated or not)
*
* Use this for public pages that don't require authentication
*
* @param Request $request
* @param array $params
* @return bool
*/
public static function anybody(Request $request, array $params): mixed
{
return true;
}
/**
* Require user to be authenticated
*
* Most common permission check for protected routes
*
* @param Request $request
* @param array $params
* @return bool
*/
public static function authenticated(Request $request, array $params): mixed
{
return Session::is_logged_in();
}
/**
* Unconfigured permission - throws fatal error
*
* Use this temporarily on new routes during development.
* Replace with appropriate permission before deploying.
*
* @param Request $request
* @param array $params
* @throws \RuntimeException Always throws
*/
public static function _unconfigured(Request $request, array $params): mixed
{
throw new \RuntimeException(
"Route permission is unconfigured. Configure this route with an appropriate permission.\n\n" .
"Replace #[Auth('Permission::_unconfigured()')] with:\n" .
" #[Auth('Permission::anybody()')] // Public access\n" .
" #[Auth('Permission::authenticated()')] // Authenticated users only\n\n" .
"See: php artisan rsx:man controller"
);
}
}