コード例 #1
0
 public static void Delete(Setting setting, User user)
 {
     Fallball.Call <User>(setting, HttpMethod.Delete,
                          string.Format("resellers/{0}/clients/{1}/users/{2}",
                                        FbReseller.GetId(user.Tenant.App),
                                        FbClient.GetId(user.Tenant),
                                        GetId(user)));
 }
コード例 #2
0
 public static string GetUserLogin(Setting setting, User user)
 {
     return(Fallball.Call <String>(setting, HttpMethod.Get, string.Format("resellers/{0}/clients/{1}/users/{2}/link",
                                                                          FbReseller.GetId(user.Tenant.App),
                                                                          FbClient.GetId(user.Tenant),
                                                                          GetId(user)
                                                                          )));
 }
コード例 #3
0
ファイル: Reseller.cs プロジェクト: pkhodos/testapsconnector2
        public static string Create(Setting setting, Application app)
        {
            var r = new FbReseller {
                Name = GetId(app), Rid = GetId(app), Storage = new Storage {
                    Limit = ResellersStorage
                }
            };
            var body = JsonConvert.SerializeObject(r);

            var fbReseller = Fallball.Call <FbReseller>(setting, HttpMethod.Post, "resellers/", body);

            return(fbReseller.Name);
        }
コード例 #4
0
        public static void Delete(Setting setting, Tenant tenant)
        {
            var fbReseller = Fallball.Call <FbReseller>(
                setting,
                HttpMethod.Get,
                string.Format("resellers/{0}", FbReseller.GetId(tenant.App)));

            Fallball.Call <string>(
                setting,
                HttpMethod.Delete,
                string.Format("resellers/{0}/clients/{1}", FbReseller.GetId(tenant.App), GetId(tenant)),
                "",
                fbReseller.Token);
        }
コード例 #5
0
        public static Usage GetUsage(Setting setting, Tenant tenant)
        {
            var fbClient = Fallball.Call <FbClient>(
                setting,
                HttpMethod.Get,
                string.Format("resellers/{0}/clients/{1}",
                              FbReseller.GetId(tenant.App), GetId(tenant)));

            Usage u = new Usage();

            u["USERS"]     = fbClient.UsersAmount;
            u["DISKSPACE"] = fbClient.Storage.Usage;

            return(u);
        }
コード例 #6
0
        public static string Create(Setting setting, User user)
        {
            var u = new FbUser {
                Email = user.Email, Admin = true, Storage = new Storage {
                    Limit = UsersStorage
                }
            };

            var fbUser = Fallball.Call <FbUser>(setting, HttpMethod.Post,
                                                string.Format("resellers/{0}/clients/{1}/users/",
                                                              FbReseller.GetId(user.Tenant.App),
                                                              FbClient.GetId(user.Tenant)),
                                                JsonConvert.SerializeObject(u));

            return(fbUser.UserId);
        }
コード例 #7
0
        public static string GetAdminLogin(Setting setting, Tenant tenant)
        {
            var adminlogin = string.Format("admin@{0}.{1}.fallball.io", GetId(tenant), FbReseller.GetId(tenant.App));

            string userId;

            using (var md5 = MD5.Create())
            {
                var hash   = md5.ComputeHash(Encoding.ASCII.GetBytes(adminlogin));
                var result = new Guid(hash);
                userId = result.ToString();
            }

            return(Fallball.Call <string>(setting, HttpMethod.Get, string.Format("resellers/{0}/clients/{1}/users/{2}/link",
                                                                                 FbReseller.GetId(tenant.App),
                                                                                 GetId(tenant),
                                                                                 userId
                                                                                 )));
        }
コード例 #8
0
        public static void Update(Setting setting, Tenant tenant)
        {
            var c = new FbClient {
                Name = GetId(tenant), Storage = new Storage {
                    Limit = tenant.DiskspaceLimit
                }
            };
            var body = JsonConvert.SerializeObject(c);

            var fbReseller = Fallball.Call <FbReseller>(
                setting,
                HttpMethod.Get,
                string.Format("resellers/{0}", FbReseller.GetId(tenant.App)));

            Fallball.Call <FbClient>(
                setting,
                HttpMethod.Put,
                string.Format("resellers/{0}/clients/{1}/", FbReseller.GetId(tenant.App), GetId(tenant)),
                body,
                fbReseller.Token);
        }