コード例 #1
0
ファイル: ReviewController.cs プロジェクト: jsuarezruiz/cydin
 public ActionResult RejectRelease(int id)
 {
     CurrentUserModel.CheckIsAdmin();
     CurrentUserModel.RejectRelease(id);
     BuildService.UpdateRepositories(false);
     return(View("Index"));
 }
コード例 #2
0
        public ActionResult GetDownloadsCSV(string period, string arg)
        {
            CurrentUserModel.CheckIsAdmin();
            MemoryStream ms = new MemoryStream();
            StreamWriter sw = new StreamWriter(ms);

            sw.Write(CurrentUserModel.Stats.GetDownloadStatsCSV());
            sw.Flush();
            ms.Position = 0;
            return(File(ms, "text/plain", "addins-download.csv"));
        }
コード例 #3
0
        public ActionResult GetRepoDownloadStatsAsync(string period, string arg)
        {
            CurrentUserModel.CheckIsAdmin();
            DateTime   end;
            DateTime   start;
            TimePeriod pd = TimePeriod.Auto;

            DownloadStats.ParseQuery(period, arg, out pd, out start, out end);
            DownloadStats stats = CurrentUserModel.Stats.GetTotalRepoDownloadStats(pd, start, end);

            return(Content(stats.ToJson()));
        }
コード例 #4
0
        public ActionResult AddAdminAsync(string email)
        {
            CurrentUserModel.CheckIsAdmin();
            User u = CurrentServiceModel.GetUserByEmail(email);

            if (u != null)
            {
                CurrentUserModel.SetUserApplicationPermission(u.Id, ApplicationPermission.Administer, true);
                return(Content("OK"));
            }
            else
            {
                return(Content(""));
            }
        }
コード例 #5
0
        public ActionResult GetTopDownloads(string period, string arg)
        {
            CurrentUserModel.CheckIsAdmin();
            DateTime   end;
            DateTime   start;
            TimePeriod pd = TimePeriod.Auto;

            DownloadStats.ParseQuery(period, arg, out pd, out start, out end);

            List <DownloadInfo> stats = CurrentUserModel.Stats.GetTopDownloads(start, end);
            StringBuilder       sb    = new StringBuilder();

            foreach (var di in stats)
            {
                if (sb.Length > 0)
                {
                    sb.Append(',');
                }
                sb.AppendFormat("{{\"count\":{0},\"platform\":\"{1}\",\"projectId\":{2},\"appVersion\":\"{3}\",\"name\":\"{4}\"}}", di.Count, di.Platform, di.Release.ProjectId, di.Release.TargetAppVersion, di.Release.AddinName + " v" + di.Release.Version);
            }
            return(Content("[" + sb + "]"));
        }
コード例 #6
0
 public ActionResult RemoveAdmin(int userId)
 {
     CurrentUserModel.CheckIsAdmin();
     CurrentUserModel.SetUserApplicationPermission(userId, ApplicationPermission.Administer, false);
     return(RedirectToAction("Index"));
 }
コード例 #7
0
 public ActionResult ProjectsList()
 {
     CurrentUserModel.CheckIsAdmin();
     return(View());
 }
コード例 #8
0
 public ActionResult UpdateRepositories()
 {
     CurrentUserModel.CheckIsAdmin();
     BuildService.UpdateRepositories(true);
     return(View("Index"));
 }
コード例 #9
0
 public ActionResult Index()
 {
     CurrentUserModel.CheckIsAdmin();
     return(View());
 }
コード例 #10
0
 public ActionResult Edit()
 {
     CurrentUserModel.CheckIsAdmin();
     return(View("Edit"));
 }