Skip to content

Error encountered when creating an Enforcer based on the ABAC model: extraneous or missing "in quoted field" #63

@Harris-H

Description

@Harris-H

I found that the first time I created an Enforcer when the database was empty and checked if the request was fulfilled without any issues, but when the database included these policies, creating an Enforcer would result in an error message: extraneous or missing "in quoted field". What is the problem? Please help me.

I am using an adapter based on MongoDB

	a, err := mongodbadapter.NewAdapterWithClientOption(mongoClientOption, databaseName)
	if err != nil {
		panic(err)
	}

	e, err := casbin.NewEnforcer("../conf/abac_model.conf", a)

My model:

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub_rule, obj, act

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

[matchers]
m = eval(p.sub_rule) && r.obj == p.obj && r.act == p.act

My policy:
image

My request(s):

models.UserRole{
		Role: "test_admin",
	}, index, read ---> true

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions