MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / groupFilter

Function groupFilter

edgraph/access.go:1238–1264  ·  view source on GitHub ↗
(groupIds []string)

Source from the content-addressed store, hash-verified

1236}
1237
1238func groupFilter(groupIds []string) *dql.FilterTree {
1239 // The user doesn't have any groups, so add an empty filter @filter(uid([])) so that all
1240 // groups are filtered out.
1241 if len(groupIds) == 0 {
1242 filter := &dql.FilterTree{
1243 Func: &dql.Function{
1244 Name: "uid",
1245 UID: []uint64{},
1246 },
1247 }
1248 return filter
1249 }
1250
1251 filter := &dql.FilterTree{
1252 Func: &dql.Function{
1253 Attr: "dgraph.xid",
1254 Name: "eq",
1255 },
1256 }
1257
1258 for _, gid := range groupIds {
1259 filter.Func.Args = append(filter.Func.Args,
1260 dql.Arg{Value: gid})
1261 }
1262
1263 return filter
1264}
1265
1266/*
1267 addUserFilterToFilter makes sure that user can't misue filters to access other user's info.

Callers 2

addUserFilterToQueryFunction · 0.85
addUserFilterToFilterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected