/// <summary> /// 获取User所在的位置的Guid /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> /// <returns></returns> public Guid GetLocation(string userName, string password) { DirectoryEntry de = null; DirectoryEntry parent = null; try { de = ADManager.GetByGuid(this.guid); parent = de.Parent; return(parent.Guid); } catch { throw; } finally { if (de != null) { de.Close(); de.Dispose(); } if (parent != null) { parent.Close(); parent.Dispose(); } } }
/// <summary> /// 获取组织单位对象的子树。 /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> /// <returns></returns> public OU GetSubTree(string userName, string password) { DirectoryEntry de = null; try { de = ADManager.GetByGuid(this.guid, userName, password); this.GetSubTree(de.Path, userName, password); return(this); } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (de != null) { de.Close(); de.Dispose(); } } }
private void StartUp() { if (!ADManager.IsMemberOfDomain()) { this._Context = ContextType.Machine; } }
/// <summary> /// 更改组织单位名称。 /// </summary> /// <param name="newName">该项的新名称。</param> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Rename(string newName, string userName, string password) { DirectoryEntry de = null; string rdn = Utils.GenerateRDNOU(newName); if (ADManager.Exists(Utils.GenerateDN(rdn, Utils.GetParentDN(this.Dn)))) { throw new SameRDNException("已存在同名对象。"); } try { de = ADManager.GetByDN(this.Dn, userName, password); // 必须是DN形式,且完全转义。 de.Rename(rdn); de.CommitChanges(); // Reload this.Parse(de); } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (de != null) { de.Close(); de.Dispose(); } } }
public void ShowOverLayer() { gameState = enGameState.over; int selmodel = PlayerPrefs.GetInt(GameConst.USERDATANAME_MODEL, 0); int basescores = PlayerPrefs.GetInt(GameConst.USERDATANAME_MODEL_MAXSCORES + selmodel); int thisscores = role.scores; if (basescores < thisscores) { PlayerPrefs.SetInt(GameConst.USERDATANAME_MODEL_MAXSCORES + selmodel, thisscores); GameCenterManager.GetInstance().UploadScores(GameConst.gameModels[selmodel].lbname, thisscores); } PlayerPrefs.SetInt(GameConst.USERDATANAME_MODEL_LASTSCORES + selmodel, thisscores); if (reviveCount <= 0 && ADManager.GetInstance().isAdLoaded) { inGameUIManager.ShowReviveLayer(); } else { inGameUIManager.ShowResultLayer(); } reviveCount += 1; }
/// <summary> /// 更新组织单位。 /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Update(string userName, string password) { DirectoryEntry de = null; try { de = ADManager.GetByGuid(this.Guid, userName, password); Utils.SetProperty(de, OU.PROPERTY_DESCRIPTION, this.description); Utils.SetProperty(de, OU.PROPERTY_MANAGEDBY, this.managedBy); // 注意,不能是转义/的DN de.CommitChanges(); } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (de != null) { de.Close(); de.Dispose(); } } }
/// <summary> /// 删除组织单位。 /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Remove(string userName, string password) { DirectoryEntry de = null; try { de = ADManager.GetByGuid(this.guid, userName, password); if (de.Children.GetEnumerator().MoveNext()) { throw new ExistChildException("组织单位下存在子对象。"); } de.DeleteTree(); de.CommitChanges(); } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (de != null) { de.Close(); de.Dispose(); } } }
// Use this for initialization void Start() { Debuger.EnableLog = true; gameHeart = new GameObject("GameHeart"); gameHeart.AddComponent <DontDestroyObj>(); //初始化数据存储系统 UserDataManager.instance.Start(); //初始化事件管理器 EventManager em = gameHeart.AddComponent <EventManager>(); //声音管理器 AudioManager am = gameHeart.AddComponent <AudioManager>(); //加载联网脚本 HttpConnection hc = gameHeart.AddComponent <HttpConnection>(); //初始化场景管理器 GameSceneManager gsm = gameHeart.AddComponent <GameSceneManager>(); ConfigManager.LoadData(); (new EventChangeScene(GameSceneManager.SceneTag.Logo)).Send(); GameCenterManager.GetInstance(); ADManager.GetInstance(); }
private void Awake() { if (instance == null) { instance = this; } }
public HttpResponseMessage DeleteUSer(string username) { DnnUser dnnUser = new DnnUser(username); Dictionary <string, string> listParam = uow.SystemParamRepo.GetByGroupKey("AD"); var pass = GlobalCommon.DecryptString(listParam[ADManager.AD_ADMIN_PASS] ?? ""); ADManager manager = new ADManager(listParam[ADManager.AD_DOMAIN], listParam[ADManager.AD_ADMIN_USER], pass); if (manager.IsAuthenticated()) { string message = manager.Delete(username); if (string.IsNullOrEmpty(message)) { bool result = dnnUser.DeleteUser(username); if (result) { return(Request.CreateResponse(HttpStatusCode.OK, new { success = true })); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest, new { message = "Error delete user DNN" })); } } return(Request.CreateResponse(HttpStatusCode.BadRequest, new { message = message })); } return(Request.CreateResponse(HttpStatusCode.BadRequest, new { success = false })); }
private void BtnSearchAD_Click(object sender, EventArgs e) { string ldapADPath = txtBoxCustomLdapPath.Text; ADManager adMgr; if (DefaultLdapPatchChBox.Checked) { adMgr = new ADManager(); } else { adMgr = new ADManager($"LDAP://{ldapADPath}"); } try { textHosts.Text = adMgr.GetADHosts().ToString(); } catch (Exception err) { lblLines.Text = err.Message; } finally { adMgr.Dispose(); } }
/// <summary> /// 获取组对象的成员。 /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> /// <returns></returns> public List <DirectoryEntry> GetMembers(string userName, string password) { List <DirectoryEntry> entries = new List <DirectoryEntry>(); DirectoryEntry de = null; try { foreach (string member in this.members) { de = ADManager.GetByDN(member, userName, password); if (de != null) { entries.Add(de); } } return(entries); } catch (DirectoryServicesCOMException dsce) { foreach (DirectoryEntry d in entries) { if (d != null) { d.Close(); d.Dispose(); } } throw dsce; } }
/// <summary> /// 删除组。 /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Remove(string userName, string password) { DirectoryEntry de = null; try { de = ADManager.GetByGuid(this.guid, userName, password); de.DeleteTree(); de.CommitChanges(); } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (de != null) { de.Close(); de.Dispose(); } } }
/// <summary> /// 更新组。 /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Update(string userName, string password) { DirectoryEntry de = null; try { de = ADManager.GetByGuid(this.Guid, userName, password); Utils.SetProperty(de, Group.PROPERTY_ACCOUNT, this.accountName); // 会更改组名 Utils.SetProperty(de, Group.PROPERTY_INFO, this.info); Utils.SetProperty(de, Group.PROPERTY_DESCRIPTION, this.description); de.CommitChanges(); } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (de != null) { de.Close(); de.Dispose(); } } }
/// <summary> /// 添加组织单位。 /// </summary> /// <param name="locationPath">组织单位被添加的位置,ADsPath。DN形式。完全转义。</param> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Add(string locationPath, string userName, string password) { if (locationPath.IndexOf(ParaMgr.LDAP_IDENTITY) >= 0) { locationPath = locationPath.Substring(7); } DirectoryEntry parent = null; DirectoryEntry newOU = null; // 默认位置,在域容器下 if (String.IsNullOrEmpty(locationPath)) { locationPath = ParaMgr.ADFullPath; } if (!ADManager.Exists(locationPath)) { throw new EntryNotExistException("指定的位置对象不存在。"); } string rdn = Utils.GenerateRDNOU(this.name); // 使用name做OU // 这里的问题是要求DN形式的的Path if (ADManager.Exists(Utils.GenerateDN(rdn, locationPath))) { throw new EntryNotExistException("指定的位置下存在同名对象。"); } try { parent = ADManager.GetByPath(locationPath, userName, password); newOU = parent.Children.Add(rdn, "organizationalUnit"); Utils.SetProperty(newOU, OU.PROPERTY_DESCRIPTION, this.description); Utils.SetProperty(newOU, OU.PROPERTY_MANAGEDBY, this.managedBy); // 注意,不能是转义/的DN newOU.CommitChanges(); // reload this.Parse(newOU); } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (parent != null) { parent.Close(); parent.Dispose(); } if (newOU != null) { newOU.Close(); newOU.Dispose(); } } }
// Update is called once per frame void Update() { if (Instance == null) { Instance = this; } }
public static ADManager GetInstance() { if (instance == null) { instance = new ADManager(); } return(instance); }
public void MoveOUTest() { var fpath = "LDAP://10.45.9.11/ou=110_Marketing,ou=pphbh.com,dc=ops,dc=net"; var toPath = "LDAP://10.45.9.11/ou=110_Marketing,ou=离职员工,dc=ops,dc=net"; //var f=ADManager.Exists("LDAP://HZBESTDC3.pphbh.net/ou=110_Marketing,ou=pphbh.com,dc=pphbh,dc=net"); ADManager.MoveOU(fpath, toPath, true, config.AdminAccount, config.AdminPwd); }
// Use this for initialization void Start() { currCol = this.GetComponent <TextMesh> ().color; originPos = this.transform.localPosition; if (moveAd) { ads = GameObject.Find("Spawn").GetComponent <ADManager> (); } }
public FrmMain() { CLog4net.LogInfo("System starting!"); InitializeComponent(); this.systemController = new SystemController(); FrmLoading frmLoading = new FrmLoading(this.systemController); frmLoading.ShowDialog(); if (frmLoading.DialogResult == DialogResult.OK) { frmLoading.Hide(); frmLoading.Close(); } this.boxsManager = BoxsManager.GetInstance(); this.packageManager = PackageManager.GetInstance(); this.voiceService = ServicesFactory.GetInstance().GetVoicService(); this.serverService = ServicesFactory.GetInstance().GetServerService(); this.cameraService = ServicesFactory.GetInstance().GetCameraService(); this.about = AboutConfig.GetInstance().GetAbout(); this.infoCenterLister = InfoCenterLister.GetInsatnce(); this.adManager = ADManager.GetInstance(); this.AddUCScene(Roster.Home, new Home(this, 0)); this.AddUCScene(Roster.P_ControlPanel, new PostmanControlPanel(this, 5)); this.AddUCScene(Roster.P_D_Verify, new PostmanVerify(this, 60)); this.AddUCScene(Roster.P_D_ChooseBox, new PostmanChooseBox(this, 60)); this.AddUCScene(Roster.P_D_DeliverPG, new PostmanDeliverPG(this, 120)); this.AddUCScene(Roster.P_D_EntryPGInfo, new PostmanEntryPGInfo(this, 60)); this.AddUCScene(Roster.P_D_PGVerify, new PostmanPGVerify(this, 60)); this.AddUCScene(Roster.P_D_FinishWork, new PostmanFinishWork(this, 10)); this.AddUCScene(Roster.P_D_Cancel, new PostmanCancelTask(this, 60)); this.AddUCScene(Roster.P_D_CancelTask, new PostmanCancelTask(this, 60)); this.AddUCScene(Roster.P_T_EntryPGInfo, new PostmanTBEntryPGInfo(this, 60)); this.AddUCScene(Roster.P_T_FinishWork, new PostmanTBFinishWork(this, 60)); this.AddUCScene(Roster.P_S_PGDelivered, new PostmanSPGDelivered(this, 60)); this.AddUCScene(Roster.P_R_PGRegister, new PostmanRegister(this, 180)); this.AddUCScene(Roster.C_ControlPanel, new CustomerControlPanel(this, 5)); this.AddUCScene(Roster.C_T_Verify, new CustomerTBVerify(this, 60)); this.AddUCScene(Roster.C_T_FinishWork, new CustomerTBFinishWork(this, 60)); this.AddUCScene(Roster.C_S_EntryPGInfo, new CustomerSEntryPGInfo(this, 60)); this.AddUCScene(Roster.C_S_PGSearched, new CustomerPGSearched(this, 60)); this.AddUCScene(Roster.A_Verify, new AdminVerify(this, 60)); this.AddUCScene(Roster.A_P_EntryBoxCode, new AdminProxyEntryBoxCode(this, 60)); this.AddUCScene(Roster.A_P_FinishWork, new AdminProxyFinishWork(this, 60)); this.AddUCScene(Roster.A_ControlPanel, new AdministratorControlPanel(this, 360)); this.SceneTransit(Roster.Home); this.timerSceneInfo.Enabled = true; this.timerMain.Enabled = true; CLog4net.LogInfo("启动完成"); }
public BaseAdAdapter(ADManager mng) { mng.Adapter = this; Init(); InitBannerCallBack(); InitInterstitialCallBack(); InitRewardedCallBack(); }
private void Awake() { if (instance == null) { instance = this; } InitializeMonetization(); }
/// <summary> /// 移动OU到指定位置。 /// </summary> /// <param name="newLocationPath">移动到的位置的ADsPath。必须是DN形式,且完全转义。</param> /// <param name="mustOU">移动到的位置对应的DirectoryEntry是否必须是组织单位。</param> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Move(string newLocationPath, bool mustOU, string userName, string password) { DirectoryEntry de = ADManager.GetByDN(this.Dn, userName, password); // 必须DN -- 见ADManager.MoveOU方法 ADManager.MoveOU(de, newLocationPath, mustOU, userName, password); this.Parse(de); de.Close(); de.Dispose(); }
public void ToShow(bool direct = false) { if (direct) { ADManager.ShowInterstitialAD(this.percent); } else { adShowed = false; } }
///<summary> ///移动DirectoryEntry到指定位置。 ///</summary> ///<param name="newLocationPath">移动到的位置的ADsPath</param> ///<param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> ///<param name="password">用户身份标识--密码。</param> public virtual void Move(string newLocationPath, string userName, string password) { DirectoryEntry de = ADManager.GetByDN(this.dn, userName, password); // 必须用DN -- 见ADManager.Move方法说明 ADManager.Move(de, newLocationPath, userName, password); this.Parse(de); de.Close(); de.Dispose(); }
/// <summary> /// 移动User到指定位置。 /// </summary> /// <param name="newLocationPath">移动到的位置的ADsPath</param> /// <param name="mustOU">移动到的位置对应的DirectoryEntry是否必须是组织单位。</param> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> public void Move(string newLocationPath, bool mustOU, string userName, string password) { DirectoryEntry de = ADManager.GetByGuid(this.guid, userName, password); ADManager.MoveUser(de, newLocationPath, mustOU, userName, password); this.Parse(de); de.Close(); de.Dispose(); }
public void UpdateComputerDescription() { bool descUpdated = ADManager.UpdateComputerDescription(Computer.Name, _view.DescriptionBox.Text); if (descUpdated) { _view.DisplayMessage("AD Description has been updated for " + Computer.Name, ""); } _view.DescriptionLabel.Text = ADInfo.GetComputerDescription(Computer.Name); HideDescriptionBox(); }
public void Update() { if (!adShowed) { adTimer += Time.deltaTime; if (adTimer > delay) { ADManager.ShowInterstitialAD(this.percent); adShowed = true; } } }
public override void Show() { base.Show(); gameObject.SetActive(true); playCount++; if (InGameManager.gameTime - lastPlayerTime > 30 && playCount > 3 && ADManager.GetInstance().isAdLoaded) { playCount = 0; lastPlayerTime = InGameManager.gameTime; ADManager.GetInstance().PlayGameOverAD(); } }
/// <summary> /// 获取组织单位的父组织单位, /// </summary> /// <param name="userName">用户身份标识--用户名。为空时使用默认用户身份标识。</param> /// <param name="password">用户身份标识--密码。</param> /// <returns></returns> public OU GetParent(string userName, string password) { DirectoryEntry de = null; try { de = ADManager.GetByGuid(this.Guid, userName, password); DirectoryEntry parentDe = null; try { parentDe = de.Parent; if (parent.SchemaClassName == SchemaClass.organizationalUnit.ToString("F")) { this.parent = new OU(parentDe); } else { this.parent = null; } } catch (DirectoryServicesCOMException dsce) { this.parent = null; throw dsce; } finally { if (parentDe != null) { parentDe.Close(); parentDe.Dispose(); } } } catch (DirectoryServicesCOMException dsce) { throw dsce; } finally { if (de != null) { de.Close(); de.Dispose(); } } return(this.parent); }
static void Main(string[] args) { // 180 doesnt have proper permissions // 181 doesnt have the directory // 182 is just great string path = "\\\\VMSRVGVS182\\c$\\ErrorLogger\\config.xml"; /*try { Stream inStream = File.Open(path, FileMode.Open); inStream.Close(); } catch (UnauthorizedAccessException authEx) { Console.WriteLine(String.Format("You do not have proper permissions: {0}", authEx.Message)); } catch (DirectoryNotFoundException dirEx) { Console.WriteLine(String.Format("Directory not found: {0}", dirEx.Message)); } catch { Console.WriteLine("Something went wrong, you just suck"); }*/ /*try { XmlDocument xml = new XmlDocument(); xml.Load(path); } catch (UnauthorizedAccessException authEx) { } catch (DirectoryNotFoundException dirEx) { }*/ //DictionaryEntry d = new DictionaryEntry(); //d.Key = "hi"; //d.Value = "everyone"; // Just checking to see if the new AD Tools plays nicely ADManager manager = new ADManager(LordDomains.LORD); ADUser user = manager.GetUserByAccountName("tyler_ewing"); Console.WriteLine(user.Email); Console.ReadLine(); }
private void usernameTextBoxTextChanged(object sender, EventArgs e) { // Each time a letter is typed it checks AD for the user and updates the Status message and button availability ADManager ad = new ADManager(LordDomains.LORD); // I only use a try if someone in case someone enters crazy characters *^#$^& try { adUser = usernameTextBox.Text != string.Empty ? ad.GetUserByAccountName(usernameTextBox.Text) : null; } catch (Exception exc) { Console.WriteLine(exc.Message); } bool userExists = adUser != null; addUserButton.Enabled = userExists; statusMessage.Text = userExists ? adUser.AccountName.Replace('_', ' ') + " is a valid user" : usernameTextBox.Text == string.Empty ? string.Empty : "That username does not exist in AD"; }