public bool GetLdapUseSSL()
        {
            bool?ldap = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapUseSsl, 0)] as bool?;

            if (ldap.HasValue)
            {
                return(ldap.Value);
            }

            PgSqlDatabaseConnector.GetDatabaseValues(Parent);

            return((Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapUseSsl, 0)] as bool?).Value);
        }
        public string GetDbVersion()
        {
            string version = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.DataBaseVersion, 0)] as string;

            if (version != null && version.Length > 0)
            {
                return(version);
            }

            PgSqlDatabaseConnector.GetDatabaseValues(Parent);

            return(Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.DataBaseVersion, 0)] as string);
        }
        public string GetLdapContext()
        {
            string ldap = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapContext, 0)] as string;

            if (ldap != null && ldap.Length > 0)
            {
                return(ldap);
            }

            PgSqlDatabaseConnector.GetDatabaseValues(Parent);

            return(Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapContext, 0)] as string);
        }
        public string GetLdapPassword()
        {
            string ldap = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapPassword, 0)] as string;

            if (ldap != null)
            {
                return(ldap);
            }

            PgSqlDatabaseConnector.GetDatabaseValues(Parent);

            return(Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapPassword, 0)] as string);
        }
        public int GetLdapPort()
        {
            int?ldap = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapPort, 0)] as int?;

            if (ldap.HasValue)
            {
                return(ldap.Value);
            }

            PgSqlDatabaseConnector.GetDatabaseValues(Parent);

            return((Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LdapPort, 0)] as int?).Value);
        }
        public LocalDirectoryType?GetLocalDirectoryType()
        {
            LocalDirectoryType?ld_typ = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LocalDirectoryType, 0)] as LocalDirectoryType?;

            if (ld_typ.HasValue)
            {
                return(ld_typ);
            }

            PgSqlDatabaseConnector.GetDatabaseValues(Parent);

            return(Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LocalDirectoryType, 0)] as LocalDirectoryType?);
        }
        public UserAuthenticationTyp?GetAllowedAuthenticationModes()
        {
            using (NpgsqlConnection con = PostgreSQLConn.CreateConnection(Parent.CurrentUser))
            {
                bool list_auth, forms_auth, ld_auth;
                list_auth = forms_auth = ld_auth = false;

                bool?val = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.ListAuthentication, 0)] as bool?;
                if (!val.HasValue)
                {
                    PgSqlDatabaseConnector.GetDatabaseValues(Parent);
                }
                list_auth = (Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.ListAuthentication, 0)] as bool?).Value;

                val = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.FormsAuthentication, 0)] as bool?;
                if (!val.HasValue)
                {
                    PgSqlDatabaseConnector.GetDatabaseValues(Parent);
                }
                forms_auth = (Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.FormsAuthentication, 0)] as bool?).Value;

                val = Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LocalDirectoryAuthentication, 0)] as bool?;
                if (!val.HasValue)
                {
                    PgSqlDatabaseConnector.GetDatabaseValues(Parent);
                }
                ld_auth = (Parent.CurrentUser.Cache[ObjectLifetimeIdentifier.GetIdentifier(CacheObject.LocalDirectoryAuthentication, 0)] as bool?).Value;

                if (list_auth)
                {
                    if (forms_auth)
                    {
                        if (ld_auth)
                        {
                            return(UserAuthenticationTyp.ListAuthentication | UserAuthenticationTyp.FormsAuthentication | UserAuthenticationTyp.LocalDirectoryAuthentication);
                        }
                        else
                        {
                            return(UserAuthenticationTyp.ListAuthentication | UserAuthenticationTyp.FormsAuthentication);
                        }
                    }
                    else
                    {
                        if (ld_auth)
                        {
                            return(UserAuthenticationTyp.ListAuthentication | UserAuthenticationTyp.LocalDirectoryAuthentication);
                        }
                        else
                        {
                            return(UserAuthenticationTyp.ListAuthentication);
                        }
                    }
                }
                else
                {
                    if (forms_auth)
                    {
                        if (ld_auth)
                        {
                            return(UserAuthenticationTyp.FormsAuthentication | UserAuthenticationTyp.LocalDirectoryAuthentication);
                        }
                        else
                        {
                            return(UserAuthenticationTyp.FormsAuthentication);
                        }
                    }
                    else
                    {
                        if (ld_auth)
                        {
                            return(UserAuthenticationTyp.LocalDirectoryAuthentication);
                        }
                        else
                        {
                            return(null);            //Errors
                        }
                    }
                }
            }
        }