public virtual async Task ListSubscribers(IdentityManagerClient idMgr, string entApiKey)
        {
            // Get the list of subscribers based on subscriber status
            var subscriberResp = await idMgr.ListLicensedSubscribers(entApiKey);

            State.Subscribers = subscriberResp.Model;
        }
示例#2
0
        public Refresh(ApplicationDeveloperClient appDev, ApplicationManagerClient appMgr, IdentityManagerClient idMgr)
        {
            this.appDev = appDev;

            this.appMgr = appMgr;

            this.idMgr = idMgr;
        }
        public RequestUserAccess(ApplicationManagerClient appMgr, SecurityManagerClient secMgr, IdentityManagerClient idMgr)
        {
            this.idMgr = idMgr;

            this.secMgr = secMgr;

            this.appMgr = appMgr;
        }
示例#4
0
        public virtual async Task LoadAccessRightOptions(IdentityManagerClient idMgr, string entLookup)
        {
            log.LogInformation($"Loading Access right options for {entLookup}");

            var accessRightsResp = await idMgr.ListAccessRights(entLookup);

            State.AccessRightOptions = accessRightsResp?.Model?.Select(ar => ar.Lookup).ToList() ?? new List <string>();
        }
        public virtual async Task <Status> ListLicenses(IdentityManagerClient idMgr, string entApiKey, string username)
        {
            var licenseAccess = await idMgr.ListLicenseAccessTokens(entApiKey, username, new List <string>() { "LCU" });

            State.UserLicenses = licenseAccess.Model;

            return((licenseAccess != null) ? Status.Success : Status.Unauthorized.Clone($"No licenses found for user {username}"));
        }
        public virtual async Task <Status> HasLicenseAccess(IdentityManagerClient idMgr, string entLookup, string username)
        {
            await DesignOutline.Instance.Retry()
            .SetActionAsync(async() =>
            {
                try
                {
                    var hasAccess = await idMgr.HasLicenseAccess(entLookup, username, Personas.AllAnyTypes.All, new List <string>()
                    {
                        "iot"
                    });

                    State.HasAccess = hasAccess.Status;

                    if (State.HasAccess)
                    {
                        if (hasAccess.Model.Metadata.ContainsKey("LicenseType"))
                        {
                            State.AccessLicenseType = hasAccess.Model.Metadata["LicenseType"].ToString();
                        }

                        if (hasAccess.Model.Metadata.ContainsKey("PlanGroup"))
                        {
                            State.AccessPlanGroup = hasAccess.Model.Metadata["PlanGroup"].ToString();
                        }

                        if (hasAccess.Model.Metadata.ContainsKey("PointQueries"))
                        {
                            State.MaxPointQueries = hasAccess.Model.Metadata["PointQueries"].ToString().As <int>();
                        }
                    }
                    else
                    {
                        State.AccessLicenseType = "forecast";

                        State.AccessPlanGroup = "hobby";

                        State.MaxPointQueries = 10000;
                    }

                    return(false);
                }
                catch (Exception ex)
                {
                    log.LogError(ex, "Failed checking has license access type");

                    return(true);
                }
            })
            .SetCycles(5)
            .SetThrottle(25)
            .SetThrottleScale(2)
            .Run();

            return(Status.Success);
        }
        public CompletePayment(EnterpriseManagerClient entMgr, SecurityManagerClient secMgr, IdentityManagerClient idMgr)
        {
            billingEntApiKey = Environment.GetEnvironmentVariable("LCU-BILLING-ENTERPRISE-API-KEY");

            this.entMgr = entMgr;

            this.idMgr = idMgr;

            this.secMgr = secMgr;
        }
        public NapkinIDESetupStateHarness(HttpRequest req, ILogger logger, NapkinIDESetupState state)
            : base(req, logger, state)
        {
            devOpsArch = req.ResolveClient <DevOpsArchitectClient>(logger);

            entArch = req.ResolveClient <EnterpriseArchitectClient>(logger);

            entMgr = req.ResolveClient <EnterpriseManagerClient>(logger);

            idMgr = req.ResolveClient <IdentityManagerClient>(logger);
        }
        public Refresh(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr,
                       SecurityManagerClient secMgr)
        {
            this.entArch = entArch;

            this.entMgr = entMgr;

            this.idMgr = idMgr;

            this.secMgr = secMgr;
        }
示例#10
0
        public virtual async Task RefreshTours(IdentityManagerClient idMgr, string entApiKey, string username)
        {
            LoadGuidedTours();

            await SetToursEnabled(idMgr, entApiKey, username);

            if (State.CurrentTour == null && !State.ToursEnabled)
            {
                State.CurrentTour = State.Tours.FirstOrDefault(tour => tour.Lookup == "limited-trial-tour");
            }
        }
        public Refresh(ApplicationManagerClient appMgr, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr,
                       SecurityManagerClient secMgr)
        {
            this.appMgr = appMgr;

            this.entMgr = entMgr;

            this.idMgr = idMgr;

            this.secMgr = secMgr;
        }
        public virtual async Task <Status> SetLicenseAccess(IdentityManagerClient idMgr, string entApiKey, string username, int trialLength, bool isLocked, bool isReset)
        {
            var response = await idMgr.IssueLicenseAccess(new LicenseAccessToken()
            {
                IsLocked        = isLocked,
                IsReset         = isReset,
                TrialPeriodDays = trialLength,
                Username        = username
            }, entApiKey);

            return(response.Status);
        }
        public DataFlowManagerStateHarness(HttpRequest req, ILogger logger, DataFlowManagerState state)
            : base(req, logger, state)
        {
            appMgr = req.ResolveClient <ApplicationManagerClient>(logger);

            devOpsArch = req.ResolveClient <DevOpsArchitectClient>(logger);

            entArch = req.ResolveClient <EnterpriseArchitectClient>(logger);

            entMgr = req.ResolveClient <EnterpriseManagerClient>(logger);

            idMgr = req.ResolveClient <IdentityManagerClient>(logger);
        }
        public virtual async Task <Status> HasAccess(IdentityManagerClient idMgr, string entApiKey, string username)
        {
            var hasAccess = await idMgr.HasLicenseAccess(forecastEntLookup, username, Personas.AllAnyTypes.All, new List <string>() { "forecast" });

            State.HasAccess = hasAccess.Status;

            if (State.HasAccess)
            {
                State.AccessLicenseType = hasAccess.Model.Metadata["LicenseType"].ToString();

                State.AccessPlanGroup = hasAccess.Model.Metadata["PlanGroup"].ToString();
            }

            return(Status.Success);
        }
        public virtual async Task <Status> Refresh(EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr,
                                                   IdentityManagerClient idMgr, SecurityManagerClient secMgr, StateDetails stateDetails)
        {
            await EnsureUserEnterprise(entArch, entMgr, secMgr, stateDetails.EnterpriseLookup, stateDetails.Username);

            await Task.WhenAll(
                HasLicenseAccess(idMgr, stateDetails.EnterpriseLookup, stateDetails.Username)
                );

            await Task.WhenAll(
                EnsureAPISubscription(entArch, stateDetails.EnterpriseLookup, stateDetails.Username),
                LoadAPIOptions()
                );

            State.Loading = false;

            return(Status.Success);
        }
示例#16
0
        public virtual async Task Ensure(ApplicationManagerClient appMgr, IdentityManagerClient idMgr, string entApiKey, string username)
        {
            // check in to see if user has free trial/paid subscriber rights
            var authResp = await idMgr.HasAccess(entApiKey, username, new List <string>() { "LCU.NapkinIDE.AllAccess" });

            State.IsActiveSubscriber = authResp.Status;

            var activitiesResp = await appMgr.LoadIDEActivities(entApiKey);

            if (State.IsActiveSubscriber)
            {
                var appsResp = await appMgr.ListApplications(entApiKey);

                State.InfrastructureConfigured = activitiesResp.Status && !activitiesResp.Model.IsNullOrEmpty() && appsResp.Status && !appsResp.Model.IsNullOrEmpty();
            }
            else
            {
                State.InfrastructureConfigured = true;
            }

            if (activitiesResp.Status)
            {
                await SetupActivities(activitiesResp.Model, entApiKey);
            }

            await LoadHeaderActions();

            await LoadSideBar(appMgr, entApiKey);

            if (State.IsActiveSubscriber)
            {
                var appsResp = await appMgr.ListApplications(entApiKey);

                State.InfrastructureConfigured = activitiesResp.Status && !activitiesResp.Model.IsNullOrEmpty() && appsResp.Status && !appsResp.Model.IsNullOrEmpty();
            }
            else
            {
            }
        }
示例#17
0
        public Refresh(EnterpriseArchitectClient entArch, IdentityManagerClient idMgr)
        {
            this.entArch = entArch;

            this.idMgr = idMgr;
        }
示例#18
0
        public virtual async Task Refresh(ApplicationManagerClient appMgr, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr,
                                          SecurityManagerClient secMgr, string entLookup, string host)
        {
            log.LogInformation($"Refreshing data apps management state for {entLookup} at {State.ActiveHost}");

            // if (State.ActiveHost.IsNullOrEmpty())
            SetActiveHost(host);

            await LoadApplications(appMgr, entLookup);

            await Task.WhenAll(
                LoadAccessRightOptions(idMgr, entLookup),
                LoadDAFAppOptions(appMgr, entLookup),
                LoadGlobalAppSettings(secMgr, entLookup),
                RefreshZipOptions(appMgr, entMgr, entLookup)
                );

            await LoadSupportedDAFAppTypes();
        }
 public ListLicenses(IdentityManagerClient idMgr)
 {
     this.idMgr = idMgr;
 }
示例#20
0
        public virtual async Task Refresh(IDurableOrchestrationClient starter, StateDetails stateDetails, ExecuteActionRequest exActReq,
                                          ApplicationArchitectClient appArch, EnterpriseArchitectClient entArch, EnterpriseManagerClient entMgr, IdentityManagerClient idMgr,
                                          SecurityManagerClient secMgr, DocumentClient client)
        {
            // await EnsureUserEnterprise(entArch, entMgr, secMgr, stateDetails.EnterpriseLookup, stateDetails.Username);

            State.Loading = false;

            State.HomePage.Loading = false;

            State.SSL.Loading = false;
        }
        public virtual async Task <Status> Refresh(EnterpriseArchitectClient entArch, IdentityManagerClient idMgr, string entApiKey, string username)
        {
            Status status = await HasAccess(idMgr, entApiKey, username);

            if (status)
            {
                status = await LoadAPIKeys(entArch, entApiKey, username);

                if (State.APIKeys.IsNullOrEmpty())
                {
                    status = await CreateAPISubscription(entArch, entApiKey, username);
                }
            }

            return(status);
        }
        public Refresh(EnterpriseManagerClient entMgr, IdentityManagerClient idMgr)
        {
            this.entMgr = entMgr;

            this.idMgr = idMgr;
        }
示例#23
0
        public virtual async Task SetToursEnabled(IdentityManagerClient idMgr, string entApiKey, string username)
        {
            var authResp = await idMgr.HasAccess(entApiKey, username, new List <string>() { "LCU.NapkinIDE.AllAccess" });

            State.ToursEnabled = !authResp.Status;
        }
示例#24
0
 public Reset(IdentityManagerClient idMgr)
 {
     this.idMgr = idMgr;
 }
示例#25
0
        public virtual async Task Reset(IdentityManagerClient idMgr, string entApiKey, string username)
        {
            State = new ToursManagementState();

            await RefreshTours(idMgr, entApiKey, username);
        }
示例#26
0
 public ListSubcribers(IdentityManagerClient idMgr)
 {
     this.idMgr = idMgr;
 }
示例#27
0
        public virtual async Task LoadAccessRightOptions(IdentityManagerClient idMgr, string entApiKey)
        {
            var accessRightsResp = await idMgr.ListAccessRights(entApiKey);

            State.AccessRightOptions = accessRightsResp?.Model.Select(ar => ar.Lookup).ToList() ?? new List <string>();
        }
        public ValidatePointQueryLimitsOrchestration(EnterpriseArchitectClient entArch, IdentityManagerClient idMgr)
        {
            this.entArch = entArch;

            this.idMgr = idMgr;
        }
示例#29
0
 public HasLicense(IdentityManagerClient idMgr)
 {
     this.idMgr = idMgr;
 }
示例#30
0
        public virtual async Task CompletePayment(EnterpriseManagerClient entMgr, SecurityManagerClient secMgr, IdentityManagerClient idMgr, string entApiKey,
                                                  string username, string methodId, string customerName, string plan, int trialPeriodDays)
        {
            State.CustomerName = customerName;

            State.PaymentMethodID = methodId;

            // var completeResp = await entMgr.Post<CompleteStripeSubscriptionRequest, CompleteStripeSubscriptionResponse>($"billing/{entApiKey}/stripe/subscription",
            var completeResp = await entMgr.CompleteStripeSubscription(entApiKey,
                                                                       new CompleteStripeSubscriptionRequest()
            {
                CustomerName    = State.CustomerName,
                PaymentMethodID = methodId,
                Plan            = plan,
                TrialPeriodDays = trialPeriodDays,
                Username        = username
            });

            State.PaymentStatus = completeResp.Status;

            if (State.PaymentStatus)
            {
                State.PurchasedPlanLookup = plan;

                var resp = await secMgr.SetIdentityThirdPartyData(entApiKey, username, new Dictionary <string, string>()
                {
                    { "LCU-USER-BILLING.TermsOfService", DateTimeOffset.UtcNow.ToString() },
                    { "LCU-USER-BILLING.EnterpriseAgreement", DateTimeOffset.UtcNow.ToString() }
                });

                var planOption = this.State.Plans.First(p => p.Lookup == plan);

                var licenseType = planOption.Metadata["LicenseType"].ToString();

                var token = planOption.JSONConvert <LicenseAccessToken>();

                token.EnterpriseAPIKey = entApiKey;

                token.Lookup = licenseType;

                token.AccessStartDate = DateTime.Now;

                token.TrialPeriodDays = trialPeriodDays;

                token.Username = username;

                var setLicenseAccessResp = await idMgr.IssueLicenseAccess(token, entApiKey);

                State.PaymentStatus = setLicenseAccessResp.Status;

                State.SuccessRedirect = licenseType == "lcu" ? "/workspace/new" : "https://forecast.fathym-it.com/";
            }
        }