protected override string CheckRequestNameAvailability(string name, ADObjectId identifyingObjectId, bool objectIsMailbox, MRSRequestType requestType, object errorObject, bool wildcardedSearch) { string text = string.Format("{0}*", name); RequestIndexEntryQueryFilter requestIndexEntryQueryFilter = new RequestIndexEntryQueryFilter(wildcardedSearch ? text : name, identifyingObjectId, requestType, new RequestIndexId(RequestIndexLocation.AD), objectIsMailbox); requestIndexEntryQueryFilter.WildcardedNameSearch = wildcardedSearch; ObjectId rootId = ADHandler.GetRootId(base.CurrentOrgConfigSession, requestType); IEnumerable <FolderMoveRequest> enumerable = ((RequestJobProvider)base.DataSession).IndexProvider.FindPaged <FolderMoveRequest>(requestIndexEntryQueryFilter, rootId, rootId == null, null, 10); string result; using (IEnumerator <FolderMoveRequest> enumerator = enumerable.GetEnumerator()) { if (enumerator.MoveNext()) { bool flag = true; while (this.IsNewRequestAllowed(enumerator.Current)) { if (!enumerator.MoveNext()) { IL_93: if (!flag) { base.WriteError(new NameMustBeUniquePermanentException(name, (identifyingObjectId == null) ? string.Empty : identifyingObjectId.ToString()), ErrorCategory.InvalidArgument, errorObject); return(null); } return(name); } } flag = false; goto IL_93; } result = name; } return(result); }
public void RemoveUser() { UserInfoModel user = new UserInfoModel() { DomainEmailAddress = "*****@*****.**" }; //Act ADHandler AD = new ADHandler(); var result = AD.RemoveUser(user); //Assert Assert.True(result.responseType == CodeSample.Responses.ADResponseType.OK); }
protected bool CheckRequestOfTypeExists(MRSRequestType requestType) { RequestIndexEntryQueryFilter filter = new RequestIndexEntryQueryFilter(null, null, requestType, this.DefaultRequestIndexId, false); ObjectId rootId = ADHandler.GetRootId(this.CurrentOrgConfigSession, requestType); IEnumerable <TRequest> enumerable = ((RequestJobProvider)base.DataSession).IndexProvider.FindPaged <TRequest>(filter, rootId, rootId == null, null, 10); foreach (TRequest trequest in enumerable) { if (trequest.Type == requestType) { return(true); } } return(false); }
public void ChangeAttribute() { string newMobileNo = "92899901880"; UserInfoModel user = new UserInfoModel() { Username = "******", DomainEmailAddress = "*****@*****.**" }; //Act ADHandler AD = new ADHandler(); var result = AD.ChangeUserAttribute(user, ADHandler.OUPath.Students, UserAttributes.mobile, newMobileNo); //Assert Assert.True(result.responseType == CodeSample.Responses.ADResponseType.OK); }
public void CreateUser() { UserInfoModel user = new UserInfoModel() { ID = Guid.NewGuid(), FirstName = "John", LastName = "Doe", MiddleName = "Henry", Username = "******", Password = "******", DomainEmailAddress = "*****@*****.**" }; //Act ADHandler AD = new ADHandler(); var result = AD.CreateUser(user, ADHandler.OUPath.Students); Guid output = Guid.Empty; //Assert Assert.True(result.responseType == CodeSample.Responses.ADResponseType.OK); }
private IRequestIndexEntry GetEntry() { LocalizedString?notFoundError = new LocalizedString?(Strings.ErrorNotEnoughInformationToFindRequest); LocalizedString?multipleFoundError = new LocalizedString?(Strings.ErrorNotEnoughInformationToFindUniqueRequest); TIdentity identity = this.Identity; if (identity.IndexToUse == null) { base.WriteError(new UnknownRequestIndexPermanentException(null), ErrorCategory.InvalidArgument, this.Identity); return(null); } TIdentity identity2 = this.Identity; if (identity2.IndexToUse.RequestIndexEntryType == null) { return(null); } TIdentity identity3 = this.Identity; if (identity3.IndexToUse.RequestIndexEntryType == typeof(MRSRequestWrapper)) { IIdentityParameter id = this.Identity; IConfigDataProvider indexProvider = this.rjProvider.IndexProvider; IConfigurationSession configurationSession = this.currentOrgConfigSession; TIdentity identity4 = this.Identity; return((IRequestIndexEntry)base.GetDataObject <MRSRequestWrapper>(id, indexProvider, ADHandler.GetRootId(configurationSession, identity4.RequestType), notFoundError, multipleFoundError)); } TIdentity identity5 = this.Identity; if (identity5.IndexToUse.RequestIndexEntryType == typeof(MRSRequestMailboxEntry)) { IIdentityParameter id2 = this.Identity; IConfigDataProvider indexProvider2 = this.rjProvider.IndexProvider; IConfigurationSession configurationSession2 = this.currentOrgConfigSession; TIdentity identity6 = this.Identity; return((IRequestIndexEntry)base.GetDataObject <MRSRequestMailboxEntry>(id2, indexProvider2, ADHandler.GetRootId(configurationSession2, identity6.RequestType), notFoundError, multipleFoundError)); } TIdentity identity7 = this.Identity; base.WriteError(new UnknownRequestIndexPermanentException(identity7.IndexToUse.ToString()), ErrorCategory.InvalidArgument, this.Identity); return(null); }
protected virtual string CheckRequestNameAvailability(string name, ADObjectId identifyingObjectId, bool objectIsMailbox, MRSRequestType requestType, object errorObject, bool wildcardedSearch) { string text = string.Format("{0}*", name); RequestIndexEntryQueryFilter requestIndexEntryQueryFilter = new RequestIndexEntryQueryFilter(wildcardedSearch ? text : name, identifyingObjectId, requestType, this.DefaultRequestIndexId, objectIsMailbox); requestIndexEntryQueryFilter.WildcardedNameSearch = wildcardedSearch; ObjectId rootId = ADHandler.GetRootId(this.CurrentOrgConfigSession, requestType); IEnumerable <TRequest> enumerable = ((RequestJobProvider)base.DataSession).IndexProvider.FindPaged <TRequest>(requestIndexEntryQueryFilter, rootId, rootId == null, null, 10); string result; using (IEnumerator <TRequest> enumerator = enumerable.GetEnumerator()) { if (!enumerator.MoveNext()) { result = name; } else if (!wildcardedSearch) { if (requestType.Equals(MRSRequestType.PublicFolderMigration) || requestType.Equals(MRSRequestType.PublicFolderMove)) { base.WriteError(new MultipleSamePublicFolderMRSJobInstancesNotAllowedException(requestType.ToString()), ErrorCategory.InvalidArgument, errorObject); } else { base.WriteError(new NameMustBeUniquePermanentException(name, (identifyingObjectId == null) ? string.Empty : identifyingObjectId.ToString()), ErrorCategory.InvalidArgument, errorObject); } result = null; } else { Regex regex = new Regex(string.Format("^{0}(\\d)?$", name)); List <uint> list = new List <uint>(10); for (uint num = 0U; num < 10U; num += 1U) { list.Add(num); } do { TRequest trequest = enumerator.Current; Match match = regex.Match(trequest.Name); if (match.Success) { string value = match.Groups[1].Value; uint num2; if (string.IsNullOrEmpty(value)) { list.Remove(0U); } else if (uint.TryParse(value, out num2) && list.Contains(num2) && num2 != 0U) { list.Remove(num2); } } }while (enumerator.MoveNext() && list.Count > 0); if (list.Count == 0) { base.WriteError(new NoAvailableDefaultNamePermanentException(identifyingObjectId.ToString()), ErrorCategory.InvalidArgument, errorObject); result = null; } else if (list.Contains(0U)) { result = name; } else { result = string.Format("{0}{1}", name, list[0]); } } } return(result); }