Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-spinelli committed Nov 21, 2024
2 parents 852e84b + e0b482d commit 5c418b5
Show file tree
Hide file tree
Showing 38 changed files with 1,992 additions and 1,985 deletions.
46 changes: 39 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
end_of_line = crlf


[*.{cs,js,ts,sql,tql}]
Expand All @@ -21,15 +24,42 @@ csharp_space_between_method_call_parameter_list_parentheses = true
csharp_space_between_method_declaration_parameter_list_parentheses = true
csharp_space_after_keywords_in_control_flow_statements = false
csharp_space_between_parentheses = control_flow_statements
# Motive: May be weird at first, but it improve readability.
csharp_space_around_binary_operators = before_and_after
# Motive: May be weird at first, but it improves readability.

csharp_style_prefer_primary_constructors = false:suggestion
# Primary constructors should be used only for very simple classes. May be record is a good choice.

csharp_indent_labels = no_change
# When using goto, labels should be explicitly positioned based on the algorithm.

csharp_using_directive_placement = outside_namespace:silent
# Rather standard placement of using in C#.

csharp_indent_case_contents_when_block = false;
# switch case block don't need another indent.

csharp_prefer_braces = true:silent

csharp_style_prefer_method_group_conversion = true:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent

csharp_style_prefer_top_level_statements = true:suggestion
# Applies to Main().

csharp_style_namespace_declarations=file_scoped:suggestion
#Motive: Less useless space.

# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style

dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
Expand All @@ -51,17 +81,20 @@ dotnet_diagnostic.CA1816.severity = none
csharp_prefer_simple_using_statement = false:none
# Motive: Most of the time, the 'not simple' using scope is better.

# CA1031: Do not catch general exception types.
dotnet_diagnostic.CA1031.severity = none

# IDE0057: Use range operator.
csharp_style_prefer_range_operator = false:suggestion
# Motive: Use it if you want but this is should not show a message.

csharp_style_namespace_declarations = file_scoped:warning
# Motive: Less whitespace for editable files (this doesn't apply to generated code).

# IDE0060: Remove unused parameter
dotnet_code_quality_unused_parameters = all:silent
# Motive: Emit messages where the parameter are necessary.

# CA1031: Do not catch general exception types.
dotnet_diagnostic.CA1031.severity = none

# IDE0040: Add accessibility modifiers
dotnet_style_require_accessibility_modifiers = omit_if_default:silent
# Motive: 'private' is one more word that can be omitted.
Expand Down Expand Up @@ -112,6 +145,5 @@ dotnet_diagnostic.VSTHRD101.severity = error
# VSTHRD003: Avoid awaiting foreign Tasks
dotnet_diagnostic.VSTHRD003.severity = none


# /Signature-Code .editorconfig

Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Description>This package adds a ScopeSetId column to CK.tUserGitLab table.</Description>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CK.DB.Auth.AuthScope" Version="21.0.0" />
<PackageReference Include="CK.DB.Auth.AuthScope" Version="22.0.0" />
<ProjectReference Include="..\CK.DB.User.UserGitLab\CK.DB.User.UserGitLab.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="**\*.sql;**\*.tql;**\*.y4" Exclude="bin\**;obj\**;CodeCakeBuilder\**;packages\**;@(EmbeddedResource)" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<EmbeddedResource Include="**\*.sql;**\*.tql;**\*.y4" />
</ItemGroup>
</Project>
23 changes: 11 additions & 12 deletions CK.DB.User.UserGitLab.AuthScope/IUserGitLabInfo.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using CK.Core;
using System;

namespace CK.DB.User.UserGitLab.AuthScope
namespace CK.DB.User.UserGitLab.AuthScope;

/// <summary>
/// Extends <see cref="UserGitLab.IUserGitLabInfo"/> with ScopeSet identifier.
/// </summary>
public interface IUserGitLabInfo : UserGitLab.IUserGitLabInfo
{
/// <summary>
/// Extends <see cref="UserGitLab.IUserGitLabInfo"/> with ScopeSet identifier.
/// Gets or sets the scope set identifier.
/// Note that the ScopeSetId is intrinsic: a new ScopeSetId is acquired
/// and set only when a new UserGitLab is created (by copy from
/// the default one - the ScopeSet of the UserGitLab 0).
/// </summary>
public interface IUserGitLabInfo : UserGitLab.IUserGitLabInfo
{
/// <summary>
/// Gets or sets the scope set identifier.
/// Note that the ScopeSetId is intrinsic: a new ScopeSetId is acquired
/// and set only when a new UserGitLab is created (by copy from
/// the default one - the ScopeSet of the UserGitLab 0).
/// </summary>
int ScopeSetId { get; set; }
}
int ScopeSetId { get; set; }
}
95 changes: 47 additions & 48 deletions CK.DB.User.UserGitLab.AuthScope/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,57 @@
using System;
using System.Threading.Tasks;

namespace CK.DB.User.UserGitLab.AuthScope
namespace CK.DB.User.UserGitLab.AuthScope;

/// <summary>
/// Package that adds AuthScope support to GitLab authentication.
/// </summary>
[SqlPackage( Schema = "CK", ResourcePath = "Res" )]
[Versions( "1.0.0" )]
[SqlObjectItem( "transform:sUserGitLabUCL, transform:sUserGitLabDestroy" )]
public class Package : SqlPackage
{
AuthScopeSetTable _scopeSetTable;
UserGitLabTable _googleTable;

void StObjConstruct( AuthScopeSetTable scopeSetTable, UserGitLabTable googleTable )
{
_scopeSetTable = scopeSetTable;
_googleTable = googleTable;
}

/// <summary>
/// Gets the <see cref="UserGitLabTable"/>.
/// </summary>
public UserGitLabTable UserGitLabTable => _googleTable;

/// <summary>
/// Package that adds AuthScope support to GitLab authentication.
/// Gets the <see cref="AuthScopeSetTable"/>.
/// </summary>
[SqlPackage( Schema = "CK", ResourcePath = "Res" )]
[Versions("1.0.0")]
[SqlObjectItem( "transform:sUserGitLabUCL, transform:sUserGitLabDestroy" )]
public class Package : SqlPackage
public AuthScopeSetTable AuthScopeSetTable => _scopeSetTable;

/// <summary>
/// Reads the <see cref="AuthScopeSet"/> of a user.
/// </summary>
/// <param name="ctx">The call context to use.</param>
/// <param name="userId">The user identifier.</param>
/// <returns>The scope set or null if the user is not a GitLab user.</returns>
public Task<AuthScopeSet> ReadScopeSetAsync( ISqlCallContext ctx, int userId )
{
AuthScopeSetTable _scopeSetTable;
UserGitLabTable _googleTable;

void StObjConstruct( AuthScopeSetTable scopeSetTable, UserGitLabTable googleTable )
{
_scopeSetTable = scopeSetTable;
_googleTable = googleTable;
}

/// <summary>
/// Gets the <see cref="UserGitLabTable"/>.
/// </summary>
public UserGitLabTable UserGitLabTable => _googleTable;

/// <summary>
/// Gets the <see cref="AuthScopeSetTable"/>.
/// </summary>
public AuthScopeSetTable AuthScopeSetTable => _scopeSetTable;

/// <summary>
/// Reads the <see cref="AuthScopeSet"/> of a user.
/// </summary>
/// <param name="ctx">The call context to use.</param>
/// <param name="userId">The user identifier.</param>
/// <returns>The scope set or null if the user is not a GitLab user.</returns>
public Task<AuthScopeSet> ReadScopeSetAsync( ISqlCallContext ctx, int userId )
{
if( userId <= 0 ) throw new ArgumentException( nameof( userId ) );
var cmd = _scopeSetTable.CreateReadCommand( $"select ScopeSetId from CK.tUserGitLab where UserId = {userId}" );
return _scopeSetTable.RawReadAuthScopeSetAsync( ctx, cmd );
}

/// <summary>
/// Reads the default <see cref="AuthScopeSet"/> that is the template for new users.
/// </summary>
/// <param name="ctx">The call context to use.</param>
/// <returns>The default scope set.</returns>
public Task<AuthScopeSet> ReadDefaultScopeSetAsync( ISqlCallContext ctx )
{
var cmd = _scopeSetTable.CreateReadCommand( "select ScopeSetId from CK.tUserGitLab where UserId = 0" );
return _scopeSetTable.RawReadAuthScopeSetAsync( ctx, cmd );
}
if( userId <= 0 ) throw new ArgumentException( nameof( userId ) );
var cmd = _scopeSetTable.CreateReadCommand( $"select ScopeSetId from CK.tUserGitLab where UserId = {userId}" );
return _scopeSetTable.RawReadAuthScopeSetAsync( ctx, cmd );
}

/// <summary>
/// Reads the default <see cref="AuthScopeSet"/> that is the template for new users.
/// </summary>
/// <param name="ctx">The call context to use.</param>
/// <returns>The default scope set.</returns>
public Task<AuthScopeSet> ReadDefaultScopeSetAsync( ISqlCallContext ctx )
{
var cmd = _scopeSetTable.CreateReadCommand( "select ScopeSetId from CK.tUserGitLab where UserId = 0" );
return _scopeSetTable.RawReadAuthScopeSetAsync( ctx, cmd );
}

}
10 changes: 3 additions & 7 deletions CK.DB.User.UserGitLab/CK.DB.User.UserGitLab.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Description>This package defines tUserGitLab table.</Description>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CK.DB.Auth" Version="21.0.0" />
<PackageReference Include="CK.DB.Auth" Version="22.0.0" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="**\*.sql;**\*.tql;**\*.y4" Exclude="bin\**;obj\**;@(EmbeddedResource)" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<EmbeddedResource Include="**\*.sql;**\*.tql;**\*.y4" />
</ItemGroup>
</Project>
18 changes: 8 additions & 10 deletions CK.DB.User.UserGitLab/IUserGitLabInfo.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
using CK.Core;

namespace CK.DB.User.UserGitLab
namespace CK.DB.User.UserGitLab;

/// <summary>
/// Holds information stored for a GitLab user.
/// </summary>
public interface IUserGitLabInfo : IPoco
{
/// <summary>
/// Holds information stored for a GitLab user.
/// Gets or sets the GitLab account identifier.
/// </summary>
public interface IUserGitLabInfo : IPoco
{
/// <summary>
/// Gets or sets the GitLab account identifier.
/// </summary>
string GitLabAccountId { get; set; }
}

string GitLabAccountId { get; set; }
}
21 changes: 10 additions & 11 deletions CK.DB.User.UserGitLab/Package.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using CK.Core;

namespace CK.DB.User.UserGitLab
namespace CK.DB.User.UserGitLab;

/// <summary>
/// Package that adds GitLab authentication support for users.
/// </summary>
[SqlPackage( Schema = "CK", ResourcePath = "Res" )]
[Versions( "1.0.0" )]
[SqlObjectItem( "transform:vUserAuthProvider" )]
public class Package : SqlPackage
{
/// <summary>
/// Package that adds GitLab authentication support for users.
/// </summary>
[SqlPackage( Schema = "CK", ResourcePath = "Res" )]
[Versions("1.0.0")]
[SqlObjectItem( "transform:vUserAuthProvider" )]
public class Package : SqlPackage
void StObjConstruct( Actor.Package actorPackage, Auth.Package authPackage )
{
void StObjConstruct( Actor.Package actorPackage, Auth.Package authPackage )
{
}
}
}
Loading

0 comments on commit 5c418b5

Please sign in to comment.