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

fix(acl): filter out the results based on type #7978

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions edgraph/access_ee.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func getRefreshJwt(userId string, namespace uint64) (string, error) {

const queryUser = `
query search($userid: string, $password: string){
user(func: eq(dgraph.xid, $userid)) {
user(func: eq(dgraph.xid, $userid)) @filter(type(dgraph.type.User)) {
uid
dgraph.xid
password_match: checkpwd(dgraph.password, $password)
Expand Down Expand Up @@ -465,7 +465,7 @@ func upsertGuardianAndGroot(closer *z.Closer, ns uint64) {
func upsertGuardian(ctx context.Context) error {
query := fmt.Sprintf(`
{
guid as guardians(func: eq(dgraph.xid, "%s")){
guid as guardians(func: eq(dgraph.xid, "%s")) @filter(type(dgraph.type.Group)) {
uid
}
}
Expand Down Expand Up @@ -535,10 +535,10 @@ func upsertGroot(ctx context.Context, passwd string) error {
// groot is the default user of guardians group.
query := fmt.Sprintf(`
{
grootid as grootUser(func: eq(dgraph.xid, "%s")){
grootid as grootUser(func: eq(dgraph.xid, "%s")) @filter(type(dgraph.type.User)) {
uid
}
guid as var(func: eq(dgraph.xid, "%s"))
guid as var(func: eq(dgraph.xid, "%s")) @filter(type(dgraph.type.Group))
}
`, x.GrootId, x.GuardiansId)
userNQuads := acl.CreateUserNQuads(x.GrootId, passwd)
Expand Down