Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5068,26 +5068,23 @@ protected override NodeHandle GetManagerHandle(
NodeId nodeId,
IDictionary<NodeId, NodeState> cache)
{
lock (Lock)
// quickly exclude nodes that are not in the namespace.
if (!IsNodeIdInNamespace(nodeId))
{
// quickly exclude nodes that are not in the namespace.
if (!IsNodeIdInNamespace(nodeId))
{
return null;
}

if (!PredefinedNodes.TryGetValue(nodeId, out NodeState node))
{
return null;
}
return null;
}

return new NodeHandle
{
NodeId = nodeId,
Node = node,
Validated = true
};
if (!PredefinedNodes.TryGetValue(nodeId, out NodeState node))
{
return null;
}

return new NodeHandle
{
NodeId = nodeId,
Node = node,
Validated = true
};
}

/// <summary>
Expand Down
15 changes: 0 additions & 15 deletions Libraries/Opc.Ua.Server/Configuration/ConfigurationNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,6 @@

namespace Opc.Ua.Server
{
/// <summary>
/// Privileged identity which can access the system configuration.
/// </summary>
public class SystemConfigurationIdentity : RoleBasedIdentity
{
/// <summary>
/// Create a user identity with the privilege
/// to modify the system configuration.
/// </summary>
/// <param name="identity">The user identity.</param>
public SystemConfigurationIdentity(IUserIdentity identity)
: base(identity, [Role.SecurityAdmin, Role.ConfigureAdmin])
{
}
}

/// <summary>
/// The Server Configuration Node Manager.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* ========================================================================
* Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

#if !NET9_0_OR_GREATER
#endif

Comment on lines +30 to +32
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These preprocessor directives are empty and serve no purpose. Consider removing them or adding the intended conditional compilation code.

Suggested change
#if !NET9_0_OR_GREATER
#endif

Copilot uses AI. Check for mistakes.
namespace Opc.Ua.Server
{
/// <summary>
/// Privileged identity which can access the system configuration.
/// </summary>
public class SystemConfigurationIdentity : RoleBasedIdentity
{
/// <summary>
/// Create a user identity with the privilege
/// to modify the system configuration.
/// </summary>
/// <param name="identity">The user identity.</param>
public SystemConfigurationIdentity(IUserIdentity identity)
: base(identity, [Role.SecurityAdmin, Role.ConfigureAdmin])
{
}
}
}
88 changes: 3 additions & 85 deletions Libraries/Opc.Ua.Server/NodeManager/MasterNodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ public virtual object GetManagerHandle(NodeId nodeId, out INodeManager nodeManag
/// <summary>
/// Returns node handle and its node manager.
/// </summary>
[Obsolete("Use GetManagerHandleAsync instead.")]
public virtual object GetManagerHandle(NodeId nodeId, out IAsyncNodeManager nodeManager)
{
(object handle, IAsyncNodeManager nodeManager) result =
Expand Down Expand Up @@ -706,6 +707,7 @@ public virtual object GetManagerHandle(NodeId nodeId, out IAsyncNodeManager node
/// <summary>
/// Adds the references to the target.
/// </summary>
[Obsolete("Use AddReferencesAsync instead.")]
public virtual void AddReferences(NodeId sourceId, IList<IReference> references)
{
AddReferencesAsync(sourceId, references).AsTask().GetAwaiter().GetResult();
Expand Down Expand Up @@ -890,6 +892,7 @@ public virtual void UnregisterNodes(
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="browsePaths"/> is <c>null</c>.</exception>
/// <exception cref="ServiceResultException"></exception>
[Obsolete("Use TranslateBrowsePathsToNodeIdsAsync instead.")]
public virtual void TranslateBrowsePathsToNodeIds(
OperationContext context,
BrowsePathCollection browsePaths,
Expand Down Expand Up @@ -2545,35 +2548,6 @@ await nodeManager.ConditionRefreshAsync(context, monitoredItems, cancellationTok
}
}

/// <summary>
/// Creates a set of monitored items.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="context"/> is <c>null</c>.</exception>
/// <exception cref="ArgumentOutOfRangeException"></exception>
/// <exception cref="ServiceResultException"></exception>
public virtual void CreateMonitoredItems(
OperationContext context,
uint subscriptionId,
double publishingInterval,
TimestampsToReturn timestampsToReturn,
IList<MonitoredItemCreateRequest> itemsToCreate,
IList<ServiceResult> errors,
IList<MonitoringFilterResult> filterResults,
IList<IMonitoredItem> monitoredItems,
bool createDurable)
{
CreateMonitoredItemsAsync(
context,
subscriptionId,
publishingInterval,
timestampsToReturn,
itemsToCreate,
errors,
filterResults,
monitoredItems,
createDurable).AsTask().GetAwaiter().GetResult();
}

/// <summary>
/// Creates a set of monitored items.
/// </summary>
Expand Down Expand Up @@ -2983,28 +2957,6 @@ await manager.SubscribeToAllEventsAsync(
}
}

/// <summary>
/// Modifies a set of monitored items.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="context"/> is <c>null</c>.</exception>
/// <exception cref="ServiceResultException"></exception>
public virtual void ModifyMonitoredItems(
OperationContext context,
TimestampsToReturn timestampsToReturn,
IList<IMonitoredItem> monitoredItems,
IList<MonitoredItemModifyRequest> itemsToModify,
IList<ServiceResult> errors,
IList<MonitoringFilterResult> filterResults)
{
ModifyMonitoredItemsAsync(
context,
timestampsToReturn,
monitoredItems,
itemsToModify,
errors,
filterResults).AsTask().GetAwaiter().GetResult();
}

/// <summary>
/// Modifies a set of monitored items.
/// </summary>
Expand Down Expand Up @@ -3203,23 +3155,6 @@ await nodeManager.SubscribeToAllEventsAsync(
}
}

/// <summary>
/// Transfers a set of monitored items.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="context"/> is <c>null</c>.</exception>
public virtual void TransferMonitoredItems(
OperationContext context,
bool sendInitialValues,
IList<IMonitoredItem> monitoredItems,
IList<ServiceResult> errors)
{
TransferMonitoredItemsAsync(
context,
sendInitialValues,
monitoredItems,
errors).AsTask().GetAwaiter().GetResult();
}

/// <summary>
/// Transfers a set of monitored items.
/// </summary>
Expand Down Expand Up @@ -3269,23 +3204,6 @@ await nodeManager.TransferMonitoredItemsAsync(
}
}

/// <summary>
/// Deletes a set of monitored items.
/// </summary>
/// <exception cref="ArgumentNullException"><paramref name="context"/> is <c>null</c>.</exception>
public virtual void DeleteMonitoredItems(
OperationContext context,
uint subscriptionId,
IList<IMonitoredItem> itemsToDelete,
IList<ServiceResult> errors)
{
DeleteMonitoredItemsAsync(
context,
subscriptionId,
itemsToDelete,
errors).AsTask().GetAwaiter().GetResult();
}

/// <summary>
/// Deletes a set of monitored items.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion Libraries/Opc.Ua.Server/Server/IServerInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ ValueTask CloseSessionAsync(
/// Deletes the specified subscription.
/// </summary>
/// <param name="subscriptionId">The subscription identifier.</param>
void DeleteSubscription(uint subscriptionId);
/// <param name="cancellationToken">The cancellation token.</param>
ValueTask DeleteSubscriptionAsync(uint subscriptionId, CancellationToken cancellationToken = default);

/// <summary>
/// Called by any component to report a global event.
Expand Down
8 changes: 5 additions & 3 deletions Libraries/Opc.Ua.Server/Server/ServerInternalData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,17 +494,19 @@ public async ValueTask CloseSessionAsync(
{
await NodeManager.SessionClosingAsync(context, sessionId, deleteSubscriptions, cancellationToken)
.ConfigureAwait(false);
SubscriptionManager.SessionClosing(context, sessionId, deleteSubscriptions);
await SubscriptionManager.SessionClosingAsync(context, sessionId, deleteSubscriptions, cancellationToken)
.ConfigureAwait(false);
SessionManager.CloseSession(sessionId);
}

/// <summary>
/// Deletes the specified subscription.
/// </summary>
/// <param name="subscriptionId">The subscription identifier.</param>
public void DeleteSubscription(uint subscriptionId)
/// <param name="cancellationToken">The cancellation token</param>
public async ValueTask DeleteSubscriptionAsync(uint subscriptionId, CancellationToken cancellationToken = default)
{
SubscriptionManager.DeleteSubscription(null, subscriptionId);
await SubscriptionManager.DeleteSubscriptionAsync(null, subscriptionId, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down
Loading
Loading