コード例 #1
0
        public void FillProperties ()
        {
            try {
                Utilities.GetItemProperties (Name, ServerDTO, _properties);
                if (_properties.Count > 0) {
                    VMDirBagItem value = new VMDirBagItem ();
                    if (_properties.ContainsKey ("objectClass"))
                        _properties.TryGetValue ("objectClass", out value);
                    if (value != null) {
                        LdapValue[] valArray = value.Value as LdapValue[];
                        foreach (var ob in valArray) {
                            switch (ob.StringValue) {
                            case "user":
                                NodeType = DirectoryNodeType.User;
                                break;
                            case "group":
                                NodeType = DirectoryNodeType.Groups;
                                break;
                            default:
                                NodeType = DirectoryNodeType.GenericObject;
                                break;
                            }

                        }
                    }
                }
            } catch (Exception ex) {
                UIErrorHelper.ShowAlert ("", ex.Message);
            }
        }
コード例 #2
0
ファイル: Utilities.cs プロジェクト: DhanashreeA/lightwave
        public static Dictionary <string, VMDirBagItem> GetProperties(VMDirServerDTO serverDTO, List <ILdapEntry> entries)
        {
            var _properties = new Dictionary <string, VMDirBagItem>();

            foreach (LdapEntry entry in entries)
            {
                string[] names = entry.getAttributeNames().ToArray();
                foreach (string name in names)
                {
                    var    key        = name;
                    var    attribType = serverDTO.Connection.SchemaManager.GetAttributeType(key);
                    bool   readOnly   = true;
                    string desc       = "";
                    if (attribType != null)
                    {
                        readOnly = attribType.ReadOnly;
                        desc     = attribType.Description;
                        LdapValue[] vals = entry.getAttributeValues(name).ToArray();
                        _properties[key] = new VMDirBagItem
                        {
                            Value       = vals,
                            IsReadOnly  = readOnly,
                            Description = desc,
                            IsRequired  = true
                        };
                    }
                }
            }
            return(_properties);
        }
コード例 #3
0
        private void Bind ()
        {
            var requiredProps = _serverDTO.Connection.SchemaManager.GetRequiredAttributesWithContentRules (_objectClass);
            _properties = new Dictionary<string, VMDirBagItem> ();
            foreach (var prop in requiredProps) {
                var item = new VMDirBagItem {
                    Value = prop.Name.Equals ("objectClass") ? (Utilities.StringToLdapValue (_objectClass)) : null,
                    Description = prop.Description,
                    IsRequired = true,
                    IsReadOnly = prop.ReadOnly
                };
                _properties.Add (prop.Name, item);

            }

            VMDirBagItem itemCN = null;
            if (!_properties.TryGetValue ("cn", out itemCN)) {
                _properties.Add ("cn", new VMDirBagItem{ Value = null, Description = "", IsRequired = true });
            }
        }
コード例 #4
0
ファイル: Utilities.cs プロジェクト: syeduguri/lightwave
        //call checked exec on the caller of this method
        public static void  GetItemProperties(string itemName, VMDirServerDTO serverDTO, Dictionary <string, VMDirBagItem> _properties)
        {
            ILdapMessage ldMsg = null;

            try {
                List <ILdapEntry> dnEntries = serverDTO.Connection.SearchAndGetEntries(itemName, LdapScope.SCOPE_BASE, "(objectClass=*)", null, 0, ref ldMsg);
                foreach (LdapEntry entry in dnEntries)
                {
                    string[] names = entry.getAttributeNames().ToArray();
                    foreach (string name in names)
                    {
                        LdapValue[] vals       = entry.getAttributeValues(name).ToArray();
                        var         val        = vals;
                        var         key        = name;
                        var         attribType = serverDTO.Connection.SchemaManager.GetAttributeType(key);
                        bool        readOnly   = true;
                        string      desc       = "";
                        if (attribType != null)
                        {
                            readOnly = attribType.ReadOnly;
                            desc     = attribType.Description;
                            if (attribType != null)
                            {
                                _properties [key] = new VMDirBagItem {
                                    Value       = val,
                                    IsReadOnly  = readOnly,
                                    Description = desc,
                                    IsRequired  = true
                                };
                            }
                        }
                    }
                }
                if (ldMsg != null)
                {
                    (ldMsg as LdapMessage).FreeMessage();
                }
            } catch (Exception e) {
                throw e;
            }
        }
コード例 #5
0
ファイル: Utilities.cs プロジェクト: saberlilydian/lightwave
 //call checked exec on the caller of this method
 public static void  GetItemProperties (string itemName, VMDirServerDTO serverDTO, Dictionary<string,VMDirBagItem> _properties)
 {
     ILdapMessage ldMsg = null;
     try {
         List<ILdapEntry> dnEntries = serverDTO.Connection.SearchAndGetEntries (itemName, LdapScope.SCOPE_BASE, "(objectClass=*)", null, 0, ref ldMsg);
         foreach (LdapEntry entry in dnEntries) {
             string[] names = entry.getAttributeNames ().ToArray ();
             foreach (string name in names) {
                 LdapValue[] vals = entry.getAttributeValues (name).ToArray ();
                 var val = vals;
                 var key = name;
                 var attribType = serverDTO.Connection.SchemaManager.GetAttributeType (key);
                 bool readOnly = true;
                 string desc = "";
                 if (attribType != null) {
                     readOnly = attribType.ReadOnly;
                     desc = attribType.Description;
                     if (attribType != null) {
                         _properties [key] = new VMDirBagItem {
                             Value = val,
                             IsReadOnly = readOnly,
                             Description = desc,
                             IsRequired = true
                         };
                     }
                 }
             }
         }
         if (ldMsg != null)
             (ldMsg as LdapMessage).FreeMessage ();
     } catch (Exception e) {
         throw e;
     }
 }