github.com/timstclair/heapster@v0.20.0-alpha1/Godeps/_workspace/src/google.golang.org/appengine/user/user_classic.go (about) 1 // Copyright 2015 Google Inc. All rights reserved. 2 // Use of this source code is governed by the Apache 2.0 3 // license that can be found in the LICENSE file. 4 5 // +build appengine 6 7 package user 8 9 import ( 10 "appengine/user" 11 12 "golang.org/x/net/context" 13 14 "google.golang.org/appengine/internal" 15 ) 16 17 func Current(ctx context.Context) *User { 18 u := user.Current(internal.ClassicContextFromContext(ctx)) 19 if u == nil { 20 return nil 21 } 22 // Map appengine/user.User to this package's User type. 23 return &User{ 24 Email: u.Email, 25 AuthDomain: u.AuthDomain, 26 Admin: u.Admin, 27 ID: u.ID, 28 FederatedIdentity: u.FederatedIdentity, 29 FederatedProvider: u.FederatedProvider, 30 } 31 } 32 33 func IsAdmin(ctx context.Context) bool { 34 return user.IsAdmin(internal.ClassicContextFromContext(ctx)) 35 }