MCPcopy
hub / github.com/dgraph-io/dgraph / authorizeUser

Function authorizeUser

edgraph/access.go:290–314  ·  view source on GitHub ↗

authorizeUser queries the user with the given user id, and returns the associated uid, acl groups, and whether the password stored in DB matches the supplied password

(ctx context.Context, userid string, password string)

Source from the content-addressed store, hash-verified

288// authorizeUser queries the user with the given user id, and returns the associated uid,
289// acl groups, and whether the password stored in DB matches the supplied password
290func authorizeUser(ctx context.Context, userid string, password string) (
291 *acl.User, error) {
292
293 queryVars := map[string]string{
294 "$userid": userid,
295 "$password": password,
296 }
297 req := &Request{
298 req: &api.Request{
299 Query: queryUser,
300 Vars: queryVars,
301 },
302 doAuth: NoAuthorize,
303 }
304 queryResp, err := (&Server{}).doQuery(ctx, req)
305 if err != nil {
306 glog.Errorf("Error while query user with id %s: %v", userid, err)
307 return nil, err
308 }
309 user, err := acl.UnmarshalUser(queryResp, "user")
310 if err != nil {
311 return nil, err
312 }
313 return user, nil
314}
315
316func refreshAclCache(ctx context.Context, ns, refreshTs uint64) error {
317 req := &Request{

Callers 1

authenticateLoginMethod · 0.85

Calls 3

UnmarshalUserFunction · 0.92
doQueryMethod · 0.80
ErrorfMethod · 0.45

Tested by

no test coverage detected