ABAC model 情况下报错
guoliang1994 opened this issue · 1 comments
guoliang1994 commented
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 commented
enforece 支持对象,或者数组的形式传入,而不是字符串
$class = new stdClass(); // 新建一个stdClass
$class->Owner = "alice";
$canVisit = Enforcer::enforce("alice",$class, "read"); // 传入对象而非字符串 json 对象
dd($canVisit);