Skip to content

Commit

Permalink
Fixes #1302. Use value from OnReadUserAccessLevel at Read/WriteNonVal…
Browse files Browse the repository at this point in the history
…ueAttribute if handler exists. (#1413)
  • Loading branch information
AlinMoldovean committed May 31, 2021
1 parent afe352c commit 8406716
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Stack/Opc.Ua.Core/Stack/State/BaseVariableState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,11 @@ public override void SetStatusCode(ISystemContext context, StatusCode statusCode
return StatusCodes.BadNotReadable;
}

if ((m_userAccessLevel & AccessLevels.CurrentRead) == 0)
// check the user access level for the variable.
byte userAccessLevel = m_userAccessLevel;
OnReadUserAccessLevel?.Invoke(context, this, ref userAccessLevel);

if ((userAccessLevel & AccessLevels.CurrentRead) == 0)
{
return StatusCodes.BadUserAccessDenied;
}
Expand Down Expand Up @@ -1867,7 +1871,11 @@ public override void SetStatusCode(ISystemContext context, StatusCode statusCode
return StatusCodes.BadNotWritable;
}

if ((m_userAccessLevel & AccessLevels.CurrentWrite) == 0)
// check the user access level for the variable.
byte userAccessLevel = m_userAccessLevel;
OnReadUserAccessLevel?.Invoke(context, this, ref userAccessLevel);

if ((userAccessLevel & AccessLevels.CurrentWrite) == 0)
{
return StatusCodes.BadUserAccessDenied;
}
Expand Down

0 comments on commit 8406716

Please sign in to comment.