protected override IConfigDataProvider CreateSession() { OrganizationId organizationId = this.ResolveCurrentOrganization(); ADUser tenantArbitrationMailbox; try { tenantArbitrationMailbox = AdminAuditLogHelper.GetTenantArbitrationMailbox(organizationId); } catch (ObjectNotFoundException innerException) { TaskLogger.Trace("ObjectNotFoundException occurred when getting Exchange principal from the arbitration mailbox.", new object[0]); throw new AuditLogSearchArbitrationMailboxNotFoundException(organizationId.ToString(), innerException); } catch (NonUniqueRecipientException innerException2) { TaskLogger.Trace("More than one tenant arbitration mailbox found for the current organization.", new object[0]); throw new AuditLogSearchNonUniqueArbitrationMailboxFoundException(organizationId.ToString(), innerException2); } ExchangePrincipal principal = ExchangePrincipal.FromADUser(ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(organizationId), tenantArbitrationMailbox, RemotingOptions.AllowCrossSite); ADSessionSettings sessionSettings = base.CurrentOrganizationId.ToADSessionSettings(); this.recipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.FullyConsistent, sessionSettings, 310, "CreateSession", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\AuditLogSearch\\NewAuditLogSearch.cs"); return(this.InternalCreateSearchDataProvider(principal, organizationId)); }
private static void WriteNoAdminAuditLogWarningAsNeed(IConfigurationSession configSession) { bool flag = true; OrganizationId currentOrganizationId = configSession.SessionSettings.CurrentOrganizationId; if (currentOrganizationId.ConfigurationUnit != null) { ExchangeConfigurationUnit exchangeConfigurationUnit = configSession.Read <ExchangeConfigurationUnit>(currentOrganizationId.ConfigurationUnit); if (exchangeConfigurationUnit == null) { AdminAuditLogHelper.Tracer.TraceDebug <OrganizationId>(0L, "AdminAuditLogHelper: ExchangeConfigurationUnit for org {0} is null", currentOrganizationId); } else { AdminAuditLogHelper.Tracer.TraceDebug <OrganizationId, OrganizationStatus>(0L, "AdminAuditLogHelper: org {0}'s status is {1}", currentOrganizationId, exchangeConfigurationUnit.OrganizationStatus); if (exchangeConfigurationUnit.OrganizationStatus == OrganizationStatus.PendingCompletion) { flag = false; } } } else { AdminAuditLogHelper.Tracer.TraceDebug <OrganizationId>(0L, "AdminAuditLogHelper: ConfigurationUnit for org {0} is null", currentOrganizationId); } if (flag) { ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_NoAdminAuditLogConfig, new string[] { currentOrganizationId.ToString() }); } }
internal static Dictionary <string, HashSet <string> > GetAllClassificationIdentifiers(OrganizationId organizationId, IConfigurationSession openedDataSession = null, Func <TransportRule, bool> inclusiveFilter = null, QueryFilter additionalFilter = null, IClassificationDefinitionsDataReader dataReader = null, IClassificationDefinitionsDiagnosticsReporter classificationDefinitionsDiagnosticsReporter = null) { IClassificationDefinitionsDiagnosticsReporter classificationDefinitionsDiagnosticsReporter2 = classificationDefinitionsDiagnosticsReporter ?? ClassificationDefinitionsDiagnosticsReporter.Instance; Dictionary <string, HashSet <string> > dictionary = new Dictionary <string, HashSet <string> >(ClassificationDefinitionConstants.RuleCollectionIdComparer); foreach (Tuple <TransportRule, XDocument> tuple in DlpUtils.AggregateOobAndCustomClassificationDefinitions(organizationId, openedDataSession, inclusiveFilter, additionalFilter, dataReader, classificationDefinitionsDiagnosticsReporter2)) { TransportRule item = tuple.Item1; XDocument item2 = tuple.Item2; ExAssert.RetailAssert(item2 != null, "XDocument instance returned from AggregateOobAndCustomClassificationDefinitions should never be null!"); string rulePackId; HashSet <string> value; try { rulePackId = XmlProcessingUtils.GetRulePackId(item2); value = new HashSet <string>(XmlProcessingUtils.GetAllRuleIds(item2), ClassificationDefinitionConstants.RuleIdComparer); } catch (XmlException ex) { ClassificationDefinitionsDiagnosticsReporter.Instance.WriteCorruptRulePackageDiagnosticsInformation(0, organizationId, item.DistinguishedName, new AggregateException(new Exception[] { ex }).Flatten()); continue; } ExAssert.RetailAssert(!dictionary.ContainsKey(rulePackId), "Duplicate classification rule collection ID '{0}' under tenant's organization '{1}' is a should never ever happen case", new object[] { rulePackId, organizationId.ToString() }); dictionary.Add(rulePackId, value); } return(dictionary); }
public ActionResult RemoveCartItem(RequestParamsToCart param) { ModelState.Clear(); var organizationId = param.OrganizationId; if (string.IsNullOrEmpty(organizationId)) { organizationId = OrganizationId.ToString(); } var userWishCart = _cartService.LoadSharedCardByCustomerId(new Guid(organizationId)); if (userWishCart.GetAllLineItems().Count() == 1) { _orderRepository.Delete(userWishCart.OrderLink); } else { _cartService.ChangeQuantity(userWishCart, -1, param.Code, 0); _orderRepository.Save(userWishCart); } var productName = ""; var entryLink = _referenceConverter.GetContentLink(param.Code); productName = _contentLoader.Get <EntryContentBase>(entryLink).DisplayName; return(Json(new ChangeCartJsonResult { StatusCode = 1, CountItems = (int)SharedCart.Cart.GetAllLineItems().Sum(x => x.Quantity), Message = productName + " is removed from the shared cart successfully." })); }
public void WriteDuplicateRuleIdAcrossRulePacksDiagnosticsInformation(int traceSourceHashCode, OrganizationId currentOrganizationId, string offendingRulePackageObjectDn1, string offendingRulePackageObjectDn2, string duplicateRuleId) { string organizationId = currentOrganizationId.ToString(); Task.Factory.StartNew(delegate() { ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_DuplicateDataClassificationIdAcrossRulePack, new string[] { organizationId, duplicateRuleId, offendingRulePackageObjectDn1, offendingRulePackageObjectDn2 }); }); string eventMessage = string.Format("A duplicate data classification identifier '{1}' has been identified in objects with DN '{2}' and '{3}' under organization '{0}'.", new object[] { organizationId, duplicateRuleId, offendingRulePackageObjectDn1, offendingRulePackageObjectDn2 }); Task.Factory.StartNew(delegate() { EventNotificationItem.Publish(ClassificationDefinitionsDiagnosticsReporter.ServiceName, "ClassificationManagement", "NonUniqueDataClassificationIdentifierFound", eventMessage, ResultSeverityLevel.Warning, false); }); this.dlpTracer.TraceError((long)traceSourceHashCode, eventMessage); }
public async Task EditPostInsertsCampaign() { const int OrganizationId = 99; const int NewCampaignId = 100; var mockMediator = new Mock <IMediator>(); mockMediator.Setup(x => x.SendAsync(It.IsAny <EditCampaignCommandAsync>())) .Returns((EditCampaignCommandAsync q) => Task.FromResult <int>(NewCampaignId)); var mockImageService = new Mock <IImageService>(); var controller = new CampaignController(mockMediator.Object, mockImageService.Object); controller.MakeUserAnOrgAdmin(OrganizationId.ToString()); var model = MassiveTrafficLightOutage_model; model.OrganizationId = OrganizationId; // verify the model is valid var validationContext = new ValidationContext(model, null, null); var validationResults = new List <ValidationResult>(); Validator.TryValidateObject(model, validationContext, validationResults); Assert.Equal(0, validationResults.Count()); var file = FormFile("image/jpeg"); var view = (RedirectToActionResult)await controller.Edit(model, file); // verify the edit(add) is called mockMediator.Verify(mock => mock.SendAsync(It.Is <EditCampaignCommandAsync>(c => c.Campaign.OrganizationId == OrganizationId))); // verify that the next route Assert.Equal(view.RouteValues["area"], "Admin"); Assert.Equal(view.RouteValues["id"], NewCampaignId); }
// Token: 0x06000592 RID: 1426 RVA: 0x00021394 File Offset: 0x0001F594 private static ActiveSyncDeviceClasses GetActiveSyncDeviceClassContainer(IConfigurationSession scopedSession, OrganizationId orgId) { ActiveSyncDeviceClasses[] deviceClasses = null; ADNotificationAdapter.RunADOperation(delegate() { deviceClasses = scopedSession.Find <ActiveSyncDeviceClasses>(orgId.ConfigurationUnit, QueryScope.SubTree, DeviceClassCache.deviceClassesFilter, DeviceClassCache.deviceClassesSortOrder, 0); }); DeviceClassCache.UpdateProtocolLogLastUsedDC(scopedSession); if (deviceClasses == null) { AirSyncDiagnostics.TraceDebug <OrganizationId>(ExTraceGlobals.RequestsTracer, null, "Oragnization \"{0}\" has no DeviceClass container in AD.", orgId); AirSyncDiagnostics.LogEvent(AirSyncEventLogConstants.Tuple_NoDeviceClassContainer, new string[] { orgId.ToString() }); return(null); } AirSyncDiagnostics.TraceDebug <OrganizationId, int>(ExTraceGlobals.RequestsTracer, null, "Oragnization '{0}' has '{1}' DeviceClass container in AD.", orgId, deviceClasses.Length); if (deviceClasses.Length == 1) { return(deviceClasses[0]); } if (Command.CurrentCommand != null) { Command.CurrentCommand.Context.ProtocolLogger.SetValue(ProtocolLoggerData.Error, "TooManyDeviceClassContainers"); } return(DeviceClassCache.CleanMangledObjects(scopedSession, deviceClasses, "ExchangeDeviceClasses") as ActiveSyncDeviceClasses); }
public static AdminAuditLogConfig GetAdminAuditLogConfig(IConfigurationSession configSession) { OrganizationId currentOrganizationId = configSession.SessionSettings.CurrentOrganizationId; AdminAuditLogHelper.Tracer.TraceDebug <OrganizationId>(0L, "AdminAuditLogHelper: Will retrieve config objects from AD for OrganizationId: {0}", currentOrganizationId); SharedConfiguration sharedConfiguration = SharedConfiguration.GetSharedConfiguration(currentOrganizationId); IConfigurationSession configurationSession = configSession; if (sharedConfiguration != null) { configurationSession = DirectorySessionFactory.Default.GetTenantOrTopologyConfigurationSession(configSession.ConsistencyMode, sharedConfiguration.GetSharedConfigurationSessionSettings(), 160, "GetAdminAuditLogConfig", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\AdminAuditLog\\AdminAuditLogHelper.cs"); } configurationSession.SessionSettings.IsSharedConfigChecked = true; bool includeCNFObject = configurationSession.SessionSettings.IncludeCNFObject; AdminAuditLogConfig[] array; try { configurationSession.SessionSettings.IncludeCNFObject = false; array = configurationSession.Find <AdminAuditLogConfig>(null, QueryScope.SubTree, null, null, 2); } finally { configurationSession.SessionSettings.IncludeCNFObject = includeCNFObject; } if (array.Length == 0) { AdminAuditLogHelper.Tracer.TraceDebug <OrganizationId>(0L, "AdminAuditLogHelper: No AdminAuditLogConfig was found in org {0}.", currentOrganizationId); AdminAuditLogHelper.WriteNoAdminAuditLogWarningAsNeed(configSession); return(null); } if (array.Length > 1) { AdminAuditLogHelper.Tracer.TraceDebug <OrganizationId>(0L, "AdminAuditLogHelper: More than one AdminAuditLogConfig was found in org {0}.", currentOrganizationId); ExManagementApplicationLogger.LogEvent(currentOrganizationId, ManagementEventLogConstants.Tuple_MultipleAdminAuditLogConfig, new string[] { currentOrganizationId.ToString() }); throw new MultipleAdminAuditLogConfigException(currentOrganizationId.ToString()); } AdminAuditLogHelper.Tracer.TraceDebug <OrganizationId, bool>(0L, "AdminAuditLogHelper: One AdminAuditLogConfig was found in org {0}. Logging enabled is {1}.", currentOrganizationId, array[0].AdminAuditLogEnabled); return(array[0]); }
public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here userIdentity.AddClaim(new Claim("OrganizationId", OrganizationId.ToString())); return(userIdentity); }
// Token: 0x060007CE RID: 1998 RVA: 0x00019974 File Offset: 0x00017B74 internal static ADSessionSettings CreateScopedSessionSettings(string domainName, OrganizationId orgId) { ADSessionSettings result; if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled) { try { if (orgId != null) { result = ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(orgId); } else { if (domainName == null) { throw new ArgumentNullException("domainName"); } result = ADSessionSettings.FromTenantAcceptedDomain(domainName); } return(result); } catch (CannotResolveTenantNameException) { string arg = (domainName != null) ? domainName.ToString() : "<null>"; string arg2 = (orgId != null) ? orgId.ToString() : "<null>"; string message = string.Format("Could not resolve recipient session for domain:'{0}', organization id:'{1}'", arg, arg2); ExTraceGlobals.UserContextTracer.TraceError(0L, message); throw new OwaADObjectNotFoundException(message); } catch (DataSourceOperationException innerException) { string arg3 = (domainName != null) ? domainName.ToString() : "<null>"; string arg4 = (orgId != null) ? orgId.ToString() : "<null>"; string message2 = string.Format("DataSourceException for domain:'{0}', organization id:'{1}'", arg3, arg4); ExTraceGlobals.UserContextTracer.TraceError(0L, message2); throw new OwaADObjectNotFoundException(message2, innerException); } } result = ADSessionSettings.FromRootOrgScopeSet(); return(result); }
public bool OrganizationEditing_CRUD() { //Load Data vào form XpoOrganization.CriteriaParameters["OrganizationId"].DefaultValue = OrganizationId.ToString(); // load data vào cây thư mục XpoDepartment.CriteriaParameters["OrganizationId"].DefaultValue = OrganizationId.ToString(); ASPxTreeList_Department2.DataBind(); loadListUsers(ASPxTreeList_Department2.FocusedNode); //DepartmentBO bo = new DepartmentBO(); //LoginPersonLST = bo.getAllPeopleInOrganization(session, OrganizationId); return(true); }
// Token: 0x06001672 RID: 5746 RVA: 0x0007EBB8 File Offset: 0x0007CDB8 internal static string GetUniqueLookupKey(OrganizationId organizationId, ADRecipient recipient) { if (organizationId == null) { throw new ArgumentNullException("organizationId"); } if (recipient == null) { throw new ArgumentNullException("recipient"); } return(string.Format("{0}:{1}", organizationId.ToString(), recipient.LegacyExchangeDN)); }
internal static bool ShouldBlockConnection(OrganizationId organizationId, string username, ClientAccessProtocol protocol, IPEndPoint remoteEndpoint, ClientAccessAuthenticationMethod authenticationType, IReadOnlyPropertyBag propertyBag, Action <ClientAccessRulesEvaluationContext> blockLoggerDelegate, Action <double> latencyLoggerDelegate) { DateTime utcNow = DateTime.UtcNow; bool shouldBlock = false; long ticks = utcNow.Ticks; if (organizationId == null) { ExTraceGlobals.ClientAccessRulesTracer.TraceDebug(ticks, "[Client Access Rules] ShouldBlockConnection assuming OrganizationId.ForestWideOrgId for null OrganizationId"); organizationId = OrganizationId.ForestWideOrgId; } if (remoteEndpoint != null) { ExTraceGlobals.ClientAccessRulesTracer.TraceDebug(ticks, "[Client Access Rules] ShouldBlockConnection - Initializing context to run rules"); ClientAccessRuleCollection collection = ClientAccessRulesCache.Instance.GetCollection(organizationId); ClientAccessRulesEvaluationContext context = new ClientAccessRulesEvaluationContext(collection, username, remoteEndpoint, protocol, authenticationType, propertyBag, ObjectSchema.GetInstance <ClientAccessRulesRecipientFilterSchema>(), delegate(ClientAccessRulesEvaluationContext evaluationContext) { shouldBlock = true; blockLoggerDelegate(evaluationContext); }, null, ticks); collection.Run(context); } ClientAccessRulesPerformanceCounters.TotalClientAccessRulesEvaluationCalls.Increment(); if (shouldBlock) { ClientAccessRulesPerformanceCounters.TotalConnectionsBlockedByClientAccessRules.Increment(); } double totalMilliseconds = (DateTime.UtcNow - utcNow).TotalMilliseconds; latencyLoggerDelegate(totalMilliseconds); if (totalMilliseconds > 50.0) { ClientAccessRulesPerformanceCounters.TotalClientAccessRulesEvaluationCallsOver50ms.Increment(); } if (totalMilliseconds > 10.0) { ClientAccessRulesPerformanceCounters.TotalClientAccessRulesEvaluationCallsOver10ms.Increment(); } ExTraceGlobals.ClientAccessRulesTracer.TraceDebug(ticks, string.Format("[Client Access Rules] ShouldBlockConnection - Evaluate - Org: {0} - Protocol: {1} - Username: {2} - IP: {3} - Port: {4} - Auth Type: {5} - Blocked: {6} - Latency: {7}", new object[] { organizationId.ToString(), protocol.ToString(), username.ToString(), remoteEndpoint.Address.ToString(), remoteEndpoint.Port.ToString(), authenticationType.ToString(), shouldBlock.ToString(), totalMilliseconds.ToString() })); return(shouldBlock); }
private void ExtractRbacDataFromRunspace(object sender, EventArgs e) { ADObjectId adobjectId = null; OrganizationId organizationId = null; ExchangePropertyContainer.InitializeExchangePropertyContainerIfNeeded(this.context.SessionState, out adobjectId, out organizationId); ExchangeRunspaceConfiguration exchangeRunspaceConfiguration = null; if (this.context.SessionState != null) { exchangeRunspaceConfiguration = ExchangePropertyContainer.GetExchangeRunspaceConfiguration(this.context.SessionState); } OrganizationId organizationId2; string executingUserIdentityName; SmtpAddress executingWindowsLiveId; if (exchangeRunspaceConfiguration == null) { if (this.context.SessionState != null) { organizationId = (organizationId ?? ExchangePropertyContainer.GetExecutingUserOrganizationId(this.context.SessionState)); adobjectId = (adobjectId ?? ExchangePropertyContainer.GetExecutingUserId(this.context.SessionState)); } organizationId2 = organizationId; executingUserIdentityName = ((adobjectId == null) ? string.Empty : adobjectId.Name); } else { exchangeRunspaceConfiguration.TryGetExecutingUserId(out adobjectId); executingUserIdentityName = exchangeRunspaceConfiguration.IdentityName; exchangeRunspaceConfiguration.TryGetExecutingWindowsLiveId(out executingWindowsLiveId); organizationId = (exchangeRunspaceConfiguration.PartnerMode ? OrganizationId.ForestWideOrgId : exchangeRunspaceConfiguration.OrganizationId); organizationId2 = exchangeRunspaceConfiguration.OrganizationId; SecurityIdentifier value; exchangeRunspaceConfiguration.TryGetExecutingUserSid(out value); CmdletLogger.SafeSetLogger(this.context.UniqueId, RpsCmdletMetadata.ExecutingUserSid, value); } if (this.context.InvocationInfo != null && this.context.InvocationInfo.IsVerboseOn && !TaskLogger.IsSetupLogging) { string executingUserId = (adobjectId != null) ? adobjectId.ToCanonicalName() : string.Empty; string executingUserOrganizationId = (organizationId != null) ? organizationId.ToString() : string.Empty; string currentOrganizationId = (organizationId2 != null) ? organizationId2.ToString() : string.Empty; if (this.context.CommandShell != null) { this.context.CommandShell.WriteVerbose(Strings.VerboseExecutingUserContext(executingUserId, executingUserOrganizationId, currentOrganizationId, (exchangeRunspaceConfiguration == null) ? Strings.DisabledString : Strings.EnabledString)); } } this.context.ExchangeRunspaceConfig = exchangeRunspaceConfiguration; this.context.UserInfo = new TaskUserInfo(organizationId, organizationId2, adobjectId, executingUserIdentityName, executingWindowsLiveId); }
private OrganizationSettingsData LoadAbq(OrganizationId organizationId) { ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, organizationId, organizationId, false); IConfigurationSession configurationSession = this.CreateConfigurationSession(sessionSettings); ActiveSyncOrganizationSettings[] array = configurationSession.Find <ActiveSyncOrganizationSettings>(configurationSession.GetOrgContainerId(), QueryScope.SubTree, null, null, 2); if (array == null || array.Length == 0) { base.WriteError(new NoActiveSyncOrganizationSettingsException(organizationId.ToString()), ErrorCategory.InvalidArgument, null); } OrganizationSettingsData organizationSettingsData = new OrganizationSettingsData(array[0], configurationSession); this.organizationSettings[organizationId] = organizationSettingsData; return(organizationSettingsData); }
private static void LogEvent(RmsClientManagerLog.RmsClientManagerFeature clientManagerFeature, RmsClientManagerLog.RmsClientManagerEvent clientManagerEvent, OrganizationId orgId, Guid transaction, string data, string context) { LogRowFormatter logRowFormatter = new LogRowFormatter(RmsClientManagerLog.rmsLogSchema); logRowFormatter[1] = clientManagerFeature; logRowFormatter[2] = clientManagerEvent; if (orgId != null) { logRowFormatter[3] = orgId.ToString(); } logRowFormatter[7] = transaction.ToString(); logRowFormatter[6] = context; logRowFormatter[5] = data; RmsClientManagerLog.Append(logRowFormatter); }
//public void Terminate () //{ // Terminate(EventSource.Unknown); //} public void Terminate(EventSource eventSource, Person actingPerson, string description) { // TODO: This needs a new overload for v5, which adds the Position and possibly removes the EventSource if (base.Active) { // REMOVED: everything Roles related; being phased out //PWLog.Write (actingPerson.Identity, PWLogItem.Person, Person.Identity, PWLogAction.MemberLost, // eventSource + ":" + description, string.Empty); PWEvents.CreateEvent(EventSource.PirateWeb, EventType.LostMember, actingPerson.Identity, OrganizationId, Person.GeographyId, Person.Identity, 0, OrganizationId.ToString()); //Added LogChurn here to make SURE they always are logged with the membership. if (PersonId > 0 && OrganizationId > 0 && base.Expires.IsDefined()) { ChurnData.LogChurn(PersonId, OrganizationId); } SwarmDb.GetDatabaseForWriting().TerminateParticipation(Identity); base.Active = false; base.DateTerminated = DateTime.Now; // Remove all newsletter subscriptions once the membership is terminated (to make sure default is now off and only turn off explicitly turned-on subscriptions) // HACK HACK HACK: uses feed IDs in an extremely ugly way to loop 1-9. Should use NewsletterFeeds.ForOrganization() once support for newsletters in different orgs are established. for (int newsletterFeedId = 1; newsletterFeedId < 10; newsletterFeedId++) { try { if (this._person.IsSubscribing(newsletterFeedId)) { this._person.SetSubscription(newsletterFeedId, false); } } catch (Exception) { // ignore nonexisting newsletter feeds -- this is a hack anyway } } } }
private void Debug(string message) { try { System.Collections.Specialized.NameValueCollection settings = System.Configuration.ConfigurationManager.AppSettings; string orgIdToDebug = settings["DebugOrgId"]; if (OrganizationId.ToString() == orgIdToDebug) { string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); string debugFile = System.IO.Path.Combine(path, "Debug.txt"); System.IO.File.AppendAllText(debugFile, string.Format("{0} (orgId {1}): {2}{3}", DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"), orgIdToDebug, message, Environment.NewLine)); } } catch (Exception ex) { ExceptionLogs.LogException(LoginUser.Anonymous, ex, "ScheduledReports-Debug", "Tickets.Clone - Actions"); } }
public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here userIdentity.AddClaim(new Claim("OrganizationId", OrganizationId.ToString())); if (Organization != null) { userIdentity.AddClaim(new Claim("OrganizationName", Organization.Name)); foreach (AuctionEvent AE in Organization.AuctionEvents) { if (AE.IsActive) { userIdentity.AddClaim(new Claim("EventId", AE.Id.ToString())); } } } return(userIdentity); }
public void WriteCorruptRulePackageDiagnosticsInformation(int traceSourceHashCode, OrganizationId currentOrganizationId, string offendingRulePackageObjectDn, Exception underlyingException) { string organizationId = currentOrganizationId.ToString(); string exceptionDetails = underlyingException.ToString(); Task.Factory.StartNew(delegate() { ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_CorruptClassificationRuleCollection, new string[] { organizationId, offendingRulePackageObjectDn, exceptionDetails }); }); string eventMessage = string.Format("A corrupted classification rule collection has been identified under organization: '{0}'. Source object DN: {1}. Error details: {2}", organizationId, offendingRulePackageObjectDn, exceptionDetails); Task.Factory.StartNew(delegate() { EventNotificationItem.Publish(ClassificationDefinitionsDiagnosticsReporter.ServiceName, "ClassificationManagement", "CorruptClassificationRuleCollection", eventMessage, ResultSeverityLevel.Warning, false); }); this.dlpTracer.TraceError((long)traceSourceHashCode, eventMessage); }
internal ClientAccessRulesLogEvent(OrganizationId orgId, string username, IPEndPoint endpoint, ClientAccessAuthenticationMethod authenticationType, string blockingRuleName, double latency, bool blocked) { ActivityContext.ActivityId.FormatForLog(); this.datapointProperties = new Dictionary <string, object> { { "ORGID", orgId.ToString() }, { "USER", username }, { "IP", endpoint.Address.ToString() }, { "PORT", endpoint.Port.ToString() }, { "AUTHTYPE", authenticationType.ToString() }, { "RULE", blockingRuleName }, { "LATENCY", latency.ToString() }, { "BLOCKED", blocked.ToString() } }; }
// Token: 0x06001A00 RID: 6656 RVA: 0x0005DE80 File Offset: 0x0005C080 protected RmsTemplateType[] GetRmsTemplates(OrganizationId organizationId, CultureInfo userCulture) { try { ExTraceGlobals.IrmTracer.TraceDebug <OrganizationId, CultureInfo>((long)this.GetHashCode(), "Getting rms templates for organization {0} with culture {1}", organizationId, userCulture); IEnumerable <RmsTemplate> source = this.AcquireRmsTemplates(organizationId); IEnumerable <RmsTemplateType> source2 = from mesrTemplate in source select new RmsTemplateType(mesrTemplate.Id.ToString(), mesrTemplate.GetName(userCulture), mesrTemplate.GetDescription(userCulture)) into template orderby template.Name select template; string arg = string.Join(",", from template in source2 select string.Format(userCulture, "{0}:{1}", new object[] { template.Id, template.Name })); ExTraceGlobals.IrmTracer.TraceDebug <string>((long)this.GetHashCode(), "Loaded templates= {0}", arg); return(source2.ToArray <RmsTemplateType>()); } catch (OwaThrottlingException) { throw; } catch (Exception ex) { OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_RmsTemplateLoadFailure, organizationId.ToString(), new object[] { ex }); OwaServerTraceLogger.AppendToLog(new RmsLoadingLogEvent(organizationId, ex)); } return(null); }
public async Task <Organization> GetInforOrganization() { RequestInfor requestInfor = new RequestInfor() { UrlBase = OrganizationId > 0 ? Configuarations.Url_GetInforOrganization + "/" + OrganizationId.ToString() : Configuarations.Url_GetInforOrganizationFromAcc + "/" + AccountId.ToString(), HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = AccessToken } }; var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); if (responseData.Code == 200) { return(Helpers.Deserialize <Organization>(responseData.Data)); } return(new Organization() { OrganizationId = -1 }); }
public ClientAccessRuleCollection GetCollection(OrganizationId orgId) { if (OrganizationId.ForestWideOrgId.Equals(orgId)) { return(this.GetValue(orgId).ClientAccessRuleCollection); } ClientAccessRuleCollection clientAccessRuleCollection = new ClientAccessRuleCollection(orgId.ToString()); clientAccessRuleCollection.AddClientAccessRuleCollection(this.GetValue(OrganizationId.ForestWideOrgId).ClientAccessRuleCollection); clientAccessRuleCollection.AddClientAccessRuleCollection(this.GetValue(orgId).ClientAccessRuleCollection); return(clientAccessRuleCollection); }
private void InitializeIntegrationLog() { _isIntegrationLog = true; _name = Integration.ToString() + " Debug File -"; _logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs", OrganizationId.ToString()); if (!Directory.Exists(_logPath)) { Directory.CreateDirectory(_logPath); } }
public async Task <ActionResult> LoadContent(int productCategoryId, int pageIndex) { RequestInfor requestInfor = new RequestInfor() { UrlBase = Configuarations.Url_Product_GetListByConditional + "/" + pageIndex.ToString() + "/" + productCategoryId.ToString() + "/" + OrganizationId.ToString(), HeaderValue = new HeaderValue() { AuthorizationType = "Bearer", AuthorizationValue = AccessToken }, }; GridModel <Product> listProduct = new GridModel <Product>(); if (productCategoryId > 0) { var responseData = await ConnectAPI.ConnectRestAPI(requestInfor, MethodType.GET); if (responseData.Code != 200) { ViewBag.ResultData = null; return(View("index")); } listProduct = Helpers.Deserialize <GridModel <Product> >(responseData.Data); } return(PartialView("_Content", listProduct)); }
private static void ValidateQueryString(string httpURL, ADRawEntry userEntry) { string text; string tenantOrganization = ExchangeRunspaceConfigurationSettings.FromUriConnectionString(httpURL, out text).TenantOrganization; string value = tenantOrganization; if (string.IsNullOrEmpty(tenantOrganization)) { return; } AuthZLogger.SafeSetLogger(ConfigurationCoreMetadata.ManagedOrganization, value); OrganizationId organizationId = userEntry[ADObjectSchema.OrganizationId] as OrganizationId; if (organizationId != null && !ExchangeRunspaceConfiguration.IsAllowedOrganizationForPartnerAccounts(organizationId)) { AuthZLogger.SafeAppendGenericError("ValidateQueryString", string.Format("Organization {0} not allowed for partner account.", organizationId.ToString()), false); ExTraceGlobals.AccessDeniedTracer.TraceError <ADObjectId>(0L, "EAP.ValidateQueryString returns AccessDenied because user {0} does not belong to the appropriate organization", userEntry.Id); throw new NotAllowedForPartnerAccessException(Strings.ErrorNotAllowedForPartnerAccess); } Uri uri; if (!Uri.TryCreate(httpURL, UriKind.Absolute, out uri)) { AuthZLogger.SafeAppendGenericError("ValidateQueryString", string.Format("Url {0} Incorrect.", httpURL), false); ExTraceGlobals.AccessDeniedTracer.TraceError <ADObjectId, string, string>(0L, "EAP.ValidateQueryString returns AccessDenied because tenant user {0} requested partner access to {1} which is not found in the local forest and URL {2} is invalid", userEntry.Id, tenantOrganization, httpURL); throw new UrlInValidException(Strings.ErrorUrlInValid); } ExTraceGlobals.ADConfigTracer.TraceDebug(0L, "EAP.ValidateQueryString returns Success."); }
protected override IConfigDataProvider CreateSession() { OrganizationId organizationId = this.ResolveOrganizationId(); ADUser tenantArbitrationMailbox; try { tenantArbitrationMailbox = AdminAuditLogHelper.GetTenantArbitrationMailbox(organizationId); } catch (ObjectNotFoundException innerException) { TaskLogger.Trace("ObjectNotFoundException occurred when getting Exchange principal from the discovery mailbox user.", new object[0]); throw new AdminAuditLogSearchException(Strings.AuditLogSearchArbitrationMailboxNotFound(organizationId.ToString()), innerException); } catch (NonUniqueRecipientException innerException2) { TaskLogger.Trace("More than one tenant arbitration mailbox found for the current organization.", new object[0]); throw new AdminAuditLogSearchException(Strings.AuditLogSearchNonUniqueArbitrationMailbox(organizationId.ToString()), innerException2); } ExchangePrincipal primaryMailbox = ExchangePrincipal.FromADUser(ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(organizationId), tenantArbitrationMailbox, RemotingOptions.AllowCrossSite); return(new AuditLogSearchEwsDataProvider(primaryMailbox)); }
// Token: 0x06000195 RID: 405 RVA: 0x0000BD80 File Offset: 0x00009F80 private void HandleErrorLoadingProcessEhaMigrationMessageSetting(OrganizationId orgId, Exception exception) { ElcUserInformation.Tracer.TraceError <ElcUserInformation, OrganizationId, string>((long)this.GetHashCode(), "{0}: Failed to find Organization settings for IsProcessEhaMigratedMessages for organization {1}. {2}", this, orgId, (exception != null) ? ("Exception: " + exception.ToString()) : string.Empty); Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ELCFailedToLoadProcessEhaMigrationMessageSetting, null, new object[] { orgId, this.MailboxSession.DisplayName, (exception != null) ? exception.ToString() : string.Empty }); throw new SkipException(Strings.descUnableToFetchOrganizationEhaMigrationSetting(this.MailboxSession.DisplayName, orgId.ToString())); }
//public void Terminate () //{ // Terminate(EventSource.Unknown); //} public void Terminate(EventSource eventSource, Person actingPerson, string description) { if (base.Active) { //Added removal of Roles here to make SURE they always are removed with the membership. Authority authority = Person.GetAuthority(); int actingPersonId = actingPerson == null ? 0 : actingPerson.Identity; BasicPersonRole[] roles = authority.AllPersonRoles; List <PersonRole> theRoles = new List <PersonRole>(); foreach (BasicPersonRole basicRole in roles) { PersonRole personRole = PersonRole.FromBasic(basicRole); theRoles.Add(personRole); if (personRole.OrganizationId == OrganizationId) { PWEvents.CreateEvent(eventSource, EventType.DeletedRole, actingPersonId, personRole.OrganizationId, personRole.GeographyId, Person.Identity, (int)personRole.Type, string.Empty); PWLog.Write(actingPersonId, PWLogItem.Person, Person.Identity, PWLogAction.RoleDeleted, "Role " + personRole.Type + " of " + personRole.Geography.Name + " was deleted with membership.", string.Empty); personRole.Delete(); } } //now check if this means that you no longer are a member of some uplevel org, then remove those roles as well foreach (PersonRole personRole in theRoles) { if (!Person.MemberOfWithInherited(personRole.Organization)) { PWEvents.CreateEvent(eventSource, EventType.DeletedRole, actingPersonId, personRole.OrganizationId, personRole.GeographyId, Person.Identity, (int)personRole.Type, string.Empty); PWLog.Write(actingPersonId, PWLogItem.Person, Person.Identity, PWLogAction.RoleDeleted, "Role " + personRole.Type + " of " + personRole.Geography.Name + " was deleted with membership of all suborgs.", string.Empty); personRole.Delete(); } } EventSource src = EventSource.PirateWeb; try { if (HttpContext.Current == null) { src = EventSource.PirateBot; } } catch { src = EventSource.PirateBot; } PWLog.Write(actingPersonId, PWLogItem.Person, Person.Identity, PWLogAction.MemberLost, eventSource + ":" + description, string.Empty); PWEvents.CreateEvent(src, EventType.LostMember, actingPersonId, OrganizationId, Person.GeographyId, Person.Identity, 0, OrganizationId.ToString()); //Added LogChurn here to make SURE they always are logged with the membership. if (PersonId > 0 && OrganizationId > 0 && base.Expires != new DateTime(1900, 1, 1)) { ChurnData.LogChurn(PersonId, OrganizationId); } SwarmDb.GetDatabaseForWriting().TerminateMembership(Identity); base.Active = false; base.DateTerminated = DateTime.Now; // Remove all newsletter subscriptions once the membership is terminated (to make sure default is now off and only turn off explicitly turned-on subscriptions) // HACK HACK HACK: uses feed IDs in an extremely ugly way to loop 1-9. Should use NewsletterFeeds.ForOrganization() once support for newsletters in different orgs are established. for (int newsletterFeedId = 1; newsletterFeedId < 10; newsletterFeedId++) { try { if (this.person.IsSubscribing(newsletterFeedId)) { this.person.SetSubscription(newsletterFeedId, false); } } catch (Exception) { // ignore nonexisting newsletter feeds -- this is a hack anyway } } } }