Skip to content
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

ABAC model 情况下报错 #33

Closed
guoliang1994 opened this issue Sep 18, 2021 · 1 comment
Closed

ABAC model 情况下报错 #33

guoliang1994 opened this issue Sep 18, 2021 · 1 comment

Comments

@guoliang1994
Copy link

Unable to get property "Owner" of non-object "r_obj".

下面是 model 定义

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = r.sub == r.obj.Owner

  $canVisit = Enforcer::enforce("alice",  "{Owner: 'alice'}",  "read");
@guoliang1994
Copy link
Author

enforece 支持对象,或者数组的形式传入,而不是字符串

  $class = new stdClass();  // 新建一个stdClass
    $class->Owner = "alice";
    $canVisit = Enforcer::enforce("alice",$class, "read");  // 传入对象而非字符串 json 对象
    dd($canVisit);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant