Security Groups

GetSecurityGroupNames

  • The GetSecurityGroupNames Function returns a list of the Security Groups.
  • Returns Empty String Array if service is not reachable.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonGetSecurityGroupNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurityGroupNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetSecurityGroupNames.Items.Clear()
        Dim Groups() As String
        Dim Group As String
        Dim ErrorString As String = ""
        Groups = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityGroupNames(TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each Group In Groups
                ComboBoxGetSecurityGroupNames.Items.Add(Group)
            Next
            If ComboBoxGetSecurityGroupNames.Items.Count > 0 Then
                ComboBoxGetSecurityGroupNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
 
     Private Sub ComboBoxGetSecurityGroupNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetSecurityGroupNames.SelectedIndexChanged
        TextBoxSecurityGroup.Text = ComboBoxGetSecurityGroupNames.SelectedItem
    End Sub

C#

	      private void ButtonGetSecurityGroupNames_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetSecurityGroupNames.Items.Clear();
                     string[] Groups = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string Group = null;
                     string ErrorString = "";
                     Groups = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityGroupNames(TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (string Group in Groups)
                           {
                                  ComboBoxGetSecurityGroupNames.Items.Add(Group);
                           }
                           if (ComboBoxGetSecurityGroupNames.Items.Count > 0)
                           {
                                  ComboBoxGetSecurityGroupNames.SelectedIndex = 0;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }
 
              private void ComboBoxGetSecurityGroupNames_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxSecurityGroup.Text = ComboBoxGetSecurityGroupNames.SelectedItem.ToString();
              }

AddSecurityGroup

  • The AddSecurityGroup Function adds a Security Group to the existing Security configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the Group already exists or adding the Group failed.
  • Group is the name of the Group to add.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonAddSecurityGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddSecurityGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddSecurityGroup(TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelAddSecurityGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelAddSecurityGroupResult.Text = "Group successfully added."
        Else
            LabelAddSecurityGroupResult.Text = ErrorString
        End If
    End Sub
 

C#

	      private void ButtonAddSecurityGroup_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddSecurityGroup(TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelAddSecurityGroupResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelAddSecurityGroupResult.Text = "Group successfully added.";
                     }
                     else
                     {
                           LabelAddSecurityGroupResult.Text = ErrorString;
                     }
              }

GetSecurityParameterStrings

  • The RemoveSecurityGroup Function removes a Security Group from the existing Security configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the Group does not exist or removing the Group failed.
  • Group is the name of the Group to remove.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonRemoveSecurityGroup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRemoveSecurityGroup.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveSecurityGroup(TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelRemoveSecurityGroupResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelRemoveSecurityGroupResult.Text = "Group successfully removed."
        Else
            LabelRemoveSecurityGroupResult.Text = ErrorString
        End If
    End Sub
 

C#

	    

GetSecurityParameterStrings

  • The GetSecurityParameterStrings Function returns an array of Strings containing all property types available for each Security Group.
  • Returns Empty String Array if service is not reachable.
  • Returns a String Array of property types for all possible Parameters for a Security Group.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.

VB

    Private Sub ButtonGetSecurityParameterStrings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurityParameterStrings.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetSecurityParameterStrings.Items.Clear()
        Dim Parameters() As String
        Dim Parameter As String
        Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityParameterStrings(TextBoxNetworkNode.Text)
        For Each Parameter In Parameters
            ComboBoxGetSecurityParameterStrings.Items.Add(Parameter)
        Next
        If ComboBoxGetSecurityParameterStrings.Items.Count > 0 Then
            ComboBoxGetSecurityParameterStrings.SelectedIndex = 1
        End If
    End Sub
     Private Sub ComboBoxGetSecurityParameterStrings_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetSecurityParameterStrings.SelectedIndexChanged
        TextBoxParameter.Text = ComboBoxGetSecurityParameterStrings.SelectedItem
    End Sub

C#

	     private void ButtonGetSecurityParameterStrings_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetSecurityParameterStrings.Items.Clear();
                     string[] Parameters = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string Parameter = null;
                     Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityParameterStrings(TextBoxNetworkNode.Text);
                     foreach (string Parameter in Parameters)
                     {
                           ComboBoxGetSecurityParameterStrings.Items.Add(Parameter);
                     }
                     if (ComboBoxGetSecurityParameterStrings.Items.Count > 0)
                     {
                           ComboBoxGetSecurityParameterStrings.SelectedIndex = 1;
                     }
              }
 
              private void ComboBoxGetSecurityParameterStrings_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxParameter.Text = ComboBoxGetSecurityParameterStrings.SelectedItem.ToString();
              }

GetSecurity_Parameter_Value

  • The GetSecurity_Parameter_Value Function returns an object value for the Security Group and Parameter specified.
  • Returns nothing if service is not reachable.
  • Parameter is a String of the Parameter Type desired of the Security Group.
  • Group is a String of the Security Group desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonGetSecurity_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurity_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultObject As Object
        Dim ErrorString As String = ""
        ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetSecurity_Parameter_Value(TextBoxParameter.Text, TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            Try
                LabelGetSecurity_Parameter_ValueResult.Text = ResultObject
                TextBoxValueToSet.Text = ResultObject
            Catch ex As Exception
                LabelGetSecurity_Parameter_ValueResult.Text = "Error converting value to string."
                TextBoxValueToSet.Text = ""
            End Try
        Else
            LabelGetSecurity_Parameter_ValueResult.Text = ErrorString
            TextBoxValueToSet.Text = ""
        End If
    End Sub

C#

	       private void ButtonGetSecurity_Parameter_Value_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     object ResultObject = null;
                     string ErrorString = "";
                     ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetSecurity_Parameter_Value(TextBoxParameter.Text, TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           try
                           {
                                  LabelGetSecurity_Parameter_ValueResult.Text = ResultObject.ToString();
                                  TextBoxValueToSet.Text = ResultObject.ToString();
                           }
                           catch (Exception ex)
                           {
                                  LabelGetSecurity_Parameter_ValueResult.Text = "Error converting value to string.";
                                  TextBoxValueToSet.Text = "";
                           }
                     }
                     else
                     {
                           LabelGetSecurity_Parameter_ValueResult.Text = ErrorString;
                           TextBoxValueToSet.Text = "";
                     }
              }

GetSecurity_Parameter_Values

  • The GetSecurity_Parameter_Values Function returns an array of object values for the Security Group specified.
  • The order of the array corresponds with the GetSecurityParameterStrings Function order.
  • Returns empty array if service is not reachable.
  • Group is a String of the Security Group desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonGetSecurity_Parameter_Values_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurity_Parameter_Values.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetSecurity_Parameter_Values.Items.Clear()
        Dim ResultObjects() As Object
        Dim ResultObject As Object
        Dim ResultString As String
        Dim ErrorString As String = ""
        ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetSecurity_Parameter_Values(TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each ResultObject In ResultObjects
                Try
                    If ResultObject Is Nothing Then
                        ResultString = ""
                    Else
                        ResultString = ResultObject
                    End If
                    ComboBoxGetSecurity_Parameter_Values.Items.Add(ResultString)
                Catch ex As Exception
                    ComboBoxGetSecurity_Parameter_Values.Items.Add("Error Converting Object")
                End Try
            Next
            If ComboBoxGetSecurity_Parameter_Values.Items.Count > 0 Then
                ComboBoxGetSecurity_Parameter_Values.SelectedIndex = 1
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

	     private void ButtonGetSecurity_Parameter_Values_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetSecurity_Parameter_Values.Items.Clear();
                     object[] ResultObjects = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   object ResultObject = null;
                     string ResultString = null;
                     string ErrorString = "";
                     ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetSecurity_Parameter_Values(TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (object ResultObject in ResultObjects)
                           {
                                  try
                                  {
                                         if (ResultObject == null)
                                         {
                                                ResultString = "";
                                         }
                                         else
                                         {
                                                ResultString = ResultObject.ToString();
                                         }
                                         ComboBoxGetSecurity_Parameter_Values.Items.Add(ResultString);
                                  }
                                  catch (Exception ex)
                                  {
                                         ComboBoxGetSecurity_Parameter_Values.Items.Add("Error Converting Object");
                                  }
                           }
                           if (ComboBoxGetSecurity_Parameter_Values.Items.Count > 0)
                           {
                                  ComboBoxGetSecurity_Parameter_Values.SelectedIndex = 1;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }

SetSecurity_Parameter_Value

  • The SetSecurity_Parameter_Value Function sets an object value for the Security Group and Parameter specified.
  • Returns -1 if service is not reachable.
  • Returns 0 if the Group does not exist or the value did not get set correctly.
  • Returns 1 if the function was successful.
  • Parameter is a String of the Parameter Type desired of the Security Group.
  • Value is the desired value to set.
  • Group is a String of the Security Group desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonSetSecurity_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSetSecurity_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetSecurity_Parameter_Value(TextBoxParameter.Text, TextBoxValueToSet.Text, TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelSetSecurity_Parameter_ValueResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelSetSecurity_Parameter_ValueResult.Text = "Parameter Successfully Updated."
        Else
            LabelSetSecurity_Parameter_ValueResult.Text = ErrorString
        End If
    End Sub

C#

	       private void ButtonSetSecurity_Parameter_Value_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetSecurity_Parameter_Value(TextBoxParameter.Text, TextBoxValueToSet.Text, TextBoxSecurityGroup.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelSetSecurity_Parameter_ValueResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelSetSecurity_Parameter_ValueResult.Text = "Parameter Successfully Updated.";
                     }
                     else
                     {
                           LabelSetSecurity_Parameter_ValueResult.Text = ErrorString;
                     }
              }
 

GetSecurityUserNames

  • The GetSecurityUserNames Function returns a list of the Security User Names.
  • Returns Empty String Array if service is not reachable.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub GetSecurityUserNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurityUserNames.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetSecurityUserNames.Items.Clear()
        Dim Users() As String
        Dim User As String
        Dim ErrorString As String = ""
        Users = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUserNames(TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each User In Users
                ComboBoxGetSecurityUserNames.Items.Add(User)
            Next
            If ComboBoxGetSecurityUserNames.Items.Count > 0 Then
                ComboBoxGetSecurityUserNames.SelectedIndex = 0
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub
     Private Sub ComboBoxGetSecurityUserNames_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetSecurityUserNames.SelectedIndexChanged
        TextBoxSecurityUserName.Text = ComboBoxGetSecurityUserNames.SelectedItem
    End Sub

C#

	      private void GetSecurityUserNames_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetSecurityUserNames.Items.Clear();
                     string[] Users = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string User = null;
                     string ErrorString = "";
                     Users = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUserNames(TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (string User in Users)
                           {
                                  ComboBoxGetSecurityUserNames.Items.Add(User);
                           }
                           if (ComboBoxGetSecurityUserNames.Items.Count > 0)
                           {
                                  ComboBoxGetSecurityUserNames.SelectedIndex = 0;
                           }
                     }
                     else
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }
 
              private void ComboBoxGetSecurityUserNames_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxSecurityUserName.Text = ComboBoxGetSecurityUserNames.SelectedItem.ToString();
              }

AddSecurityUser

  • The AddSecurityUser Function adds a Security User to the existing Security configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the User already exists or adding the User failed.
  • UserName is the name of the User to add.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonAddSecurityUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAddSecurityUser.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddSecurityUser(TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelAddSecurityUserResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelAddSecurityUserResult.Text = "User successfully added."
        Else
            LabelAddSecurityUserResult.Text = ErrorString
        End If
    End Sub

C#

	      private void ButtonAddSecurityUser_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.AddSecurityUser(TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelAddSecurityUserResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelAddSecurityUserResult.Text = "User successfully added.";
                     }
                     else
                     {
                           LabelAddSecurityUserResult.Text = ErrorString;
                     }
              }

RemoveSecurityUser

  • The RemoveSecurityUser Function removes a Security User from the existing Security configuration.
  • Returns -1 if service is not reachable.
  • Returns 1 if successful.
  • Returns 0 if the User does not exist or removing the User failed.
  • UserName is the name of the User to remove.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonRemoveSecurityUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRemoveSecurityUser.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveSecurityUser(TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelRemoveSecurityUserResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelRemoveSecurityUserResult.Text = "User successfully removed."
        Else
            LabelRemoveSecurityUserResult.Text = ErrorString
        End If
    End Sub

C#

	      private void ButtonRemoveSecurityUser_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.RemoveSecurityUser(TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelRemoveSecurityUserResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelRemoveSecurityUserResult.Text = "User successfully removed.";
                     }
                     else
                     {
                           LabelRemoveSecurityUserResult.Text = ErrorString;
                     }
              }

GetSecurityUserParameterStrings

  • The GetSecurityUserParameterStrings Function returns an array of Strings containing all property types available for each Security User.
  • Returns Empty String Array if service is not reachable.
  • Returns a String Array of property types for all possible Parameters for a Security User.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.

VB

    Private Sub ButtonGetSecurityUserParameterStrings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurityUserParameterStrings.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetSecurityUserParameterStrings.Items.Clear()
        Dim Parameters() As String
        Dim Parameter As String
        Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUserParameterStrings(TextBoxNetworkNode.Text)
        For Each Parameter In Parameters
            ComboBoxGetSecurityUserParameterStrings.Items.Add(Parameter)
        Next
        If ComboBoxGetSecurityUserParameterStrings.Items.Count > 0 Then
            ComboBoxGetSecurityUserParameterStrings.SelectedIndex = 1
        End If
    End Sub
 
     Private Sub ComboBoxGetSecurityUserParameterStrings_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxGetSecurityUserParameterStrings.SelectedIndexChanged
        TextBoxUserParameter.Text = ComboBoxGetSecurityUserParameterStrings.SelectedItem
    End Sub

C#

	     private void ButtonGetSecurityUserParameterStrings_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetSecurityUserParameterStrings.Items.Clear();
                     string[] Parameters = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   string Parameter = null;
                     Parameters = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUserParameterStrings(TextBoxNetworkNode.Text);
                     foreach (string Parameter in Parameters)
                     {
                           ComboBoxGetSecurityUserParameterStrings.Items.Add(Parameter);
                     }
                     if (ComboBoxGetSecurityUserParameterStrings.Items.Count > 0)
                     {
                           ComboBoxGetSecurityUserParameterStrings.SelectedIndex = 1;
                     }
              }
 
              private void ComboBoxGetSecurityUserParameterStrings_SelectedIndexChanged(object sender, System.EventArgs e)
              {
                     TextBoxUserParameter.Text = ComboBoxGetSecurityUserParameterStrings.SelectedItem.ToString();
              }

GetSecurityUser_Parameter_Value

  • The GetSecurityUser_Parameter_Value Function returns an object value for the Security User and Parameter specified.
  • Returns nothing if service is not reachable.
  • Parameter is a String of the Parameter Type desired of the Security User.
  • UserName is a String of the Security User desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonGetSecurityUser_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurityUser_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultObject As Object
        Dim ErrorString As String = ""
        ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUser_Parameter_Value(TextBoxUserParameter.Text, TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            Try
                LabelGetSecurityUser_Parameter_ValueResult.Text = ResultObject
                TextBoxUserValueToSet.Text = ResultObject
            Catch ex As Exception
                LabelGetSecurityUser_Parameter_ValueResult.Text = "Error converting value to string."
                TextBoxUserValueToSet.Text = ""
            End Try
        Else
            LabelGetSecurityUser_Parameter_ValueResult.Text = ErrorString
            TextBoxUserValueToSet.Text = ""
        End If
    End Sub

C#

	      private void ButtonGetSecurityUser_Parameter_Value_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     object ResultObject = null;
                     string ErrorString = "";
                     ResultObject = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUser_Parameter_Value(TextBoxUserParameter.Text, TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           try
                           {
                                  LabelGetSecurityUser_Parameter_ValueResult.Text = ResultObject.ToString();
                                  TextBoxUserValueToSet.Text = ResultObject.ToString();
                           }
                           catch (Exception ex)
                           {
                                  LabelGetSecurityUser_Parameter_ValueResult.Text = "Error converting value to string.";
                                  TextBoxUserValueToSet.Text = "";
                           }
                     }
                     else
                     {
                           LabelGetSecurityUser_Parameter_ValueResult.Text = ErrorString;
                           TextBoxUserValueToSet.Text = "";
                     }
              }

GetSecurityUser_Parameter_Values

  • The GetSecurityUser_Parameter_Values Function returns an array of object values for the Security User specified.
  • The order of the array corresponds with the GetSecurityUserParameterStrings Function order.
  • Returns empty array if service is not reachable.
  • UserName is a String of the Security User desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonGetSecurityUser_Parameter_Values_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonGetSecurityUser_Parameter_Values.Click
        Cursor.Current = Cursors.WaitCursor
        ComboBoxGetSecurityUser_Parameter_Values.Items.Clear()
        Dim ResultObjects() As Object
        Dim ResultObject As Object
        Dim ResultString As String
        Dim ErrorString As String = ""
        ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUser_Parameter_Values(TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString = "Success" Then
            For Each ResultObject In ResultObjects
                Try
                    If ResultObject Is Nothing Then
                        ResultString = ""
                    Else
                        ResultString = ResultObject
                    End If
                    ComboBoxGetSecurityUser_Parameter_Values.Items.Add(ResultString)
                Catch ex As Exception
                    ComboBoxGetSecurityUser_Parameter_Values.Items.Add("Error Converting Object")
                End Try
            Next
            If ComboBoxGetSecurityUser_Parameter_Values.Items.Count > 0 Then
                ComboBoxGetSecurityUser_Parameter_Values.SelectedIndex = 1
            End If
        Else
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

	      private void ButtonGetSecurityUser_Parameter_Values_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     ComboBoxGetSecurityUser_Parameter_Values.Items.Clear();
                     object[] ResultObjects = null;
//INSTANT C# NOTE: Commented this declaration since looping variables in 'foreach' loops are declared in the 'foreach' header in C#:
//                   object ResultObject = null;
                     string ResultString = null;
                     string ErrorString = "";
                     ResultObjects = ModuleNetworkNode.OPCSystemsComponent1.GetSecurityUser_Parameter_Values(TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString == "Success")
                     {
                           foreach (object ResultObject in ResultObjects)
                           {
                                  try
                                  {
                                         if (ResultObject == null)
                                         {
                                                ResultString = "";
                                         }
                                         else
                                         {
                                                ResultString = ResultObject.ToString();
                                         }
                                         ComboBoxGetSecurityUser_Parameter_Values.Items.Add(ResultString);
                                  }
                                  catch (Exception ex)
                                  {
                                         ComboBoxGetSecurityUser_Parameter_Values.Items.Add("Error Converting Object");
                                  }
                           }
                           if (ComboBoxGetSecurityUser_Parameter_Values.Items.Count > 0)
                           {
                                  ComboBoxGetSecurityUser_Parameter_Values.SelectedIndex = 1;
                           }
                     }
                     else
                     {
                            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }

SetSecurityUser_Parameter_Value

  • The SetSecurityUser_Parameter_Value Function sets an object value for the Security User and Parameter specified.
  • Returns -1 if service is not reachable.
  • Returns 0 if the User does not exist or the value did not get set correctly.
  • Returns 1 if the function was successful.
  • Parameter is a String of the Parameter Type desired of the Security User.
  • Value is the desired value to set.
  • UserName is a String of the Security User desired.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonSetSecurityUser_Parameter_Value_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSetSecurityUser_Parameter_Value.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ResultInt32 As Int32
        Dim ErrorString As String = ""
        ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetSecurityUser_Parameter_Value(TextBoxUserParameter.Text, TextBoxUserValueToSet.Text, TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ErrorString)
        If ResultInt32 = -1 Then
            LabelSetSecurityUser_Parameter_ValueResult.Text = "OAS Service not reached."
        ElseIf ResultInt32 = 1 Then
            LabelSetSecurityUser_Parameter_ValueResult.Text = "Parameter Successfully Updated."
        Else
            LabelSetSecurityUser_Parameter_ValueResult.Text = ErrorString
        End If
    End Sub

C#

	      private void ButtonSetSecurityUser_Parameter_Value_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     Int32 ResultInt32 = 0;
                     string ErrorString = "";
                     ResultInt32 = ModuleNetworkNode.OPCSystemsComponent1.SetSecurityUser_Parameter_Value(TextBoxUserParameter.Text, TextBoxUserValueToSet.Text, TextBoxSecurityUserName.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ResultInt32 == -1)
                     {
                           LabelSetSecurityUser_Parameter_ValueResult.Text = "OAS Service not reached.";
                     }
                     else if (ResultInt32 == 1)
                     {
                           LabelSetSecurityUser_Parameter_ValueResult.Text = "Parameter Successfully Updated.";
                     }
                     else
                     {
                           LabelSetSecurityUser_Parameter_ValueResult.Text = ErrorString;
                     }
              }

SaveSecurityConfiguration

  • The SaveSecurityConfiguration Subroutine saves the current Security configuration to the specified file path.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonSaveSecurityConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSaveSecurityConfiguration.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ErrorString As String = ""
        ModuleNetworkNode.OPCSystemsComponent1.SaveSecurityConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString <> "Success" Then
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

	       private void ButtonSaveSecurityConfiguration_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     string ErrorString = "";
                     ModuleNetworkNode.OPCSystemsComponent1.SaveSecurityConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString != "Success")
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }

LoadSecurityConfiguration

  • The LoadSecurityConfiguration Subroutine saves the current Security configuration to the specified file path.
  • NetworkNode is the name of the network node of the OAS Service to connect to. Leave blank for localhost connection.
  • Optional ErrorString will be set to Success when function is successful and an error message when in error.

VB

    Private Sub ButtonLoadSecurityConfiguration_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLoadSecurityConfiguration.Click
        Cursor.Current = Cursors.WaitCursor
        Dim ErrorString As String = ""
        ModuleNetworkNode.OPCSystemsComponent1.LoadSecurityConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ErrorString)
        If ErrorString <> "Success" Then
            MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End If
    End Sub

C#

	       private void ButtonLoadSecurityConfiguration_Click(object sender, System.EventArgs e)
              {
                     System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
                     string ErrorString = "";
                     ModuleNetworkNode.OPCSystemsComponent1.LoadSecurityConfiguration(TextBoxFilePath.Text, TextBoxNetworkNode.Text, ref ErrorString);
                     if (ErrorString != "Success")
                     {
                           MessageBox.Show(ErrorString, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     }
              }