Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Nuget to 1.5.373 release and fix GDS Sql Database #589

Merged
merged 13 commits into from
Feb 11, 2024
Merged
6 changes: 5 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
analyze:
name: Analyze
runs-on: windows-2022
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
Expand Down Expand Up @@ -51,7 +55,7 @@ jobs:

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.3.1
uses: microsoft/setup-msbuild@v2.0.0

- name: Restore Packages
run: |
Expand Down
6 changes: 3 additions & 3 deletions ComIOP/Common/UA COM Interop Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion ComIOP/Wrapper/ServerWrapper/UA COM Server Wrapper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Samples/Client.Net4/UA Sample Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<Version>8.0.0</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Bindings.Https">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
Expand Down
6 changes: 3 additions & 3 deletions Samples/Client/ClientPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,15 @@ private void Discovery_RegisterMI_Click(object sender, EventArgs e)
}
}

private async void OnRegister(object sender)
private void OnRegister(object sender)
{
try
{
Opc.Ua.Server.StandardServer server = m_server;

if (server != null)
{
await server.RegisterWithDiscoveryServer();
server.RegisterWithDiscoveryServer();
}
}
catch (Exception exception)
Expand Down Expand Up @@ -557,7 +557,7 @@ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,() =>
{
XmlEncoder encoder = new XmlEncoder(monitoredItem.Subscription.Session.MessageContext);
e.NotificationValue.Encode(encoder);
ServerStatusTB.Text = encoder.Close();
ServerStatusTB.Text = encoder.CloseAndReturnText();
}
catch (Exception ex)
{
Expand Down
6 changes: 3 additions & 3 deletions Samples/Client/Opc.Ua.SampleClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua">
<Version>1.4.372.106</Version>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.3.0</Version>
Expand Down Expand Up @@ -189,4 +189,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
8 changes: 4 additions & 4 deletions Samples/ClientControls.Net4/UA Client Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1015,16 +1015,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>1.4.372.76</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.4.372.76</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes">
<Version>1.4.372.76</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration">
<Version>1.4.372.76</Version>
<Version>1.5.373.121</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
4 changes: 2 additions & 2 deletions Samples/ClientControls/Opc.Ua.Client.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.3.0</Version>
Expand All @@ -290,4 +290,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
2 changes: 1 addition & 1 deletion Samples/Controls.Net4/UA Sample Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
4 changes: 2 additions & 2 deletions Samples/Controls/Opc.Ua.Sample.Controls.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -207,7 +207,7 @@
<Version>6.2.14</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Server">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.3.0</Version>
Expand Down
4 changes: 2 additions & 2 deletions Samples/GDS/Client/GlobalDiscoveryClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Client.Common">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Client.Common">
<Version>1.4.372.106</Version>
<Version>1.5.373.121</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions Samples/GDS/ConsoleServer/NetCoreGlobalDiscoveryServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Server.Common" Version="1.4.372.106" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.4.372.106" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Gds.Server.Common" Version="1.5.373.121" />
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Configuration" Version="1.5.373.121" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions Samples/GDS/ConsoleServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

using Mono.Options;
using Opc.Ua.Configuration;
using Opc.Ua.Gds.Server.Database;
using Opc.Ua.Gds.Server.Database.Linq;
using Opc.Ua.Server;
using Opc.Ua.Server.UserDatabase;
using System;
using System.Collections.Generic;
using System.Data;
Expand Down Expand Up @@ -92,7 +92,7 @@ public enum ExitCode : int
ErrorInvalidCommandLine = 0x100
};

public class Program
public static class Program
{

public static int Main(string[] args)
Expand Down Expand Up @@ -242,7 +242,7 @@ private async Task ConsoleGlobalDiscoveryServer()
string userdatabaseStorePath = Utils.ReplaceSpecialFolderNames(gdsConfiguration.UsersDatabaseStorePath);

var database = JsonApplicationsDatabase.Load(databaseStorePath);
var userDatabase = JsonUsersDatabase.Load(userdatabaseStorePath);
var userDatabase = JsonUserDatabase.Load(userdatabaseStorePath);

bool createStandardUsers = ConfigureUsers(userDatabase);

Expand Down Expand Up @@ -273,7 +273,7 @@ private async Task ConsoleGlobalDiscoveryServer()

}

private bool ConfigureUsers(JsonUsersDatabase userDatabase)
private bool ConfigureUsers(JsonUserDatabase userDatabase)
{
ApplicationInstance.MessageDlg.Message("Use default users?", true);
bool createStandardUsers = ApplicationInstance.MessageDlg.ShowAsync().Result;
Expand All @@ -297,10 +297,10 @@ private bool ConfigureUsers(JsonUsersDatabase userDatabase)
_ = password ?? throw new ArgumentNullException("Password is not allowed to be empty");

//create User, if User exists delete & recreate
if (!userDatabase.CreateUser(username, password, GdsRole.ApplicationAdmin))
if (!userDatabase.CreateUser(username, password, new List<Role>() { GdsRole.ApplicationAdmin }))
{
userDatabase.DeleteUser(username);
userDatabase.CreateUser(username, password, GdsRole.ApplicationAdmin);
userDatabase.CreateUser(username, password, new List<Role>() { GdsRole.ApplicationAdmin });
}
}
return createStandardUsers;
Expand Down
18 changes: 10 additions & 8 deletions Samples/GDS/Server/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
<configSections>
<section name="Opc.Ua.ServerConfiguration" type="Opc.Ua.ApplicationConfigurationSection,Opc.Ua.Core" />
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<!-- creates gdsdb in user folder --><!-- opens existing gdsdb.mdl in project folder -->
<!--add name="gdsdbEntities" connectionString="metadata=res://*/gdsdb.csdl|res://*/gdsdb.ssdl|res://*/gdsdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;Server=(localdb)\MSSQLLocalDB;MultipleActiveResultSets=true;Integrated Security=true;AttachDbFileName=|DataDirectory|\gdsdb.mdf;&quot;" providerName="System.Data.EntityClient"/--><add name="gdsdbEntities" connectionString="metadata=res://*/gdsdb.csdl|res://*/gdsdb.ssdl|res://*/gdsdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=gdsdb;MultipleActiveResultSets=true;Integrated Security=True;Pooling=False&quot;" providerName="System.Data.EntityClient" /><add name="usersdbEntities" connectionString="metadata=res://*/usersdb.csdl|res://*/usersdb.ssdl|res://*/usersdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(localdb)\MSSQLLocalDB;initial catalog=usersdb;integrated security=True;encrypt=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

<!-- creates gdsdb in user folder -->
<!-- opens existing gdsdb.mdl in project folder -->
<!--add name="gdsdbEntities" connectionString="metadata=res://*/gdsdb.csdl|res://*/gdsdb.ssdl|res://*/gdsdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;Server=(localdb)\MSSQLLocalDB;MultipleActiveResultSets=true;Integrated Security=true;AttachDbFileName=|DataDirectory|\gdsdb.mdf;&quot;" providerName="System.Data.EntityClient"/-->
<add name="gdsdbEntities" connectionString="metadata=res://*/DB.gdsdb.csdl|res://*/DB.gdsdb.ssdl|res://*/DB.gdsdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=gdsdb;MultipleActiveResultSets=true;Integrated Security=True;Pooling=False&quot;" providerName="System.Data.EntityClient" />
<add name="usersdbEntities" connectionString="metadata=res://*/DB.usersdb.csdl|res://*/DB.usersdb.ssdl|res://*/DB.usersdb.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=(localdb)\MSSQLLocalDB;initial catalog=usersdb;integrated security=True;encrypt=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<!--
UA servers built with the SDK use the Opc.Ua.SessionEndpoint class to implement the ISessionEndpoint
Expand Down Expand Up @@ -78,6 +81,5 @@
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<runtime>
</runtime>
</configuration>
<runtime></runtime>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

namespace Opc.Ua.Gds.Server
namespace Opc.Ua.Gds.Server.DB
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

namespace Opc.Ua.Gds.Server
namespace Opc.Ua.Gds.Server.DB
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

namespace Opc.Ua.Gds.Server
namespace Opc.Ua.Gds.Server.DB
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

namespace Opc.Ua.Gds.Server
namespace Opc.Ua.Gds.Server.DB
{
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// </auto-generated>
//------------------------------------------------------------------------------

namespace Opc.Ua.Gds.Server
namespace Opc.Ua.Gds.Server.DB
{
using System;
using System.Collections.Generic;
Expand Down
14 changes: 8 additions & 6 deletions Samples/GDS/Server/User.cs → Samples/GDS/Server/DB/SqlRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
// </auto-generated>
//------------------------------------------------------------------------------

namespace Opc.Ua.Gds.Server
namespace Opc.Ua.Gds.Server.DB
{
using System;
using System.Collections.Generic;

public partial class User
public partial class SqlRole
{
public System.Guid ID { get; set; }
public string UserName { get; set; }
public string Hash { get; set; }
public int GdsRole { get; set; }
public System.Guid Id { get; set; }
public Nullable<System.Guid> RoleId { get; set; }
public string Name { get; set; }
public System.Guid UserID { get; set; }

public virtual User User { get; set; }
}
}
32 changes: 32 additions & 0 deletions Samples/GDS/Server/DB/SqlRoleCast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using Opc.Ua.Server;

namespace Opc.Ua.Gds.Server.DB
{
public partial class SqlRole
{
public static explicit operator Role(SqlRole sqlRole)
{
if (sqlRole.RoleId != null)
{
return new Role(new NodeId(sqlRole.RoleId), sqlRole.Name);
}

return new Role(NodeId.Null, sqlRole.Name);
}

public static explicit operator SqlRole(Role Role)
{
return new SqlRole() {
Id = Guid.NewGuid(),
Name = Role.Name,
RoleId = Role.RoleId.Identifier as Guid?
};
}
}
}
Loading
Loading