public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization)
     : base("profileOrganization")
 {
     Id                    = organization.OrganizationId.ToString();
     Name                  = organization.Name;
     UsePolicies           = organization.UsePolicies;
     UseSso                = organization.UseSso;
     UseGroups             = organization.UseGroups;
     UseDirectory          = organization.UseDirectory;
     UseEvents             = organization.UseEvents;
     UseTotp               = organization.UseTotp;
     Use2fa                = organization.Use2fa;
     UseApi                = organization.UseApi;
     UsersGetPremium       = organization.UsersGetPremium;
     SelfHost              = organization.SelfHost;
     Seats                 = organization.Seats;
     MaxCollections        = organization.MaxCollections;
     MaxStorageGb          = organization.MaxStorageGb;
     Key                   = organization.Key;
     Status                = organization.Status;
     Type                  = organization.Type;
     Enabled               = organization.Enabled;
     SsoBound              = !string.IsNullOrWhiteSpace(organization.SsoExternalId);
     Identifier            = organization.Identifier;
     Permissions           = CoreHelpers.LoadClassFromJsonData <Permissions>(organization.Permissions);
     ResetPasswordEnrolled = organization.ResetPasswordKey != null;
     UserId                = organization.UserId?.ToString();
 }
        public PoliciesModel(ICollection <Policy> policies, OrganizationUserOrganizationDetails selectedOrgDetails)
        {
            if (policies == null)
            {
                return;
            }

            var policyDict = policies?.ToDictionary(p => p.Type);

            Policies = new List <PolicyModel>();

            foreach (var type in Enum.GetValues(typeof(PolicyType)).Cast <PolicyType>())
            {
                if (type == PolicyType.RequireSso && !selectedOrgDetails.UseSso)
                {
                    continue;
                }

                if (type == PolicyType.ResetPassword && !selectedOrgDetails.UseResetPassword)
                {
                    continue;
                }

                var enabled = policyDict.ContainsKey(type) ? policyDict[type].Enabled : false;
                Policies.Add(new PolicyModel(type, enabled));
            }
        }
Exemple #3
0
 public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization)
     : base("profileOrganization")
 {
     Id              = organization.OrganizationId.ToString();
     Name            = organization.Name;
     UsePolicies     = organization.UsePolicies;
     UseSso          = organization.UseSso;
     UseGroups       = organization.UseGroups;
     UseDirectory    = organization.UseDirectory;
     UseEvents       = organization.UseEvents;
     UseTotp         = organization.UseTotp;
     Use2fa          = organization.Use2fa;
     UseApi          = organization.UseApi;
     UsersGetPremium = organization.UsersGetPremium;
     SelfHost        = organization.SelfHost;
     Seats           = organization.Seats;
     MaxCollections  = organization.MaxCollections;
     MaxStorageGb    = organization.MaxStorageGb;
     Key             = organization.Key;
     Status          = organization.Status;
     Type            = organization.Type;
     Enabled         = organization.Enabled;
     SsoBound        = !string.IsNullOrWhiteSpace(organization.SsoExternalId);
     Identifier      = organization.Identifier;
 }
Exemple #4
0
 public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization)
     : base("profileOrganization")
 {
     Id     = organization.OrganizationId.ToString();
     Name   = organization.Name;
     Key    = organization.Key;
     Status = organization.Status;
 }
Exemple #5
0
 public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization)
     : base("profileOrganization")
 {
     Id             = organization.OrganizationId.ToString();
     Name           = organization.Name;
     UseGroups      = organization.UseGroups;
     Seats          = organization.Seats;
     MaxCollections = organization.MaxCollections;
     Key            = organization.Key;
     Status         = organization.Status;
     Type           = organization.Type;
     Enabled        = organization.Enabled;
 }
Exemple #6
0
        public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization) : this("profileOrganization")
        {
            Id                            = organization.OrganizationId.ToString();
            Name                          = organization.Name;
            UsePolicies                   = organization.UsePolicies;
            UseSso                        = organization.UseSso;
            UseKeyConnector               = organization.UseKeyConnector;
            UseScim                       = organization.UseScim;
            UseGroups                     = organization.UseGroups;
            UseDirectory                  = organization.UseDirectory;
            UseEvents                     = organization.UseEvents;
            UseTotp                       = organization.UseTotp;
            Use2fa                        = organization.Use2fa;
            UseApi                        = organization.UseApi;
            UseResetPassword              = organization.UseResetPassword;
            UsersGetPremium               = organization.UsersGetPremium;
            SelfHost                      = organization.SelfHost;
            Seats                         = organization.Seats;
            MaxCollections                = organization.MaxCollections;
            MaxStorageGb                  = organization.MaxStorageGb;
            Key                           = organization.Key;
            HasPublicAndPrivateKeys       = organization.PublicKey != null && organization.PrivateKey != null;
            Status                        = organization.Status;
            Type                          = organization.Type;
            Enabled                       = organization.Enabled;
            SsoBound                      = !string.IsNullOrWhiteSpace(organization.SsoExternalId);
            Identifier                    = organization.Identifier;
            Permissions                   = CoreHelpers.LoadClassFromJsonData <Permissions>(organization.Permissions);
            ResetPasswordEnrolled         = organization.ResetPasswordKey != null;
            UserId                        = organization.UserId?.ToString();
            ProviderId                    = organization.ProviderId?.ToString();
            ProviderName                  = organization.ProviderName;
            FamilySponsorshipFriendlyName = organization.FamilySponsorshipFriendlyName;
            FamilySponsorshipAvailable    = FamilySponsorshipFriendlyName == null &&
                                            StaticStore.GetSponsoredPlan(PlanSponsorshipType.FamiliesForEnterprise)
                                            .UsersCanSponsor(organization);
            PlanProductType = StaticStore.GetPlan(organization.PlanType).Product;
            FamilySponsorshipLastSyncDate = organization.FamilySponsorshipLastSyncDate;
            FamilySponsorshipToDelete     = organization.FamilySponsorshipToDelete;
            FamilySponsorshipValidUntil   = organization.FamilySponsorshipValidUntil;

            if (organization.SsoConfig != null)
            {
                var ssoConfigData = SsoConfigurationData.Deserialize(organization.SsoConfig);
                KeyConnectorEnabled = ssoConfigData.KeyConnectorEnabled && !string.IsNullOrEmpty(ssoConfigData.KeyConnectorUrl);
                KeyConnectorUrl     = ssoConfigData.KeyConnectorUrl;
            }
        }
Exemple #7
0
 public ProfileOrganizationResponseModel(OrganizationUserOrganizationDetails organization)
     : base("profileOrganization")
 {
     Id             = organization.OrganizationId.ToString();
     Name           = organization.Name;
     UseGroups      = organization.UseGroups;
     UseDirectory   = organization.UseDirectory;
     UseEvents      = organization.UseEvents;
     UseTotp        = organization.UseTotp;
     Use2fa         = organization.Use2fa;
     Seats          = organization.Seats;
     MaxCollections = organization.MaxCollections;
     MaxStorageGb   = organization.MaxStorageGb;
     Key            = organization.Key;
     Status         = organization.Status;
     Type           = organization.Type;
     Enabled        = organization.Enabled;
 }