Comments (3)
It seems to me that you made some mistake in the configuration. Upload a demo repo with the code showing the problem
https://spatie.be/laravel-permission/creating-a-demo-app
from laravel-permission.
-
The "there is no role with ID x" error is thrown by
Role::findById()
, which is called fromgetStoredRole()
, which is called bycollectRoles()
, which is called byassignRole()
. -
Your posted
assignRole()
call looks strange. Why are you passing a nested array?
When reformatting your posted code of:
$userOrgManager->assignRole([$roleOrgManager->id => ['organization_id' => $organization->id]]);
it looks like this:
$userOrgManager->assignRole([
$roleOrgManager->id => [
'organization_id' => $organization->id
]
]);
That's not the kind of array that assignRole()
accepts. assignRole()
accepts a one-dimensional array of role id
s or role objects
/records or role name
s.
- It should never be looking for a role with an ID of
uuid
(ororg_uuid
) ... that's part of the schema, not a valid recordid
. (If you were giving a rolename
ofuuid
, then perhaps "uuid" might be acceptable, but if it gave an error related to such aname
, then it would say that it couldn't find a role with thatname
, not "ID".)
Thus, as parallels999 mentioned, something is wrong in your code or your configuration.
We need to see your complete code related to this. As mentioned, please create a fresh repository for a basic app which recreates this exact problem.
from laravel-permission.
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
from laravel-permission.
Related Issues (20)
- Problem upgrading with existing data permissions/roles HOT 1
- Cannot save the user model twice in the same request HOT 10
- withoutPermission scope from HasPermissions returns users from outside the team HOT 3
- Laravel 11 compatibility issues HOT 5
- Problem with middleware definition method in the controller in Laravel 11
- Problem with denied access using the middleware aliases role, permission, and role_or_permission in Spatie Permission version 6 and higher. HOT 2
- Problem when trying to migrate laravel-permission migrations HOT 2
- Docs are not uptodate with current implementation HOT 9
- Diffs are not properly displayed in generated docs HOT 4
- Bug @can OR $user->can OR $user->hasAnyPermission($permission) HOT 1
- Problems giving permissions to a role when the id field is a uuid type HOT 4
- Can't define "Super User" for each guard
- Custom user menu item not being translated HOT 1
- Fix PHPStan failure: Access to an undefined property Illuminate\Database\Eloquent\Model::$name.
- Issue while using Cache+SQlite Laravel 11 HOT 5
- Permissions and Role Disapper(empty) from Model after ~10-14 requests HOT 7
- Unable to Install Package HOT 1
- not all but some users returning no roles or permissions, and noticing 9223372036854775807 issue on model_id in debug HOT 2
- Migrating to new nova-permissions package, noticed that permissions are hardwired to always have an uppercase first letter? HOT 2
- Call to a member function prepare() on null
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.