-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V6] Register OctaneReloadPermissions listener for Laravel Octane #2403
Conversation
Agreed. I more just wanted it here as an easy place to reference the specific proposed fix. And if it's deemed "right" and not problematic, it's a simple thing then to merge it. |
@drbyte Yes, its working! |
This solution will reload the permissions in every single tick of the octane server. Wouldn't this result in a drop of performance? Also, we should make (I don't know how...) a test case where we can see it failing without this change, otherwise it wouldn't add anything. |
@sweebee Do you mind testing what benefits or drawbacks occur if not registering it with the Tick events?
@sweebee Any thoughts on how best to automate such tests? |
@sweebee @davidjr82 does the change to listening on |
For me the issue was in a different package (spatie/once) so this package worked without any change. |
it would be better to make it optional, so, can be activated from permission.php for whoever needs it /*
* When set to true, the Spatie\Permission\Listeners\OctaneReloadPermissions listener will be registered
* on the Laravel\Octane\Events\OperationTerminated event, this will refresh permissions on every
* TickTerminated, TaskTerminated and RequestTerminated
*/
'register_octane_permissions_refresh' => true, |
I agree on this, although I wouldn't push a feature without a working test. But if in this case we don't know how to do it, at least make it optimal sounds reasonable to me. |
that could also apply |
I'm in agreement with adding a config switch. Just undecided about the best name for it. |
I agree: it would be preferable to get some tests set up for Octane. #HelpWanted |
@freekmurze do you have a preference on incorporating tests for this? |
for some reason Spatie Permissions , gives me an error of not enough permissions after ~14 requests in a row under Octane RoadRunner !! ""message": "User does not have the right permissions. Necessary permissions are Manage Permissions"," , even thought the 13 requests where fine , then sudden not enough permission , tried almost everything , and i have the last version of laravel 11 , fresh spatie Permission .... here is the trace " "trace": [ |
forgot to add that in php artisan serve , it works fine |
ok found the problem , it was because of teams , since teams is being flushed the Users loses permissions |
i'm not 100% sure on this
i can't test octane
this was a test for octane users to try but no one gave me feedback that it works
On #2322 (comment) was said that the problem was the spatie/once package, and that spatie/laravel-permission works correctly on octane
I recommend not merging it until you do more testing that it's the correct approach.