Пример #1
0
        public void ShowAddGroup()
        {
            GroupDTO dto = new GroupDTO();
            AddNewGroupController agc = new AddNewGroupController(dto);
            nint res = NSApplication.SharedApplication.RunModalForWindow(agc.Window);

            if (res == (nint)VMIdentityConstants.DIALOGOK)
            {
                UIErrorHelper.CheckedExec(delegate()
                {
                    LdapMod[] user = new LdapMod[4];
                    user[0]        = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_CN, new string[] {
                        dto.cn,
                        null
                    });
                    user[1] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_GROUPTYPE, new string[] {
                        dto.groupType.ToString(),
                        null
                    });
                    user[2] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_SAM_ACCOUNT_NAME, new string[] {
                        dto.sAMAccountName,
                        null
                    });
                    user[3] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_OBJECT_CLASS, new string[] {
                        dto.objectClass,
                        null
                    });
                    string dn = string.Format("cn={0},{1}", dto.cn, Dn);
                    ServerDTO.Connection.AddObject(dn, user);
                    UIErrorHelper.ShowInformation(VMDirConstants.STAT_GRP_ADD_SUCC);
                    var oc = Utilities.GetObjectClassList(ServerDTO, dn, LdapScope.SCOPE_BASE);
                    this.Children.Insert(0, new DirectoryNode(dn, oc, ServerDTO, this));
                    //ReloadChildren();
                    RefreshProperties();
                    NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this);
                    NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this);
                });
            }
        }
Пример #2
0
        public void ShowAddGroup()
        {
            GroupDTO dto = new GroupDTO();
            AddNewGroupController agc = new AddNewGroupController(dto);
            nint res = NSApplication.SharedApplication.RunModalForWindow(agc.Window);

            if (res == (nint)VMIdentityConstants.DIALOGOK)
            {
                UIErrorHelper.CheckedExec(delegate() {
                    LdapMod[] user = new LdapMod[4];
                    user [0]       = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_CN, new string[] {
                        dto.cn,
                        null
                    });
                    user [1] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_GROUPTYPE, new string[] {
                        dto.groupType.ToString(),
                        null
                    });
                    user [2] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_SAM_ACCOUNT_NAME, new string[] {
                        dto.sAMAccountName,
                        null
                    });
                    user [3] = new LdapMod((int)LdapMod.mod_ops.LDAP_MOD_ADD, VMDirConstants.ATTR_OBJECT_CLASS, new string[] {
                        dto.objectClass,
                        null
                    });
                    string dn = string.Format("cn={0},{1}", dto.cn, Name);
                    ServerDTO.Connection.AddObject(dn, user);
                    UIErrorHelper.ShowAlert("", "Successfully added object");
                    ReloadChildren();
                    RefreshProperties();
                    NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this);
                    NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadTableView", this);
                });
            }
        }