Argument 1 passed to Casbin\Rbac\DefaultRoleManager\RoleManager::hasLink() must be of the type string, int given, called in /var/www/html/amitdeveloper28/vendor/casbin/casbin/src/Util/BuiltinOperations.php on line 440
amitgoldy1 opened this issue ยท 7 comments
I am getting this issue, when I used following steps to reproduce this issue.
- I am using laravel Laravel Framework 6.20.38.
- add permission of logged user in laravel. Below are my code: $email = Auth::user()->email;
// adds permissions to a user
\Enforcer::addPermissionForUser($email, '/photo/index', 'GET'); - When, I hit this allow path, I am getting this error:
- Argument 1 passed to Casbin\Rbac\DefaultRoleManager\RoleManager::hasLink() must be of the type string, int given, called in /var/www/html/amitdeveloper28/vendor/casbin/casbin/src/Util/BuiltinOperations.php on line 440
Are you using the default lauthz-rbac-model.conf configuration file? I tried to reproduce this error, but did not succeed.
Yes, I am using default model file. Below are the code:
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && keyMatch2(r.obj, p.obj) && regexMatch(r.act, p.act)
I am using this middleware in web.php file.
Route::group(['middleware' => ['http_request']], function () {
Route::resource('photo', 'PhotoController');
});
@basakest @amitgoldy1 There should be a need to convert the AuthIdentifier to a string ๏ผ
https://github.com/php-casbin/laravel-authz/blob/master/src/Middlewares/RequestMiddleware.php#L53
๐ This issue has been resolved in version 3.0.1 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐