PIDatabaseSecurity.GetSecurityRights Method (String)
- Last UpdatedJan 12, 2026
- 3 minute read
- PI System
- AF SDK 3.2.0
- Developer
This method parses the SecurityString into a collection of AFSecurityRights where
the key is the name of a PI identity, user, or group.
Namespace: OSIsoft.AF.PI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.2.0.7
Syntax
public static IList<KeyValuePair<string, AFSecurityRights>> GetSecurityRights( string securityString )
Public Shared Function GetSecurityRights ( securityString As String ) As IList(Of KeyValuePair(Of String, AFSecurityRights)) Dim securityString As String Dim returnValue As IList(Of KeyValuePair(Of String, AFSecurityRights)) returnValue = PIDatabaseSecurity.GetSecurityRights(securityString)
public: static IList<KeyValuePair<String^, AFSecurityRights>>^ GetSecurityRights( String^ securityString )
static member GetSecurityRights : securityString : string -> IList<KeyValuePair<string, AFSecurityRights>>
Parameters
- securityString
- Type: SystemString
The security string to be parsed.
Return Value
Type: IListKeyValuePairString, AFSecurityRightsReturns a collection of AFSecurityRights where the key is the name of a PI identity, user, or group.
Remarks
This method can also be used to obtain AFSecurityRights collection from PIPoint security attribute.
Example of securityString input parameter:
“piadmin: A(r,w) | piadmins: A(w) | piworld: A()”
This will result into three AFSecurityRights where the keys are: "piadmin" (ReadWrite access), "piadmins" (Write access), and "piworld" (None access).
Examples
// Get the PIServer PISystems myPISystems = new PISystems(); PISystem myPISystem = myPISystems.DefaultPISystem; PIServer myPIServer = PIServer.FindPIServer(myPISystem, piServerName); // Get SecurityRights from Point Security PIPoint point; if (!PIPoint.TryFindPIPoint(myPIServer, "MyTestPoint#1", out point)) { point = myPIServer.CreatePIPoint("MyTestPoint#1"); } IDictionary<string, object> securityAttributes = null; securityAttributes = point.GetAttributes(PICommonPointAttributes.PointOwner, PICommonPointAttributes.PointGroup, PICommonPointAttributes.PointAccess, PICommonPointAttributes.PointSecurity); IList<KeyValuePair<string, AFSecurityRights>> securityRights; object securityString; //PIServer older than 3.4.380.x does not have ptsecurity attribute. if (securityAttributes.TryGetValue("ptsecurity", out securityString)) { //PIServer is 3.4.380.x or later. //GetSecurityRights through ptsecurity. securityRights = PIDatabaseSecurity.GetSecurityRights(securityString.ToString()); } else { //PIServer is older than 3.4.380.x. //GetSecurityRights through ptowner, ptgroup, and ptaccess. securityRights = PIDatabaseSecurity.GetSecurityRights(securityAttributes["ptowner"].ToString(), securityAttributes["ptgroup"].ToString(), securityAttributes["ptaccess"].ToString()); } //Display the SecurityRights Console.WriteLine(String.Format("SecurityRights for {0} Point Security", point.Name)); foreach (var securityRight in securityRights) { Console.WriteLine(" Identity = {0}, SecurityRight = {1}", securityRight.Key, securityRight.Value); Console.WriteLine(); }