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 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> HasLicenseAccessWithLookup(IdentityManagerClient idMgr, string entApiKey, string username, string lookup)
        {
            var licenseAccess = await idMgr.HasLicenseAccess(entApiKey, username, AllAnyTypes.All, new List <string>() { "LCU" });

            return(licenseAccess.Status ? Status.Success : Status.Unauthorized.Clone($"No license found for user {username}"));
        }