Esempio n. 1
0
        public static void SetEntryValue(DirectoryEntry entry, SyncProperty adProp, string value)
        {
            var propValue   = value.MaximizeLength(adProp.MaxLength);
            var propValColl = entry.Properties[adProp.Name];

            // ha törlünk egy propertyt portálon, akkor AD-ban ne csak a valuet töröljük, hanem a propertyt magát különben constraint errort kapunk
            // to avoid constraint error delete the property (not only its value) if the property is removed on the portal.
            // removeat: single-valued properties, clear: multi-valued properties
            if (string.IsNullOrEmpty(propValue))
            {
                if (propValColl.Count == 0)
                {
                    return;
                }
                // single valued property
                if (propValColl.Count == 1)
                {
                    propValColl.RemoveAt(0);
                    return;
                }
                // multi valued property
                propValColl.Clear();
                return;
            }

            // setting the value null clears the collection
            propValColl.Value = null;

            // setting the value to propValue adds propValue to the collection
            propValColl.Value = propValue;
        }
Esempio n. 2
0
        public static void SetNodeValue(Node node, SyncProperty portalProp, string value)
        {
            var propValue = value.MaximizeLength(portalProp.MaxLength);

            switch (portalProp.Name)
            {
            case "Name":
                node.Name = propValue;

                // in case of AD users the login name should be the same as the content name
                var user = node as User;
                if (user != null)
                {
                    user.LoginName = propValue;
                }
                break;

            default:
                if (node.HasProperty(portalProp.Name))
                {
                    node[portalProp.Name] = propValue;
                }
                break;
            }
        }
Esempio n. 3
0
        public static void SetEntryValue(DirectoryEntry entry, SyncProperty adProp, string value)
        {
            var propValue   = value.MaximizeLength(adProp.MaxLength);
            var propValColl = entry.Properties[adProp.Name];

            // ha törlünk egy propertyt portálon, akkor AD-ban ne csak a valuet töröljük, hanem a propertyt magát
            // különben constraint errort kapunk
            // removeat: single-valued properties, clear: multi-valued properties
            if (string.IsNullOrEmpty(propValue))
            {
                // ha nincs besettelve AD-ban a property, és portálról sem nyúlunk hozzá, akkor ne csináljunk semmit
                if (propValColl.Count == 0)
                {
                    return;
                }
                // single valued property
                if (propValColl.Count == 1)
                {
                    propValColl.RemoveAt(0);
                    return;
                }
                // multi valued property
                propValColl.Clear();
                return;
            }

            // setting the value null clears the collection
            propValColl.Value = null;

            // setting the value to propValue adds propValue to the collection
            propValColl.Value = propValue;
        }
Esempio n. 4
0
        public static string GetEntryValue(DirectoryEntry entry, SyncProperty adProp)
        {
            var propValColl = entry.Properties[adProp.Name];

            if (propValColl == null)
            {
                return(string.Empty);
            }

            string value = null;

            if (propValColl.Count >= 1)
            {
                value = propValColl[0] as string;
            }
            return(value ?? string.Empty);
        }
Esempio n. 5
0
        public static string GetNodeValue(Node node, SyncProperty portalProp)
        {
            if (node.HasProperty(portalProp.Name))
            {
                var propValue = node[portalProp.Name];
                if (propValue == null)
                {
                    return(null);
                }
                return(propValue.ToString());
            }

            switch (portalProp.Name)
            {
            case "Name":
                return(node.Name);

            default:
                return(null);
            }
        }
Esempio n. 6
0
        public static void SetNodeValue(Node node, SyncProperty portalProp, string value)
        {
            var propValue = value.MaximizeLength(portalProp.MaxLength);

            switch (portalProp.Name)
            {
            case "Name":
                node.Name = propValue;
                break;

            default:
                if (node.HasProperty(portalProp.Name))
                {
                    node[portalProp.Name] = propValue;
                }
                else
                {
                    // log: nincs ilyen property
                }
                break;
            }
        }
Esempio n. 7
0
        public static void SetEntryValue(DirectoryEntry entry, SyncProperty adProp, string value)
        {
            var propValue = value.MaximizeLength(adProp.MaxLength);
            var propValColl = entry.Properties[adProp.Name];

            // ha törlünk egy propertyt portálon, akkor AD-ban ne csak a valuet töröljük, hanem a propertyt magát
            // különben constraint errort kapunk
            // removeat: single-valued properties, clear: multi-valued properties
            if (string.IsNullOrEmpty(propValue))
            {
                // ha nincs besettelve AD-ban a property, és portálról sem nyúlunk hozzá, akkor ne csináljunk semmit
                if (propValColl.Count == 0)
                    return;
                // single valued property
                if (propValColl.Count == 1)
                {
                    propValColl.RemoveAt(0);
                    return;
                }
                // multi valued property
                propValColl.Clear();
                return;
            }

            // setting the value null clears the collection
            propValColl.Value = null;

            // setting the value to propValue adds propValue to the collection
            propValColl.Value = propValue;
        }
Esempio n. 8
0
        public static string GetEntryValue(DirectoryEntry entry, SyncProperty adProp)
        {
            var propValColl = entry.Properties[adProp.Name];

            if (propValColl == null)
                return string.Empty;

            string value = null;
            if (propValColl.Count >= 1)
            {
                value = propValColl[0] as string;
            }
            return value ?? string.Empty;
        }
Esempio n. 9
0
        public static void SetNodeValue(Node node, SyncProperty portalProp, string value)
        {
            var propValue = value.MaximizeLength(portalProp.MaxLength);

            switch (portalProp.Name)
            {
                case "Name":
                    node.Name = propValue;
                    break;
                default:
                    if (node.HasProperty(portalProp.Name))
                        node[portalProp.Name] = propValue;
                    else
                    {
                        // log: nincs ilyen property
                    }
                    break;
            }
        }
Esempio n. 10
0
        public static string GetNodeValue(Node node, SyncProperty portalProp)
        {
            if (node.HasProperty(portalProp.Name))
            {
                var propValue = node[portalProp.Name];
                if (propValue == null)
                    return null;
                return propValue.ToString();
            }

            switch (portalProp.Name)
            {
                case "Name":
                    return node.Name;
                default:
                    // log: nincs ilyen property
                    return null;
            }
        }