Merge branch 'feature/files' into feature/selectors-refactoring
This commit is contained in:
commit
3d34978bf0
204
.editorconfig
Normal file
204
.editorconfig
Normal file
@ -0,0 +1,204 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
|
||||
# Organize usings
|
||||
dotnet_separate_import_directive_groups = true
|
||||
dotnet_sort_system_directives_first = true
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false:silent
|
||||
dotnet_style_qualification_for_field = false:silent
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
dotnet_style_qualification_for_property = false:silent
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
|
||||
dotnet_style_predefined_type_for_member_access = true:warning
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||
|
||||
# Modifier preferences
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_coalesce_expression = true:warning
|
||||
dotnet_style_collection_initializer = true:warning
|
||||
dotnet_style_explicit_tuple_names = true:warning
|
||||
dotnet_style_null_propagation = true:warning
|
||||
dotnet_style_object_initializer = true:warning
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_prefer_auto_properties = true:warning
|
||||
dotnet_style_prefer_compound_assignment = true:warning
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||
dotnet_style_prefer_inferred_tuple_names = true:warning
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:warning
|
||||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
|
||||
# Field preferences
|
||||
dotnet_style_readonly_field = true:warning
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all:warning
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = true:warning
|
||||
csharp_style_var_for_built_in_types = true:warning
|
||||
csharp_style_var_when_type_is_apparent = true:warning
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_methods = false:suggestion
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:warning
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true:warning
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true:suggestion
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:warning
|
||||
csharp_style_deconstructed_variable_declaration = true:warning
|
||||
csharp_style_inlined_variable_declaration = true:warning
|
||||
csharp_style_pattern_local_over_anonymous_function = true:warning
|
||||
csharp_style_prefer_index_operator = true:warning
|
||||
csharp_style_prefer_range_operator = true:warning
|
||||
csharp_style_throw_expression = true:warning
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = false
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#### Naming styles ####
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
|
||||
# Default severity for analyzer diagnostics with category 'Style'
|
||||
dotnet_analyzer_diagnostic.category-Style.severity = silent
|
@ -68,6 +68,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Encryption
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.TelegramService", "common\services\ASC.TelegramService\ASC.TelegramService.csproj", "{95CE7371-17B6-4EEE-8E38-2FDE6347E955}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0E35EB77-EC53-44C2-99EB-3D845C79675D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -29,32 +29,14 @@ namespace ASC.Api.Core.Auth
|
||||
UrlEncoder encoder,
|
||||
ISystemClock clock,
|
||||
SecurityContext securityContext,
|
||||
EmailValidationKeyProvider emailValidationKeyProvider,
|
||||
SetupInfo setupInfo,
|
||||
TenantManager tenantManager,
|
||||
UserManager userManager,
|
||||
AuthManager authManager,
|
||||
AuthContext authContext,
|
||||
IServiceProvider serviceProvider) :
|
||||
base(options, logger, encoder, clock)
|
||||
{
|
||||
SecurityContext = securityContext;
|
||||
EmailValidationKeyProvider = emailValidationKeyProvider;
|
||||
SetupInfo = setupInfo;
|
||||
TenantManager = tenantManager;
|
||||
UserManager = userManager;
|
||||
AuthManager = authManager;
|
||||
AuthContext = authContext;
|
||||
ServiceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
private SecurityContext SecurityContext { get; }
|
||||
private EmailValidationKeyProvider EmailValidationKeyProvider { get; }
|
||||
private SetupInfo SetupInfo { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
private UserManager UserManager { get; }
|
||||
private AuthManager AuthManager { get; }
|
||||
private AuthContext AuthContext { get; }
|
||||
public IServiceProvider ServiceProvider { get; }
|
||||
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
@ -120,13 +102,7 @@ namespace ASC.Api.Core.Auth
|
||||
public static DIHelper AddConfirmAuthHandler(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddSecurityContextService()
|
||||
.AddEmailValidationKeyProviderService()
|
||||
.AddSetupInfo()
|
||||
.AddTenantManagerService()
|
||||
.AddUserManagerService()
|
||||
.AddAuthManager()
|
||||
.AddAuthContextService();
|
||||
.AddSecurityContextService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace ASC.Api.Core
|
||||
{
|
||||
public IHttpContextAccessor HttpContextAccessor { get; set; }
|
||||
public Tenant tenant;
|
||||
public Tenant Tenant { get { return tenant ?? (tenant = TenantManager.GetCurrentTenant(HttpContextAccessor.HttpContext)); } }
|
||||
public Tenant Tenant { get { return tenant ??= TenantManager.GetCurrentTenant(HttpContextAccessor.HttpContext); } }
|
||||
|
||||
public ApiContext(IHttpContextAccessor httpContextAccessor, SecurityContext securityContext, TenantManager tenantManager)
|
||||
{
|
||||
@ -224,7 +224,7 @@ namespace ASC.Api.Core
|
||||
var id = HttpContextAccessor.HttpContext.User.Claims.FirstOrDefault(r => r.Type == ClaimTypes.Sid);
|
||||
if (Guid.TryParse(id?.Value, out var userId))
|
||||
{
|
||||
_ = SecurityContext.AuthenticateMe(userId);
|
||||
SecurityContext.AuthenticateMe(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,9 +272,9 @@ namespace ASC.Api.Core
|
||||
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
if (obj is DateTime)
|
||||
return CompareTo((DateTime)obj);
|
||||
return obj is ApiDateTime ? CompareTo((ApiDateTime)obj) : 0;
|
||||
if (obj is DateTime dateTime)
|
||||
return CompareTo(dateTime);
|
||||
return obj is ApiDateTime apiDateTime ? CompareTo(apiDateTime) : 0;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -309,13 +309,13 @@ namespace ASC.Api.Core
|
||||
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string)
|
||||
if (value is string @string)
|
||||
{
|
||||
return ApiDateTime.Parse((string)value, null, null);
|
||||
return ApiDateTime.Parse(@string, null, null);
|
||||
}
|
||||
if (value is DateTime)
|
||||
if (value is DateTime time)
|
||||
{
|
||||
return new ApiDateTime(null, null, (DateTime)value);
|
||||
return new ApiDateTime(null, null, time);
|
||||
}
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
@ -359,7 +359,10 @@ namespace ASC.Api.Core
|
||||
TimeZoneConverter = timeZoneConverter;
|
||||
}
|
||||
|
||||
public ApiDateTime Get(DateTime? from) => ApiDateTime.FromDate(TenantManager, TimeZoneConverter, from);
|
||||
public ApiDateTime Get(DateTime? from)
|
||||
{
|
||||
return ApiDateTime.FromDate(TenantManager, TimeZoneConverter, from);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ApiDateTimeHelperExtension
|
||||
|
@ -22,8 +22,6 @@ namespace ASC.Api.Core.Middleware
|
||||
private static readonly IDictionary<string, Guid> products;
|
||||
private readonly ILog log;
|
||||
|
||||
private UserManager UserManager { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
private WebItemSecurity WebItemSecurity { get; }
|
||||
private AuthContext AuthContext { get; }
|
||||
|
||||
@ -57,14 +55,10 @@ namespace ASC.Api.Core.Middleware
|
||||
|
||||
public ProductSecurityFilter(
|
||||
IOptionsMonitor<ILog> options,
|
||||
UserManager userManager,
|
||||
TenantManager tenantManager,
|
||||
WebItemSecurity webItemSecurity,
|
||||
AuthContext authContext)
|
||||
{
|
||||
log = options.CurrentValue;
|
||||
UserManager = userManager;
|
||||
TenantManager = tenantManager;
|
||||
WebItemSecurity = webItemSecurity;
|
||||
AuthContext = authContext;
|
||||
}
|
||||
@ -128,8 +122,6 @@ namespace ASC.Api.Core.Middleware
|
||||
public static DIHelper AddProductSecurityFilter(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddUserManagerService()
|
||||
.AddTenantManagerService()
|
||||
.AddWebItemSecurity()
|
||||
.AddAuthContextService();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace ASC.Common.Caching
|
||||
|
||||
foreach (var k in keys)
|
||||
{
|
||||
_ = MemoryCache.Default.Remove(k);
|
||||
MemoryCache.Default.Remove(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -130,11 +130,11 @@ namespace ASC.Common.Caching
|
||||
try
|
||||
{
|
||||
var cr = c.Consume(Cts[channelName].Token);
|
||||
if (cr != null && cr.Value != null && !(new Guid(cr.Key.Id.ToByteArray())).Equals(Key) && Actions.TryGetValue(channelName, out var act))
|
||||
if (cr != null && cr.Message != null && cr.Message.Value != null && !(new Guid(cr.Message.Key.Id.ToByteArray())).Equals(Key) && Actions.TryGetValue(channelName, out var act))
|
||||
{
|
||||
try
|
||||
{
|
||||
act(cr.Value);
|
||||
act(cr.Message.Value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -9,7 +9,9 @@ namespace ASC.Common.Caching
|
||||
public class ProtobufSerializer<T> : ISerializer<T> where T : IMessage<T>, new()
|
||||
{
|
||||
public byte[] Serialize(T data, SerializationContext context)
|
||||
=> data.ToByteArray();
|
||||
{
|
||||
return data.ToByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProtobufDeserializer<T> : IDeserializer<T> where T : IMessage<T>, new()
|
||||
@ -22,7 +24,9 @@ namespace ASC.Common.Caching
|
||||
}
|
||||
|
||||
public T Deserialize(ReadOnlySpan<byte> data, bool isNull, SerializationContext context)
|
||||
=> parser.ParseFrom(data.ToArray());
|
||||
{
|
||||
return parser.ParseFrom(data.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
public static class GuidExtension
|
||||
|
@ -172,27 +172,27 @@ namespace ASC.Common
|
||||
|
||||
public DIHelper AddWorkerQueue<T1>(int workerCount, int waitInterval, bool stopAfterFinsih, int errorCount)
|
||||
{
|
||||
Action<WorkerQueue<T1>> action = (a) =>
|
||||
void action(WorkerQueue<T1> a)
|
||||
{
|
||||
a.workerCount = workerCount;
|
||||
a.waitInterval = waitInterval;
|
||||
a.stopAfterFinsih = stopAfterFinsih;
|
||||
a.errorCount = errorCount;
|
||||
};
|
||||
AddToConfigured($"{typeof(WorkerQueue<T1>)}", action);
|
||||
}
|
||||
AddToConfigured($"{typeof(WorkerQueue<T1>)}", (Action<WorkerQueue<T1>>)action);
|
||||
return this;
|
||||
}
|
||||
public DIHelper AddProgressQueue<T1>(int workerCount, int waitInterval, bool removeAfterCompleted, bool stopAfterFinsih, int errorCount) where T1 : class, IProgressItem
|
||||
{
|
||||
Action<ProgressQueue<T1>> action = (a) =>
|
||||
void action(ProgressQueue<T1> a)
|
||||
{
|
||||
a.workerCount = workerCount;
|
||||
a.waitInterval = waitInterval;
|
||||
a.stopAfterFinsih = stopAfterFinsih;
|
||||
a.errorCount = errorCount;
|
||||
a.removeAfterCompleted = removeAfterCompleted;
|
||||
};
|
||||
AddToConfigured($"{typeof(ProgressQueue<T1>)}", action);
|
||||
}
|
||||
AddToConfigured($"{typeof(ProgressQueue<T1>)}", (Action<ProgressQueue<T1>>)action);
|
||||
return this;
|
||||
}
|
||||
public DIHelper Configure<TOptions>(string name, Action<TOptions> configureOptions) where TOptions : class
|
||||
|
@ -142,7 +142,7 @@ namespace ASC.Common.DependencyInjection
|
||||
return GetPath(Path.Combine(productPath, "bin"), n, SearchOption.AllDirectories) ?? GetPath(productPath, n, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
string GetPath(string dirPath, string dll, SearchOption searchOption)
|
||||
static string GetPath(string dirPath, string dll, SearchOption searchOption)
|
||||
{
|
||||
if (!Directory.Exists(dirPath)) return null;
|
||||
|
||||
|
@ -57,19 +57,22 @@ namespace ASC.Common.Logging
|
||||
}
|
||||
|
||||
public IDisposable BeginScope<TState>(TState state) { return null; }
|
||||
public bool IsEnabled(LogLevel logLevel) => logLevel switch
|
||||
public bool IsEnabled(LogLevel logLevel)
|
||||
{
|
||||
LogLevel.Trace => CustomLogger.IsTraceEnabled,
|
||||
LogLevel.Information => CustomLogger.IsInfoEnabled,
|
||||
LogLevel.None => false,
|
||||
return logLevel switch
|
||||
{
|
||||
LogLevel.Trace => CustomLogger.IsTraceEnabled,
|
||||
LogLevel.Information => CustomLogger.IsInfoEnabled,
|
||||
LogLevel.None => false,
|
||||
|
||||
LogLevel.Debug => CustomLogger.IsDebugEnabled,
|
||||
LogLevel.Warning => CustomLogger.IsWarnEnabled,
|
||||
LogLevel.Error => CustomLogger.IsErrorEnabled,
|
||||
LogLevel.Critical => CustomLogger.IsErrorEnabled,
|
||||
LogLevel.Debug => CustomLogger.IsDebugEnabled,
|
||||
LogLevel.Warning => CustomLogger.IsWarnEnabled,
|
||||
LogLevel.Error => CustomLogger.IsErrorEnabled,
|
||||
LogLevel.Critical => CustomLogger.IsErrorEnabled,
|
||||
|
||||
_ => true,
|
||||
};
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
@ -99,7 +102,8 @@ namespace ASC.Common.Logging
|
||||
new KeyValuePair<string, object>("sqlParams", parameters ?? "")
|
||||
);
|
||||
}
|
||||
string GetParam(KeyValuePair<string, object> keyValuePair, string key, string currentVal)
|
||||
|
||||
static string GetParam(KeyValuePair<string, object> keyValuePair, string key, string currentVal)
|
||||
{
|
||||
return keyValuePair.Key == key ? keyValuePair.Value.ToString() : currentVal;
|
||||
}
|
||||
|
@ -383,7 +383,8 @@ namespace ASC.Common.Logging
|
||||
|
||||
public void Configure(LogNLog options)
|
||||
{
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(Path.Combine(Configuration["pathToConf"], "nlog.config"), true);
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(Path.Combine(Configuration["pathToConf"], "nlog.config"));
|
||||
LogManager.ThrowConfigExceptions = false;
|
||||
|
||||
var settings = Configuration.GetSetting<NLogSettings>("log");
|
||||
if (!string.IsNullOrEmpty(settings.Name))
|
||||
|
@ -74,10 +74,10 @@ namespace ASC.Common.Logging
|
||||
}
|
||||
|
||||
var val = repo.Properties[realKey];
|
||||
if (val is PatternString)
|
||||
if (val is PatternString patternString)
|
||||
{
|
||||
((PatternString)val).ActivateOptions();
|
||||
((PatternString)val).Format(writer);
|
||||
patternString.ActivateOptions();
|
||||
patternString.Format(writer);
|
||||
}
|
||||
else if (val != null)
|
||||
{
|
||||
|
@ -44,10 +44,10 @@ namespace ASC.Common.Security.Authorizing
|
||||
currObjIdAsProvider = false;
|
||||
CurrentObjectId = objectId ?? throw new ArgumentNullException(nameof(objectId));
|
||||
currSecObjProvider = secObjProvider;
|
||||
if (currSecObjProvider == null && CurrentObjectId is ISecurityObjectProvider)
|
||||
if (currSecObjProvider == null && CurrentObjectId is ISecurityObjectProvider securityObjectProvider)
|
||||
{
|
||||
currObjIdAsProvider = true;
|
||||
currSecObjProvider = (ISecurityObjectProvider)CurrentObjectId;
|
||||
currSecObjProvider = securityObjectProvider;
|
||||
}
|
||||
callContext = new SecurityCallContext();
|
||||
}
|
||||
|
@ -50,9 +50,9 @@ namespace ASC.Common.Tests.Logging
|
||||
[Test]
|
||||
public void CommandLineTest()
|
||||
{
|
||||
XmlConfigurator.Configure(log4net.LogManager.GetRepository(Assembly.GetCallingAssembly()));
|
||||
var appenders = LogManager.GetLogger(Assembly.GetCallingAssembly(), "ASC").Logger.Repository.GetAppenders();
|
||||
_ = ((FileAppender)appenders[0]).File;
|
||||
//XmlConfigurator.Configure(log4net.LogManager.GetRepository(Assembly.GetCallingAssembly()));
|
||||
//var appenders = LogManager.GetLogger(Assembly.GetCallingAssembly(), "ASC").Logger.Repository.GetAppenders();
|
||||
//((FileAppender)appenders[0]).File;
|
||||
//Assert.AreEqual(Path.GetTempPath() + "onlyoffice\\8.0\\bin\\Test." + DateTime.Now.ToString("MM-dd") + ".log", ((FileAppender)appenders[0]).File);
|
||||
}
|
||||
}
|
||||
|
@ -269,9 +269,9 @@ namespace ASC.Common.Threading.Workers
|
||||
try
|
||||
{
|
||||
var stopAfterFinsih = false;
|
||||
if (state != null && state is bool)
|
||||
if (state != null && state is bool b)
|
||||
{
|
||||
stopAfterFinsih = (bool)state;
|
||||
stopAfterFinsih = b;
|
||||
}
|
||||
do
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ namespace ASC.Core.Billing
|
||||
}
|
||||
}
|
||||
|
||||
private static DateTime _date = DateTime.MinValue;
|
||||
private static readonly DateTime _date = DateTime.MinValue;
|
||||
|
||||
public DateTime VersionReleaseDate
|
||||
{
|
||||
|
@ -218,34 +218,34 @@ namespace ASC.Core.Billing
|
||||
|
||||
if (billingConfigured && withRequestToPaymentSystem)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using var client = GetBillingClient();
|
||||
var p = client.GetLastPayment(GetPortalId(tenantId));
|
||||
var quota = QuotaService.GetTenantQuotas().SingleOrDefault(q => q.AvangateId == p.ProductId);
|
||||
if (quota == null)
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("Quota with id {0} not found for portal {1}.", p.ProductId, GetPortalId(tenantId)));
|
||||
}
|
||||
var asynctariff = Tariff.CreateDefault();
|
||||
asynctariff.QuotaId = quota.Id;
|
||||
asynctariff.Autorenewal = p.Autorenewal;
|
||||
asynctariff.DueDate = 9999 <= p.EndDate.Year ? DateTime.MaxValue : p.EndDate;
|
||||
|
||||
if (SaveBillingInfo(tenantId, Tuple.Create(asynctariff.QuotaId, asynctariff.DueDate), false))
|
||||
{
|
||||
asynctariff = CalculateTariff(tenantId, asynctariff);
|
||||
ClearCache(tenantId);
|
||||
Cache.Insert(key, asynctariff, DateTime.UtcNow.Add(GetCacheExpiration()));
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
LogError(error);
|
||||
}
|
||||
});
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using var client = GetBillingClient();
|
||||
var p = client.GetLastPayment(GetPortalId(tenantId));
|
||||
var quota = QuotaService.GetTenantQuotas().SingleOrDefault(q => q.AvangateId == p.ProductId);
|
||||
if (quota == null)
|
||||
{
|
||||
throw new InvalidOperationException(string.Format("Quota with id {0} not found for portal {1}.", p.ProductId, GetPortalId(tenantId)));
|
||||
}
|
||||
var asynctariff = Tariff.CreateDefault();
|
||||
asynctariff.QuotaId = quota.Id;
|
||||
asynctariff.Autorenewal = p.Autorenewal;
|
||||
asynctariff.DueDate = 9999 <= p.EndDate.Year ? DateTime.MaxValue : p.EndDate;
|
||||
|
||||
if (SaveBillingInfo(tenantId, Tuple.Create(asynctariff.QuotaId, asynctariff.DueDate), false))
|
||||
{
|
||||
asynctariff = CalculateTariff(tenantId, asynctariff);
|
||||
ClearCache(tenantId);
|
||||
Cache.Insert(key, asynctariff, DateTime.UtcNow.Add(GetCacheExpiration()));
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
LogError(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -689,12 +689,12 @@ namespace ASC.Core.Billing
|
||||
public static class TariffConfigExtension
|
||||
{
|
||||
public static DIHelper AddTariffService(this DIHelper services)
|
||||
{
|
||||
if (services.TryAddScoped<ITariffService, TariffService>())
|
||||
{
|
||||
{
|
||||
if (services.TryAddScoped<ITariffService, TariffService>())
|
||||
{
|
||||
services.AddCoreDbContextService();
|
||||
services.TryAddSingleton<TariffServiceStorage>();
|
||||
services.TryAddScoped<IConfigureOptions<TariffService>, ConfigureTariffService>();
|
||||
services.TryAddSingleton<TariffServiceStorage>();
|
||||
services.TryAddScoped<IConfigureOptions<TariffService>, ConfigureTariffService>();
|
||||
}
|
||||
|
||||
return services;
|
||||
|
@ -107,7 +107,9 @@ namespace ASC.Core.Configuration
|
||||
CoreBaseSettings = coreBaseSettings;
|
||||
}
|
||||
|
||||
public void Deconstruct(out TenantManager tenantManager, out CoreBaseSettings coreBaseSettings) =>
|
||||
public void Deconstruct(out TenantManager tenantManager, out CoreBaseSettings coreBaseSettings)
|
||||
{
|
||||
(tenantManager, coreBaseSettings) = (TenantManager, CoreBaseSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,14 +311,20 @@ namespace ASC.Core
|
||||
|
||||
#region Methods Get/Save Setting
|
||||
|
||||
public void SaveSetting(string key, string value, int tenant = Tenant.DEFAULT_TENANT) => CoreSettings.SaveSetting(key, value, tenant);
|
||||
|
||||
public string GetSetting(string key, int tenant = Tenant.DEFAULT_TENANT) => CoreSettings.GetSetting(key, tenant);
|
||||
|
||||
public void SaveSetting(string key, string value, int tenant = Tenant.DEFAULT_TENANT)
|
||||
{
|
||||
CoreSettings.SaveSetting(key, value, tenant);
|
||||
}
|
||||
|
||||
public string GetSetting(string key, int tenant = Tenant.DEFAULT_TENANT)
|
||||
{
|
||||
return CoreSettings.GetSetting(key, tenant);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods Get/Set Section
|
||||
|
||||
|
||||
public T GetSection<T>() where T : class
|
||||
{
|
||||
return GetSection<T>(typeof(T).Name);
|
||||
|
@ -124,7 +124,7 @@ namespace ASC.Core
|
||||
internal IQuotaService QuotaService { get; set; }
|
||||
internal ITariffService TariffService { get; set; }
|
||||
|
||||
private static List<string> thisCompAddresses = new List<string>();
|
||||
private static readonly List<string> thisCompAddresses = new List<string>();
|
||||
|
||||
internal IHttpContextAccessor HttpContextAccessor { get; set; }
|
||||
internal CoreBaseSettings CoreBaseSettings { get; set; }
|
||||
|
@ -67,7 +67,7 @@ namespace ASC.Core
|
||||
private Constants Constants { get; }
|
||||
|
||||
private Tenant tenant;
|
||||
private Tenant Tenant { get { return tenant ?? (tenant = TenantManager.GetCurrentTenant()); } }
|
||||
private Tenant Tenant { get { return tenant ??= TenantManager.GetCurrentTenant(); } }
|
||||
|
||||
public UserManager()
|
||||
{
|
||||
@ -269,7 +269,7 @@ namespace ASC.Core
|
||||
return findUsers.ToArray();
|
||||
}
|
||||
|
||||
public UserInfo SaveUserInfo(UserInfo u, bool isVisitor = false)
|
||||
public UserInfo SaveUserInfo(UserInfo u)
|
||||
{
|
||||
if (IsSystemUser(u.ID)) return SystemUsers[u.ID];
|
||||
if (u.ID == Guid.Empty) PermissionContext.DemandPermissions(Constants.Action_AddRemoveUser);
|
||||
|
@ -162,9 +162,6 @@ namespace TMResourceData
|
||||
private readonly string culture;
|
||||
private readonly string filename;
|
||||
private readonly ILog log;
|
||||
|
||||
private IConfiguration Configuration { get; }
|
||||
private IOptionsMonitor<ILog> Option { get; }
|
||||
private DbContextManager<ResourceDbContext> DbContext { get; }
|
||||
|
||||
public DBResourceSet(
|
||||
@ -184,8 +181,6 @@ namespace TMResourceData
|
||||
throw new ArgumentNullException("filename");
|
||||
}
|
||||
|
||||
Configuration = configuration;
|
||||
Option = option;
|
||||
DbContext = dbContext;
|
||||
log = option.CurrentValue;
|
||||
|
||||
|
@ -75,7 +75,7 @@ namespace ASC.Core.Users
|
||||
set
|
||||
{
|
||||
contacts = value;
|
||||
_ = ContactsFromString(contacts);
|
||||
ContactsFromString(contacts);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ namespace ASC.Core.Data
|
||||
{
|
||||
if (string.IsNullOrEmpty(login)) throw new ArgumentNullException("login");
|
||||
|
||||
Func<IQueryable<TenantUserSecurity>> query = () => TenantsQuery()
|
||||
IQueryable<TenantUserSecurity> query() => TenantsQuery()
|
||||
.Where(r => r.Status == TenantStatus.Active)
|
||||
.Join(TenantDbContext.Users, r => r.Id, r => r.Tenant, (tenant, user) => new
|
||||
{
|
||||
|
@ -1,9 +1,11 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ASC.Core.Common.EF.Context
|
||||
{
|
||||
public class MySqlAccountLinkContext : AccountLinkContext { }
|
||||
|
@ -1,7 +1,9 @@
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -31,8 +33,8 @@ namespace ASC.Core.Common.EF
|
||||
{
|
||||
ModelBuilderWrapper
|
||||
.From(modelBuilder, Provider)
|
||||
.AddAcl()
|
||||
.AddDbButton()
|
||||
.AddAcl()
|
||||
.AddDbButton()
|
||||
.AddDbQuotaRow()
|
||||
.AddDbQuota()
|
||||
.AddDbTariff();
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ASC.Core.Common.EF.Context
|
||||
{
|
||||
public class MySqlFilesDbContext : FilesDbContext { }
|
||||
|
@ -1,9 +1,11 @@
|
||||
using ASC.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
using ASC.Core.Common.EF.Model.Mail;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ASC.Core.Common.EF.Context
|
||||
{
|
||||
@ -19,7 +21,7 @@ namespace ASC.Core.Common.EF.Context
|
||||
public DbSet<GreyListingWhiteList> GreyListingWhiteList { get; set; }
|
||||
|
||||
public MailDbContext() { }
|
||||
public MailDbContext(DbContextOptions options) : base(options){}
|
||||
public MailDbContext(DbContextOptions options) : base(options) { }
|
||||
protected override Dictionary<Provider, Func<BaseDbContext>> ProviderContext
|
||||
{
|
||||
get
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
using ASC.Core.Common.EF.Model.Resource;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ASC.Core.Common.EF
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
using ASC.Common;
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -20,12 +20,18 @@ namespace ASC.Core.Common.EF
|
||||
var sqlGenerator = factory.Create();
|
||||
var command = sqlGenerator.GetCommand(selectExpression);
|
||||
|
||||
string sql = command.CommandText;
|
||||
var sql = command.CommandText;
|
||||
return sql;
|
||||
}
|
||||
|
||||
private static object Private(this object obj, string privateField) => obj?.GetType().GetField(privateField, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(obj);
|
||||
private static T Private<T>(this object obj, string privateField) => (T)obj?.GetType().GetField(privateField, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(obj);
|
||||
private static object Private(this object obj, string privateField)
|
||||
{
|
||||
return obj?.GetType().GetField(privateField, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(obj);
|
||||
}
|
||||
|
||||
private static T Private<T>(this object obj, string privateField)
|
||||
{
|
||||
return (T)obj?.GetType().GetField(privateField, BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
@ -15,7 +16,10 @@ namespace ASC.Core.Common.EF.Model
|
||||
[Column("last_modified")]
|
||||
public DateTime LastModified { get; set; }
|
||||
|
||||
public override object[] GetKeys() => new[] { IndexName };
|
||||
public override object[] GetKeys()
|
||||
{
|
||||
return new[] { IndexName };
|
||||
}
|
||||
}
|
||||
public static class DbWebstudioIndexExtension
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@ -30,7 +31,10 @@ namespace ASC.Core.Common.EF.Model
|
||||
public string Json { get; set; }
|
||||
public string Keywords { get; set; }
|
||||
|
||||
public override object[] GetKeys() => new object[] { Id };
|
||||
public override object[] GetKeys()
|
||||
{
|
||||
return new object[] { Id };
|
||||
}
|
||||
}
|
||||
public static class FeedAggregateExtension
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
@ -15,7 +16,10 @@ namespace ASC.Core.Common.EF.Model
|
||||
[Column("last_date")]
|
||||
public DateTime LastDate { get; set; }
|
||||
|
||||
public override object[] GetKeys() => new object[] { LastKey };
|
||||
public override object[] GetKeys()
|
||||
{
|
||||
return new object[] { LastKey };
|
||||
}
|
||||
}
|
||||
public static class FeedLastExtension
|
||||
{
|
||||
|
@ -14,7 +14,10 @@ namespace ASC.Core.Common.EF.Model
|
||||
[Column("user_id")]
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public override object[] GetKeys() => new object[] { FeedId, UserId };
|
||||
public override object[] GetKeys()
|
||||
{
|
||||
return new object[] { FeedId, UserId };
|
||||
}
|
||||
}
|
||||
|
||||
public static class FeedUsersExtension
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model.Mail
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model.Resource
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ASC.Core.Common.EF
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ASC.Core.Common.EF
|
||||
|
@ -1,5 +1,7 @@
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ASC.Core.Common.EF.Model
|
||||
|
@ -1,5 +1,7 @@
|
||||
using ASC.Core.Common.EF.Model;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
@ -289,7 +289,7 @@ namespace ASC.Core
|
||||
{
|
||||
public static DIHelper AddHostedSolutionService(this DIHelper services)
|
||||
{
|
||||
if (services.TryAddScoped<IConfigureOptions<HostedSolution>, ConfigureHostedSolution>())
|
||||
if (services.TryAddScoped<IConfigureOptions<HostedSolution>, ConfigureHostedSolution>())
|
||||
{
|
||||
return services
|
||||
.AddUserFormatter()
|
||||
@ -304,6 +304,6 @@ namespace ASC.Core
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.MySql.AccountLinkContextMySql
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.MySql.FeedDbContextMySql
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.MySql.UserDbContextMySql
|
||||
@ -7,7 +8,7 @@ namespace ASC.Core.Common.Migrations.MySql.UserDbContextMySql
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "core_group",
|
||||
columns: table => new
|
||||
@ -83,7 +84,7 @@ namespace ASC.Core.Common.Migrations.MySql.UserDbContextMySql
|
||||
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.source, x.action, x.recipient });
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "core_userphoto",
|
||||
@ -100,7 +101,7 @@ namespace ASC.Core.Common.Migrations.MySql.UserDbContextMySql
|
||||
table.PrimaryKey("PRIMARY", x => x.userid);
|
||||
});
|
||||
|
||||
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "core_subscription",
|
||||
columns: new[] { "tenant", "source", "action", "recipient", "object", "unsubscribed" },
|
||||
@ -177,7 +178,7 @@ namespace ASC.Core.Common.Migrations.MySql.UserDbContextMySql
|
||||
table: "core_group",
|
||||
columns: new[] { "tenant", "parentid" });
|
||||
|
||||
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "tenant",
|
||||
table: "core_userphoto",
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.AccountLinkContextNpgsql
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.CoreDbContextNpgsql
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.DbContextNpgsql
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.FeedDbContextNpgsql
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.MailDbContextNpgsql
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.MessagesContextNpgsql
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.NotifyDbContextNpgsql
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.ResourceDbContextNpgsql
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.TelegramDbContextNpgsql
|
||||
|
@ -11,8 +11,8 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "onlyoffice");
|
||||
|
||||
name: "onlyoffice");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "core_settings",
|
||||
schema: "onlyoffice",
|
||||
@ -24,10 +24,10 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
last_modified = table.Column<DateTime>(nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
{
|
||||
table.PrimaryKey("core_settings_pkey", x => new { x.tenant, x.id });
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "onlyoffice",
|
||||
table: "core_settings",
|
||||
@ -79,8 +79,8 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
schema: "onlyoffice",
|
||||
table: "core_user",
|
||||
columns: new[] { "id", "firstname", "lastname", "username", "tenant", "email", "workfromdate", "last_modified", "status", "activation_status", "phone_activation", "removed" },
|
||||
values: new object[] { new Guid("66faa6e4-f133-11ea-b126-00ffeec8b4ef"), "Administrator", "", "administrator", 1, " ", new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), 1, 0, 0, false });
|
||||
|
||||
values: new object[] { new Guid("66faa6e4-f133-11ea-b126-00ffeec8b4ef"), "Administrator", "", "administrator", 1, " ", new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), 1, 0, 0, false });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tenants_forbiden",
|
||||
schema: "onlyoffice",
|
||||
@ -89,10 +89,10 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
address = table.Column<string>(maxLength: 50, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
{
|
||||
table.PrimaryKey("tenants_forbiden_pkey", x => x.address);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tenants_iprestrictions",
|
||||
schema: "onlyoffice",
|
||||
@ -104,10 +104,10 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
ip = table.Column<string>(maxLength: 50, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
{
|
||||
table.PrimaryKey("PK_tenants_iprestrictions", x => x.id);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tenants_tenants",
|
||||
schema: "onlyoffice",
|
||||
@ -140,8 +140,8 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_tenants_tenants", x => x.id);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tenants_version",
|
||||
schema: "onlyoffice",
|
||||
@ -154,10 +154,10 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
visible = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
{
|
||||
table.PrimaryKey("PK_tenants_version", x => x.id);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "core_usergroup",
|
||||
schema: "onlyoffice",
|
||||
@ -174,13 +174,13 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
{
|
||||
table.PrimaryKey("core_usergroup_pkey", x => new { x.tenant, x.userid, x.groupid, x.ref_type });
|
||||
|
||||
});
|
||||
});
|
||||
migrationBuilder.InsertData(
|
||||
schema: "onlyoffice",
|
||||
table: "core_usergroup",
|
||||
columns: new[] { "tenant", "userid", "groupid", "ref_type", "last_modified", "removed" },
|
||||
values: new object[] { 1, new Guid("66faa6e4-f133-11ea-b126-00ffeec8b4ef"), "cd84e66b-b803-40fc-99f9-b2969a54a1de", 0, new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), false });
|
||||
|
||||
values: new object[] { 1, new Guid("66faa6e4-f133-11ea-b126-00ffeec8b4ef"), "cd84e66b-b803-40fc-99f9-b2969a54a1de", 0, new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), false });
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "core_usersecurity",
|
||||
schema: "onlyoffice",
|
||||
@ -193,10 +193,10 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
LastModified = table.Column<DateTime>(nullable: true, defaultValueSql: "CURRENT_TIMESTAMP")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
{
|
||||
table.PrimaryKey("core_usersecurity_pkey", x => x.userid);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "onlyoffice",
|
||||
table: "core_usersecurity",
|
||||
@ -228,81 +228,81 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
{
|
||||
"controlpanel",
|
||||
"localhost"
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "onlyoffice",
|
||||
table: "tenants_tenants",
|
||||
columns: new[] { "id", "alias", "creationdatetime", "industry", "name", "owner_id", "public", "status", "statuschanged", "version_changed", "Version_Changed" },
|
||||
values: new object[] { 1, "localhost", new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), null, "Web Office", new Guid("66faa6e4-f133-11ea-b126-00ffeec8b4ef"), false, 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null });
|
||||
|
||||
values: new object[] { 1, "localhost", new DateTime(2020, 9, 29, 10, 46, 46, 424, DateTimeKind.Utc).AddTicks(6218), null, "Web Office", new Guid("66faa6e4-f133-11ea-b126-00ffeec8b4ef"), false, 0, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "email",
|
||||
schema: "onlyoffice",
|
||||
table: "core_user",
|
||||
column: "email");
|
||||
|
||||
column: "email");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "last_modified_core_user",
|
||||
schema: "onlyoffice",
|
||||
table: "core_user",
|
||||
column: "last_modified");
|
||||
|
||||
column: "last_modified");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "username",
|
||||
schema: "onlyoffice",
|
||||
table: "core_user",
|
||||
columns: new[] { "username", "tenant" });
|
||||
|
||||
columns: new[] { "username", "tenant" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "last_modified_core_usergroup",
|
||||
schema: "onlyoffice",
|
||||
table: "core_usergroup",
|
||||
column: "last_modified");
|
||||
|
||||
column: "last_modified");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_core_usergroup_userid",
|
||||
schema: "onlyoffice",
|
||||
table: "core_usergroup",
|
||||
column: "userid");
|
||||
|
||||
column: "userid");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "pwdhash",
|
||||
schema: "onlyoffice",
|
||||
table: "core_usersecurity",
|
||||
column: "pwdhash");
|
||||
|
||||
column: "pwdhash");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "tenant_core_usersecurity",
|
||||
schema: "onlyoffice",
|
||||
table: "core_usersecurity",
|
||||
column: "tenant");
|
||||
|
||||
column: "tenant");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "tenant_tenants_iprestrictions",
|
||||
schema: "onlyoffice",
|
||||
table: "tenants_iprestrictions",
|
||||
column: "tenant");
|
||||
|
||||
column: "tenant");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "alias",
|
||||
schema: "onlyoffice",
|
||||
table: "tenants_tenants",
|
||||
column: "alias",
|
||||
unique: true);
|
||||
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "last_modified_tenants_tenants",
|
||||
schema: "onlyoffice",
|
||||
table: "tenants_tenants",
|
||||
column: "last_modified");
|
||||
|
||||
column: "last_modified");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "mappeddomain",
|
||||
schema: "onlyoffice",
|
||||
table: "tenants_tenants",
|
||||
column: "mappeddomain");
|
||||
|
||||
column: "mappeddomain");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "version",
|
||||
schema: "onlyoffice",
|
||||
@ -311,39 +311,39 @@ namespace ASC.Core.Common.Migrations.Npgsql.TenantDbContextNpgsql
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "core_settings",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "core_usergroup",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "core_usersecurity",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenants_forbiden",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenants_iprestrictions",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenants_partners",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenants_version",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "core_user",
|
||||
schema: "onlyoffice");
|
||||
|
||||
schema: "onlyoffice");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "tenants_tenants",
|
||||
schema: "onlyoffice");
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.UserDbContextNpgsql
|
||||
@ -62,7 +63,7 @@ namespace ASC.Core.Common.Migrations.Npgsql.UserDbContextNpgsql
|
||||
table.PrimaryKey("core_subscriptionmethod_pkey", x => new { x.tenant, x.source, x.action, x.recipient });
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "core_userphoto",
|
||||
@ -78,8 +79,8 @@ namespace ASC.Core.Common.Migrations.Npgsql.UserDbContextNpgsql
|
||||
table.PrimaryKey("core_userphoto_pkey", x => x.userid);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: "onlyoffice",
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace ASC.Core.Common.Migrations.Npgsql.VoipDbContextNpgsql
|
||||
|
@ -443,7 +443,7 @@ namespace ASC.Notify.Cron
|
||||
}
|
||||
if (type == DayOfWeek && !lastdayOfMonth)
|
||||
{
|
||||
var val = (int)daysOfMonth[daysOfMonth.Count - 1];
|
||||
var val = (int)daysOfMonth[^1];
|
||||
if (val == NoSpecInt)
|
||||
{
|
||||
throw new FormatException(
|
||||
@ -674,7 +674,7 @@ namespace ASC.Notify.Cron
|
||||
end = v1;
|
||||
i = vs.pos;
|
||||
}
|
||||
if (i < s.Length && ((_ = s[i]) == '/'))
|
||||
if (i < s.Length && ((s[i]) == '/'))
|
||||
{
|
||||
i++;
|
||||
c = s[i];
|
||||
|
@ -126,11 +126,11 @@ namespace ASC.Core.Notify
|
||||
m.To = string.Join("|", to.ToArray());
|
||||
|
||||
var replyTag = message.Arguments.FirstOrDefault(x => x.Tag == "replyto");
|
||||
if (replyTag != null && replyTag.Value is string)
|
||||
if (replyTag != null && replyTag.Value is string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
m.ReplyTo = MailAddressUtils.Create((string)replyTag.Value).ToString();
|
||||
m.ReplyTo = MailAddressUtils.Create(value).ToString();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -181,7 +181,9 @@ namespace ASC.Core.Notify
|
||||
}
|
||||
|
||||
public void Deconstruct(out TenantManager tenantManager, out CoreConfiguration coreConfiguration, out IOptionsMonitor<ILog> optionsMonitor)
|
||||
=> (tenantManager, coreConfiguration, optionsMonitor) = (TenantManager, CoreConfiguration, Options);
|
||||
{
|
||||
(tenantManager, coreConfiguration, optionsMonitor) = (TenantManager, CoreConfiguration, Options);
|
||||
}
|
||||
}
|
||||
|
||||
public static class EmailSenderSinkExtension
|
||||
|
@ -16,15 +16,19 @@ namespace ASC.Common.Notify.Engine
|
||||
/// </summary>
|
||||
/// <param name="name">The name with which to associate the new item in the call context.</param>
|
||||
/// <param name="data">The object to store in the call context.</param>
|
||||
public static void SetData(string name, object data) =>
|
||||
public static void SetData(string name, object data)
|
||||
{
|
||||
state.GetOrAdd(name, _ => new AsyncLocal<object>()).Value = data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves an object with the specified name from the <see cref="CallContext"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the item in the call context.</param>
|
||||
/// <returns>The object in the call context associated with the specified name, or <see langword="null"/> if not found.</returns>
|
||||
public static object GetData(string name) =>
|
||||
state.TryGetValue(name, out var data) ? data.Value : null;
|
||||
public static object GetData(string name)
|
||||
{
|
||||
return state.TryGetValue(name, out var data) ? data.Value : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace ASC.Notify.Engine
|
||||
private readonly Dictionary<string, ISendInterceptor> globalInterceptors = new Dictionary<string, ISendInterceptor>(10);
|
||||
|
||||
|
||||
private Dictionary<string, ISendInterceptor> callInterceptors
|
||||
private Dictionary<string, ISendInterceptor> CallInterceptors
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -60,7 +60,7 @@ namespace ASC.Notify.Engine
|
||||
switch (interceptor.Lifetime)
|
||||
{
|
||||
case InterceptorLifetime.Call:
|
||||
AddInternal(interceptor, callInterceptors);
|
||||
AddInternal(interceptor, CallInterceptors);
|
||||
break;
|
||||
case InterceptorLifetime.Global:
|
||||
AddInternal(interceptor, globalInterceptors);
|
||||
@ -73,7 +73,7 @@ namespace ASC.Notify.Engine
|
||||
public ISendInterceptor Get(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) throw new ArgumentException("empty name", "name");
|
||||
var result = GetInternal(name, callInterceptors);
|
||||
var result = GetInternal(name, CallInterceptors);
|
||||
if (result == null) result = GetInternal(name, globalInterceptors);
|
||||
return result;
|
||||
}
|
||||
@ -82,7 +82,7 @@ namespace ASC.Notify.Engine
|
||||
{
|
||||
if (string.IsNullOrEmpty(name)) throw new ArgumentException("empty name", "name");
|
||||
|
||||
RemoveInternal(name, callInterceptors);
|
||||
RemoveInternal(name, CallInterceptors);
|
||||
RemoveInternal(name, globalInterceptors);
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ namespace ASC.Notify.Engine
|
||||
{
|
||||
lock (syncRoot)
|
||||
{
|
||||
if ((lifetime & InterceptorLifetime.Call) == InterceptorLifetime.Call) callInterceptors.Clear();
|
||||
if ((lifetime & InterceptorLifetime.Call) == InterceptorLifetime.Call) CallInterceptors.Clear();
|
||||
if ((lifetime & InterceptorLifetime.Global) == InterceptorLifetime.Global) globalInterceptors.Clear();
|
||||
}
|
||||
}
|
||||
@ -103,7 +103,7 @@ namespace ASC.Notify.Engine
|
||||
public List<ISendInterceptor> GetAll()
|
||||
{
|
||||
var result = new List<ISendInterceptor>();
|
||||
result.AddRange(callInterceptors.Values);
|
||||
result.AddRange(CallInterceptors.Values);
|
||||
result.AddRange(globalInterceptors.Values);
|
||||
return result;
|
||||
}
|
||||
|
@ -101,7 +101,9 @@ namespace ASC.Core.Notify
|
||||
}
|
||||
|
||||
public void Deconstruct(out UserManager userManager, out TenantManager tenantManager)
|
||||
=> (userManager, tenantManager) = (UserManager, TenantManager);
|
||||
{
|
||||
(userManager, tenantManager) = (UserManager, TenantManager);
|
||||
}
|
||||
}
|
||||
|
||||
public static class JabberSenderSinkExtension
|
||||
|
@ -32,8 +32,8 @@ namespace ASC.Core.Notify
|
||||
{
|
||||
public class NotifyServiceClient : INotifyService
|
||||
{
|
||||
private ICacheNotify<NotifyMessage> СacheNotify;
|
||||
private ICacheNotify<NotifyInvoke> NotifyInvoke;
|
||||
private readonly ICacheNotify<NotifyMessage> СacheNotify;
|
||||
private readonly ICacheNotify<NotifyInvoke> NotifyInvoke;
|
||||
public NotifyServiceClient(ICacheNotify<NotifyMessage> cacheNotify, ICacheNotify<NotifyInvoke> notifyInvoke)
|
||||
{
|
||||
СacheNotify = cacheNotify;
|
||||
|
@ -39,7 +39,7 @@ namespace ASC.Core.Notify
|
||||
public abstract class NotifySource : INotifySource
|
||||
{
|
||||
private readonly object syncRoot = new object();
|
||||
private bool initialized;
|
||||
private readonly bool initialized;
|
||||
|
||||
private readonly IDictionary<CultureInfo, IActionProvider> actions = new Dictionary<CultureInfo, IActionProvider>();
|
||||
|
||||
|
@ -159,7 +159,7 @@ namespace ASC.Notify.Patterns
|
||||
}
|
||||
return property.GetValue(resourceManagerType, null) as string;
|
||||
|
||||
string ToUpper(string name)
|
||||
static string ToUpper(string name)
|
||||
{
|
||||
return name.Substring(0, 1).ToUpper() + name.Substring(1);
|
||||
}
|
||||
|
@ -86,9 +86,9 @@ namespace ASC.Core.Notify.Senders
|
||||
|
||||
if (!configuration.SmtpSettings.IsDefaultSettings)
|
||||
{
|
||||
_useCoreSettings = true;
|
||||
UseCoreSettings = true;
|
||||
result = base.Send(m);
|
||||
_useCoreSettings = false;
|
||||
UseCoreSettings = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -242,7 +242,9 @@ namespace ASC.Core.Notify.Senders
|
||||
}
|
||||
|
||||
public void Deconstruct(out TenantManager tenantManager, out CoreConfiguration coreConfiguration)
|
||||
=> (tenantManager, coreConfiguration) = (TenantManager, CoreConfiguration);
|
||||
{
|
||||
(tenantManager, coreConfiguration) = (TenantManager, CoreConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
public static class AWSSenderExtension
|
||||
|
@ -65,7 +65,7 @@ namespace ASC.Core.Notify.Senders
|
||||
private int Port { get; set; }
|
||||
private bool Ssl { get; set; }
|
||||
private ICredentials Credentials { get; set; }
|
||||
protected bool _useCoreSettings { get; set; }
|
||||
protected bool UseCoreSettings { get; set; }
|
||||
const int NETWORK_TIMEOUT = 30000;
|
||||
|
||||
public SmtpSender(
|
||||
@ -81,7 +81,7 @@ namespace ASC.Core.Notify.Senders
|
||||
{
|
||||
if (properties.ContainsKey("useCoreSettings") && bool.Parse(properties["useCoreSettings"]))
|
||||
{
|
||||
_useCoreSettings = true;
|
||||
UseCoreSettings = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -122,7 +122,7 @@ namespace ASC.Core.Notify.Senders
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_useCoreSettings)
|
||||
if (UseCoreSettings)
|
||||
InitUseCoreSettings(configuration);
|
||||
|
||||
var mail = BuildMailMessage(m);
|
||||
@ -334,7 +334,9 @@ namespace ASC.Core.Notify.Senders
|
||||
}
|
||||
|
||||
public void Deconstruct(out TenantManager tenantManager, out CoreConfiguration coreConfiguration)
|
||||
=> (tenantManager, coreConfiguration) = (TenantManager, CoreConfiguration);
|
||||
{
|
||||
(tenantManager, coreConfiguration) = (TenantManager, CoreConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
public static class SmtpSenderExtension
|
||||
|
@ -49,13 +49,13 @@ namespace ASC.Core.Common.Notify.Telegram
|
||||
public void Configure(string name, CachedTelegramDao options)
|
||||
{
|
||||
Configure(options);
|
||||
options.tgDao = Service.Get(name);
|
||||
options.TgDao = Service.Get(name);
|
||||
}
|
||||
|
||||
public void Configure(CachedTelegramDao options)
|
||||
{
|
||||
options.tgDao = Service.Value;
|
||||
options.cache = AscCache.Memory;
|
||||
options.TgDao = Service.Value;
|
||||
options.Cache = AscCache.Memory;
|
||||
options.Expiration = TimeSpan.FromMinutes(20);
|
||||
|
||||
options.PairKeyFormat = "tgUser:{0}:{1}";
|
||||
@ -65,8 +65,8 @@ namespace ASC.Core.Common.Notify.Telegram
|
||||
|
||||
public class CachedTelegramDao
|
||||
{
|
||||
public TelegramDao tgDao { get; set; }
|
||||
public ICache cache { get; set; }
|
||||
public TelegramDao TgDao { get; set; }
|
||||
public ICache Cache { get; set; }
|
||||
public TimeSpan Expiration { get; set; }
|
||||
|
||||
public string PairKeyFormat { get; set; }
|
||||
@ -75,25 +75,25 @@ namespace ASC.Core.Common.Notify.Telegram
|
||||
|
||||
public void Delete(Guid userId, int tenantId)
|
||||
{
|
||||
cache.Remove(string.Format(PairKeyFormat, userId, tenantId));
|
||||
tgDao.Delete(userId, tenantId);
|
||||
Cache.Remove(string.Format(PairKeyFormat, userId, tenantId));
|
||||
TgDao.Delete(userId, tenantId);
|
||||
}
|
||||
|
||||
public void Delete(int telegramId)
|
||||
{
|
||||
cache.Remove(string.Format(SingleKeyFormat, telegramId));
|
||||
tgDao.Delete(telegramId);
|
||||
Cache.Remove(string.Format(SingleKeyFormat, telegramId));
|
||||
TgDao.Delete(telegramId);
|
||||
}
|
||||
|
||||
public TelegramUser GetUser(Guid userId, int tenantId)
|
||||
{
|
||||
var key = string.Format(PairKeyFormat, userId, tenantId);
|
||||
|
||||
var user = cache.Get<TelegramUser>(key);
|
||||
var user = Cache.Get<TelegramUser>(key);
|
||||
if (user != null) return user;
|
||||
|
||||
user = tgDao.GetUser(userId, tenantId);
|
||||
if (user != null) cache.Insert(key, user, Expiration);
|
||||
user = TgDao.GetUser(userId, tenantId);
|
||||
if (user != null) Cache.Insert(key, user, Expiration);
|
||||
return user;
|
||||
}
|
||||
|
||||
@ -101,20 +101,20 @@ namespace ASC.Core.Common.Notify.Telegram
|
||||
{
|
||||
var key = string.Format(SingleKeyFormat, telegramId);
|
||||
|
||||
var users = cache.Get<List<TelegramUser>>(key);
|
||||
var users = Cache.Get<List<TelegramUser>>(key);
|
||||
if (users != null) return users;
|
||||
|
||||
users = tgDao.GetUser(telegramId);
|
||||
if (users.Any()) cache.Insert(key, users, Expiration);
|
||||
users = TgDao.GetUser(telegramId);
|
||||
if (users.Any()) Cache.Insert(key, users, Expiration);
|
||||
return users;
|
||||
}
|
||||
|
||||
public void RegisterUser(Guid userId, int tenantId, int telegramId)
|
||||
{
|
||||
tgDao.RegisterUser(userId, tenantId, telegramId);
|
||||
TgDao.RegisterUser(userId, tenantId, telegramId);
|
||||
|
||||
var key = string.Format(PairKeyFormat, userId, tenantId);
|
||||
cache.Insert(key, new TelegramUser { PortalUserId = userId, TenantId = tenantId, TelegramUserId = telegramId }, Expiration);
|
||||
Cache.Insert(key, new TelegramUser { PortalUserId = userId, TenantId = tenantId, TelegramUserId = telegramId }, Expiration);
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user