コード例 #1
0
 public AppLayoutModel(DeveloperUser User, int ActivePanel)
 {
     this.UserName             = User.nickname;
     this.UserIconImageAddress = User.headimgurl;
     this.ActivePanel          = ActivePanel;
     this.AppCount             = User.MyApps.Count();
 }
コード例 #2
0
ファイル: ViewAppViewModel.cs プロジェクト: wangyaoDgit/Nexus
        public async Task Recover(
            DeveloperUser user,
            App thisApp,
            CoreApiService coreApiService,
            AppsContainer appsContainer,
            SitesService sitesService,
            EventService eventService,
            ChannelService channelService,
            int pageNumber)
        {
            RootRecover(user);
            var token = await appsContainer.AccessToken(thisApp.AppId, thisApp.AppSecret);

            Grants = await coreApiService.AllUserGrantedAsync(token, pageNumber, 15);

            var sites = await sitesService.ViewMySitesAsync(token);

            Sites = sites.Sites;

            var errorLogs = await eventService.ViewAsync(token);

            ErrorLogs = errorLogs.Logs;

            var channels = await channelService.ViewMyChannelsAsync(token);

            Channels = channels.Channels;
        }
コード例 #3
0
 public EditBucketViewModel(DeveloperUser user, ViewBucketViewModel thisBucket) : base(user)
 {
     this.NewBucketName = thisBucket.BucketName;
     this.BucketId      = thisBucket.BucketId;
     this.OpenToRead    = thisBucket.OpenToRead;
     this.OpenToUpload  = thisBucket.OpenToUpload;
 }
コード例 #4
0
        public static async Task <ViewAppViewModel> SelfCreateAsync(DeveloperUser User, App ThisApp, DeveloperDbContext _dbContext)
        {
            var model = new ViewAppViewModel(User, ThisApp);
            await model.Recover(User, ThisApp, _dbContext);

            return(model);
        }
コード例 #5
0
 public void RootRecover(DeveloperUser user)
 {
     this.NickName       = user.NickName;
     this.AppCount       = user.MyApps.Count();
     this.AllApps        = user.MyApps;
     this.EmailConfirmed = user.EmailConfirmed;
 }
コード例 #6
0
ファイル: ViewAppViewModel.cs プロジェクト: xun404/Developer
 public ViewAppViewModel(DeveloperUser User, App ThisApp) : base(User, 1)
 {
     this.AppName        = ThisApp.AppName;
     this.AppDescription = ThisApp.AppDescription;
     this.AppCategory    = ThisApp.AppCategory;
     this.AppPlatform    = ThisApp.AppPlatform;
 }
コード例 #7
0
        public async Task Recover(
            DeveloperUser user,
            DeveloperApp appInDb,
            CoreApiService coreApiService,
            AppsContainer appsContainer,
            SitesService sitesService,
            EventService eventService,
            ChannelService channelService,
            RecordsService recordsService,
            int pageNumber)
        {
            RootRecover(user);
            var token = await appsContainer.AccessToken(appInDb.AppId, appInDb.AppSecret);

            Grants = await coreApiService.AllUserGrantedAsync(token, pageNumber, 15);

            var sites = await sitesService.ViewMySitesAsync(token);

            Sites = sites.Sites;

            var errorLogs = await eventService.ViewAsync(token);

            ErrorLogs = errorLogs.Logs;

            var channels = await channelService.ViewMyChannelsAsync(token);

            Channels = channels.Channels;

            var records = await recordsService.ViewMyRecordsAsync(token, Array.Empty <string>());

            Records = records.Records;

            Trusted = appInDb.TrustedApp;
        }
コード例 #8
0
        private ViewAppViewModel(DeveloperUser user, DeveloperApp thisApp) : base(user)
        {
            if (thisApp.CreatorId != user.Id)
            {
                throw new InvalidOperationException("The app is not the user's app!");
            }
            AppName             = thisApp.AppName;
            AppDescription      = thisApp.AppDescription;
            AppCategory         = thisApp.AppCategory;
            AppPlatform         = thisApp.AppPlatform;
            AppId               = thisApp.AppId;
            AppSecret           = thisApp.AppSecret;
            EnableOAuth         = thisApp.EnableOAuth;
            ForceInputPassword  = thisApp.ForceInputPassword;
            ForceConfirmation   = thisApp.ForceConfirmation;
            DebugMode           = thisApp.DebugMode;
            PrivacyStatementUrl = thisApp.PrivacyStatementUrl;
            LicenseUrl          = thisApp.LicenseUrl;
            IconPath            = thisApp.IconPath;
            AppDomain           = thisApp.AppDomain;
            AppFailCallbackUrl  = thisApp.AppFailCallbackUrl;

            ViewOpenId          = thisApp.ViewOpenId;
            ViewPhoneNumber     = thisApp.ViewPhoneNumber;
            ChangePhoneNumber   = thisApp.ChangePhoneNumber;
            ConfirmEmail        = thisApp.ConfirmEmail;
            ChangeBasicInfo     = thisApp.ChangeBasicInfo;
            ChangePassword      = thisApp.ChangePassword;
            ChangeGrantInfo     = thisApp.ChangeGrantInfo;
            ViewAuditLog        = thisApp.ViewAuditLog;
            ManageSocialAccount = thisApp.ManageSocialAccount;
        }
コード例 #9
0
 private ViewAppViewModel(DeveloperUser User, App ThisApp) : base(User)
 {
     if (ThisApp.CreaterId != User.Id)
     {
         throw new InvalidOperationException("The app is not the user's app!");
     }
     AppName             = ThisApp.AppName;
     AppDescription      = ThisApp.AppDescription;
     AppCategory         = ThisApp.AppCategory;
     AppPlatform         = ThisApp.AppPlatform;
     AppId               = ThisApp.AppId;
     AppSecret           = ThisApp.AppSecret;
     EnableOAuth         = ThisApp.EnableOAuth;
     ForceInputPassword  = ThisApp.ForceInputPassword;
     ForceConfirmation   = ThisApp.ForceConfirmation;
     DebugMode           = ThisApp.DebugMode;
     PrivacyStatementUrl = ThisApp.PrivacyStatementUrl;
     LicenseUrl          = ThisApp.LicenseUrl;
     AppIconAddress      = ThisApp.AppIconAddress;
     AppDomain           = ThisApp.AppDomain;
     ViewOpenId          = ThisApp.ViewOpenId;
     ViewPhoneNumber     = ThisApp.ViewPhoneNumber;
     ChangePhoneNumber   = ThisApp.ChangePhoneNumber;
     ConfirmEmail        = ThisApp.ConfirmEmail;
     ChangeBasicInfo     = ThisApp.ChangeBasicInfo;
     ChangePassword      = ThisApp.ChangePassword;
 }
コード例 #10
0
 public virtual void RootRecover(DeveloperUser user, int activePanel)
 {
     this.NickName       = user.NickName;
     this.ActivePanel    = activePanel;
     this.AppCount       = user.MyApps.Count();
     this.AllApps        = user.MyApps;
     this.EmailConfirmed = user.EmailConfirmed;
 }
コード例 #11
0
 public virtual void Recover(DeveloperUser User, int ActivePanel)
 {
     this.NickName             = User.NickName;
     this.UserIconImageAddress = User.HeadImgUrl;
     this.ActivePanel          = ActivePanel;
     this.AppCount             = User.MyApps.Count();
     this.AllApps = User.MyApps;
 }
コード例 #12
0
        public static async Task <ViewAppViewModel> SelfCreateAsync(
            DeveloperUser User,
            App ThisApp,
            CoreApiService coreApiService,
            OSSApiService ossApiService,
            AppsContainer appsContainer)
        {
            var model = new ViewAppViewModel(User, ThisApp);
            await model.Recover(User, ThisApp, coreApiService, ossApiService, appsContainer);

            return(model);
        }
コード例 #13
0
        public static async Task <ViewAppViewModel> SelfCreateAsync(
            DeveloperUser user,
            App thisApp,
            CoreApiService coreApiService,
            AppsContainer appsContainer,
            SitesService sitesService,
            EventService eventService)
        {
            var model = new ViewAppViewModel(user, thisApp);
            await model.Recover(user, thisApp, coreApiService, appsContainer, sitesService, eventService);

            return(model);
        }
コード例 #14
0
        public async Task Recover(DeveloperUser User, App ThisApp, DeveloperDbContext _dbContext)
        {
            base.Recover(User, 1);
            var token = AppsContainer.AccessToken(ThisApp.AppId, ThisApp.AppSecret);

            var buckets = await ApiService.ViewMyBucketsAsync(await token());

            Buckets = buckets.Buckets;

            var grants = await Pylon.Services.ToAPIServer.ApiService.AllUserGrantedAsync(await token());

            Grants = grants.Grants;
        }
コード例 #15
0
        public static async Task <ViewAppViewModel> SelfCreateAsync(
            DeveloperUser user,
            DeveloperApp appInDb,
            CoreApiService coreApiService,
            AppsContainer appsContainer,
            SitesService sitesService,
            EventService eventService,
            ChannelService channelService,
            int pageNumber)
        {
            var model = new ViewAppViewModel(user, appInDb);
            await model.Recover(user, appInDb, coreApiService, appsContainer, sitesService, eventService, channelService, pageNumber);

            return(model);
        }
コード例 #16
0
        public async Task Recover(
            DeveloperUser User,
            App ThisApp,
            CoreApiService coreApiService,
            OSSApiService ossApiService,
            AppsContainer appsContainer)
        {
            base.Recover(User, 1);
            var token = await appsContainer.AccessToken(ThisApp.AppId, ThisApp.AppSecret);

            var buckets = await ossApiService.ViewMyBucketsAsync(token);

            Buckets = buckets.Buckets;

            var grants = await coreApiService.AllUserGrantedAsync(token);

            Grants = grants.Grants;
        }
コード例 #17
0
ファイル: AuthController.cs プロジェクト: xun404/Developer
        public async Task <IActionResult> AuthResult()
        {
            var _controller = this;
            var code        = int.Parse(_controller.HttpContext.Request.Query["code"]);
            var state       = _controller.HttpContext.Request.Query["state"];

            if (!_controller.User.Identity.IsAuthenticated && code > 0)
            {
                var _accessToken = await OAuthService.AuthCodeToAccessTokenAsync(code);

                var _userinfo = await OAuthService.AccessTokenToUserInfo(AccessToken : _accessToken.access_token, openid : _accessToken.openid);

                var current = await _controller._userManager.FindByIdAsync(_userinfo.openid);

                if (current == null)
                {
                    current = new DeveloperUser
                    {
                        Id                = _userinfo.openid,
                        nickname          = _userinfo.nickname,
                        sex               = _userinfo.sex,
                        headimgurl        = _userinfo.headimgurl,
                        UserName          = _userinfo.openid,
                        preferedLanguage  = _userinfo.preferedLanguage,
                        accountCreateTime = _userinfo.accountCreateTime
                    };
                    var result = await _controller._userManager.CreateAsync(current);
                }
                else
                {
                    current.nickname          = _userinfo.nickname;
                    current.sex               = _userinfo.sex;
                    current.headimgurl        = _userinfo.headimgurl;
                    current.preferedLanguage  = _userinfo.preferedLanguage;
                    current.accountCreateTime = _userinfo.accountCreateTime;
                    await _controller._userManager.UpdateAsync(current);
                }
                await _controller._signInManager.SignInAsync(current, true);
            }
            return(Redirect(state));
        }
コード例 #18
0
 private ViewAppViewModel(DeveloperUser User, App ThisApp) : base(User)
 {
     if (ThisApp.CreaterId != User.Id)
     {
         throw new AiurCrossAuthorityException("The app is not the user's app!");
     }
     this.AppName             = ThisApp.AppName;
     this.AppDescription      = ThisApp.AppDescription;
     this.AppCategory         = ThisApp.AppCategory;
     this.AppPlatform         = ThisApp.AppPlatform;
     this.AppId               = ThisApp.AppId;
     this.AppSecret           = ThisApp.AppSecret;
     this.EnableOAuth         = ThisApp.EnableOAuth;
     this.ForceInputPassword  = ThisApp.ForceInputPassword;
     this.ForceConfirmation   = ThisApp.ForceConfirmation;
     this.DebugMode           = ThisApp.DebugMode;
     this.PrivacyStatementUrl = ThisApp.PrivacyStatementUrl;
     this.LicenseUrl          = ThisApp.LicenseUrl;
     this.AppIconAddress      = ThisApp.AppIconAddress;
     this.AppDomain           = ThisApp.AppDomain;
 }
コード例 #19
0
        public async Task Recover(
            DeveloperUser user,
            App thisApp,
            CoreApiService coreApiService,
            OSSApiService ossApiService,
            AppsContainer appsContainer,
            SitesService sitesService)
        {
            base.RootRecover(user, 1);
            var token = await appsContainer.AccessToken(thisApp.AppId, thisApp.AppSecret);

            var buckets = await ossApiService.ViewMyBucketsAsync(token);

            Buckets = buckets.Buckets;

            var grants = await coreApiService.AllUserGrantedAsync(token);

            Grants = grants.Grants;

            var sites = await sitesService.ViewMySitesAsync(token);

            Sites = sites.Sites;
        }
コード例 #20
0
        public async Task Recover(
            DeveloperUser user,
            App thisApp,
            CoreApiService coreApiService,
            AppsContainer appsContainer,
            SitesService sitesService,
            EventService eventService)
        {
            RootRecover(user);
            var token = await appsContainer.AccessToken(thisApp.AppId, thisApp.AppSecret);


            var grants = await coreApiService.AllUserGrantedAsync(token);

            Grants = grants.Grants;

            var sites = await sitesService.ViewMySitesAsync(token);

            Sites = sites.Sites;

            var errorLogs = await eventService.ViewAsync(token);

            ErrorLogs = errorLogs.Logs;
        }
コード例 #21
0
 public void Recover(DeveloperUser user)
 {
     RootRecover(user);
 }
コード例 #22
0
 public CreateRecordViewModel(DeveloperUser user) : base(user)
 {
 }
コード例 #23
0
ファイル: NewFolderViewModel.cs プロジェクト: supeng222/Nexus
 public void Recover(DeveloperUser user, string appName)
 {
     RootRecover(user);
     AppName = appName;
 }
コード例 #24
0
ファイル: NewFolderViewModel.cs プロジェクト: supeng222/Nexus
 public NewFolderViewModel(DeveloperUser user) : base(user)
 {
 }
コード例 #25
0
ファイル: EditViewModel.cs プロジェクト: supeng222/Nexus
 public EditViewModel(DeveloperUser user) : base(user)
 {
 }
コード例 #26
0
 public DeleteViewModel(DeveloperUser user) : base(user)
 {
 }
コード例 #27
0
ファイル: NewFileViewModel.cs プロジェクト: hv0905/Nexus
 public NewFileViewModel(DeveloperUser user) : base(user, 5)
 {
 }
コード例 #28
0
 public IndexViewModel(DeveloperUser User) : base(User, 2)
 {
 }
コード例 #29
0
 public void Recover(Controller c, DeveloperUser User)
 {
     this.Recover(User, 2);
     c.ViewData["PartId"] = new SelectList(this.AllApps, nameof(App.AppId), nameof(App.AppName));
 }
コード例 #30
0
 public CreateBucketViewModel(Controller c, DeveloperUser User) : base(User, 2)
 {
     c.ViewData["PartId"] = new SelectList(this.AllApps, nameof(App.AppId), nameof(App.AppName));
 }