Beispiel #1
0
        /// <summary>
        /// Create the persisted object that contains default configuration of LDAPCP.
        /// It should be created only in central administration with application pool credentials
        /// because this is the only place where we are sure user has the permission to write in the config database
        /// </summary>
        public static ZimbraConfig CreatePersistedObject()
        {
            ZimbraConfig PersistedObject = new ZimbraConfig(SPFarm.Local);

            PersistedObject.Id = new Guid(Constants.LDAPCPPersistedObjectID);
            PersistedObject    = GetDefaultSettings(PersistedObject);
            try
            {
                PersistedObject.Update();
            }
            catch (NullReferenceException nullex)
            {
                // This exception occurs if an older version of the persisted object lives in the config database with a schema that doesn't match current one
                string stsadmcmd = String.Format("SELECT * FROM Objects WHERE Id LIKE '{0}'", Constants.LDAPCPPersistedObjectID);
                string error     = String.Format("Unable to create PersistedObject {0}. This usually occurs because a persisted object with the same Id is used by another assembly (could be a previous version). Object is impossible to update or delete from Object Model unless you add the missing assembly to the GAC. You can see this object by running this query: \"{1}\"", PersistedObject.Name, stsadmcmd);

                //ZimbraClaimProvider.LogToULS(error,TraceSeverity.Unexpected,EventSeverity.Error);

                // Tyy to delete it... but OM doesn't manage to get the object
                SPPersistedObject staleObject = SPFarm.Local.GetObject(new Guid(Constants.LDAPCPPersistedObjectID));
                if (staleObject != null)
                {
                    staleObject.Delete();
                    PersistedObject.Update();
                }
                else
                {
                    throw new Exception(error, nullex);
                }
            }

            //ZimbraClaimProvider.LogToULS(String.Format("Created PersistedObject {0} with Id {1}", PersistedObject.Name, PersistedObject.Id),TraceSeverity.Medium,EventSeverity.Information);

            return(PersistedObject);
        }
Beispiel #2
0
 public static ZimbraConfig GetDefaultSettings(ZimbraConfig PersistedObject)
 {
     PersistedObject.AttributesList            = GetDefaultAttributesList();
     PersistedObject.PickerEntityGroupName     = "Results";
     PersistedObject.AlwaysResolveUserInput    = false;
     PersistedObject.UseSharePointDomain       = true;
     PersistedObject.AlwaysResolveUserInput    = false;
     PersistedObject.AddWildcardInFrontOfQuery = false;
     PersistedObject.FilterEnabledUsersOnly    = false;
     PersistedObject.FilterSecurityGroupsOnly  = false;
     return(PersistedObject);
 }
Beispiel #3
0
        public static ZimbraConfig ResetClaimsList()
        {
            ZimbraConfig persistedObject = GetFromConfigDB;

            if (persistedObject != null)
            {
                persistedObject.AttributesList.Clear();
                persistedObject.AttributesList = GetDefaultAttributesList();
                persistedObject.Update();

                //ZimbraClaimProvider.LogToULS(String.Format("Claims list of PersistedObject {0} was successfully reset to default relationship table", ZimbraConfig.LdapcpPersistecObjectName), TraceSeverity.High, EventSeverity.Information);
            }
            return(null);
        }