php-casbin/laravel-authz

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.

  1. I am using laravel Laravel Framework 6.20.38.
  2. 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');
  3. When, I hit this allow path, I am getting this error:
  4. 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

@basakest @techoner

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 plz work on it

๐ŸŽ‰ This issue has been resolved in version 3.0.1 ๐ŸŽ‰

The release is available on GitHub release

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€