Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

PIDatabaseSecurity.GetSecurityRights Method (String)

PIDatabaseSecurity.GetSecurityRights Method (String)

  • Last UpdatedJan 12, 2026
  • 3 minute read
PIDatabaseSecurity.GetSecurityRights Method (String)
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, AFSecurityRights
Returns 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();
}

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6

See Also

In This Topic
TitleResults for “How to create a CRG?”Also Available in