Comments (12)
Okay. I think what we'll do is, in this package add the reset for team ID and wildcard permissions.
And then for the parts you need in your own app, you can register a listener on Octane's OperationTerminated
for those things unique to your own requirements.
from laravel-permission.
public function clearPermissionsCollection(): void
{
$this->permissions = null;
$this->wildcardPermissionsIndex = [];
}
from laravel-permission.
I've not yet worked with Octane for a production app, so my "testing" of things like this has been limited. But would like to dig deeper.
Do you mind providing a demo app, replicating the features and symptoms you describe, which we can use for exploring and debugging further?
from laravel-permission.
@drbyte, as the current code base relies on many services (realtime events, after role switch), it would be easier to create a simple example with a single controller and a few endpoints to change a role.
I think the best way to test & debug would be an example which runs on a local micrk8s instance. But I would need some time for the example.
from laravel-permission.
$event->sandbox->make(PermissionRegistrar::class)->forgetCachedPermissions();
that removes the cache in each request and create a new one again, if you are going to do that it is better to use array
in the cache store configuration, this way you will use less resources
laravel-permission/config/permission.php
Line 184 in 3183837
What do you use for the cache? redis?
from laravel-permission.
What do you use for the cache? redis?
I am using redis. I tried a different approach, since I don't want to clear the entire cache:
This also works.
@drbyte, fyi.
from laravel-permission.
Make a PR
laravel-permission/src/PermissionServiceProvider.php
Lines 108 to 111 in 3183837
from laravel-permission.
I'm not sure it's safe to hard-code any resets to instance of User
because we can't guarantee that.
Perhaps instance of Authenticatable
contract.
But is the call to $user->resetPermissionDate()
critical?
from laravel-permission.
I agree with the call to setPermissionsTeamId(null)
and forgetWildcardPermissionIndex()
.
from laravel-permission.
@drbyte, we are using some custom permission cache on the user - this part can be ignored. Most important seems to be, that the wildcard cache is beeing deleted.
from laravel-permission.
Hmmm ... I forgot: we already have the reset for team ID since 6.1.0
from laravel-permission.
So ... @erikn69 @parallels999 I'm curious your opinion on whether we should add an Octane-specific reset for forgetWildcardPermissionIndex()
, or simply combine forgetWildcardPermissionIndex()
into clearPermissionsCollection()
laravel-permission/src/PermissionRegistrar.php
Lines 168 to 176 in 3183837
Noting:
laravel-permission/src/PermissionRegistrar.php
Lines 137 to 157 in 3183837
from laravel-permission.
Related Issues (20)
- Default string length prerequisite conflict HOT 7
- Relation model_has_roles not found error on Role deletion HOT 13
- There is no permission named `list-users` for guard `web`. HOT 2
- Access to undeclared static property Spatie\Permission\PermissionRegistrar::$pivotPermission HOT 6
- Access to undeclared static property Spatie\Permission\PermissionRegistrar::$pivotRole HOT 1
- Trait "Spatie\Permission\Traits\HasRoles" not found in app/User.php HOT 10
- php artisan permission:show uuid error HOT 1
- Typo in docs HOT 1
- Base table or view not found: 1146 Table 'role_user' doesn't exist HOT 4
- for v6 - There is no role with ID `org_uuid` for guard `api` HOT 2
- team_id doesn't have a default value HOT 5
- assignRole and syncRoles fail for model with ulid type id HOT 2
- Documentation for v6/main unaccessible at spatie.be HOT 4
- Wrong octane event listener HOT 2
- Too much Role-Models loaded HOT 3
- Enums shouldn't be casted in the model HOT 8
- assignRole > getModel() > null
- Timestamps in migration for sql server HOT 4
- Target class [Spatie\Permission\Middlewares\PermissionMiddleware] does not exist. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-permission.