Esempio n. 1
0
        public static ApiUser CreateMockApiUser()
        {
            ApiUser api = new ApiUser();
            api.ApiKey = Guid.NewGuid().ToString();

            return api;
        }
Esempio n. 2
0
        public static ApiUser GetOrCreateApiUser(Guid apiKey)
        {
            using (MongoConnection db = FooRuntime.GetDatabase())
            {
                try
                {
                    MongoCollection<ApiUser> users = db.GetCollection<ApiUser>();

                    // create...
                    ApiUser user = new ApiUser();
                    user.ApiKey = apiKey.ToString();
                    user.CreatedUtc = DateTime.UtcNow;
                    users.Insert(user);

                    // return..
                    return user;
                }
                catch (Exception ex)
                {
                    throw db.WrapError(ex);
                }
            }
        }
Esempio n. 3
0
 internal User CreateUserWithPassword(ApiUser api, string password)
 {
     return User.CreateUser(api, this.TheTest.GetRandomId("username"), this.TheTest.GetRandomId("email"), password);
 }