OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library appengine.api.users; |
| 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:gcloud/service_scope.dart' as ss; |
| 10 |
| 11 class User { |
| 12 final String email; |
| 13 final String id; |
| 14 final String authDomain; |
| 15 final bool isAdmin; |
| 16 |
| 17 User({this.email, this.authDomain, this.id, this.isAdmin}); |
| 18 |
| 19 String toString() => email; |
| 20 } |
| 21 |
| 22 abstract class UserService { |
| 23 User get currentUser; |
| 24 |
| 25 Future<String> createLoginUrl(String destination); |
| 26 |
| 27 Future<String> createLogoutUrl(String destination); |
| 28 } |
| 29 |
| 30 /** |
| 31 * Register a new [UserService] object. |
| 32 * |
| 33 * Calling this outside of a service scope or calling it more than once inside |
| 34 * the same service scope will result in an error. |
| 35 * |
| 36 * See the `package:gcloud/service_scope.dart` library for more information. |
| 37 */ |
| 38 void registerUserService(UserService service) { |
| 39 ss.register(#_appengine.users, service); |
| 40 } |
| 41 |
| 42 /** |
| 43 * The user service. |
| 44 * |
| 45 * Request handlers will be run inside a service scope which contains the |
| 46 * users service. |
| 47 */ |
| 48 UserService get userService => ss.lookup(#_appengine.users); |
OLD | NEW |