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)
| 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 |
| 290 | func 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 | |
| 316 | func refreshAclCache(ctx context.Context, ns, refreshTs uint64) error { |
| 317 | req := &Request{ |
no test coverage detected