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, String, String)

PIDatabaseSecurity.GetSecurityRights Method (String, String, String)

  • Last UpdatedJan 12, 2026
  • 3 minute read
PIDatabaseSecurity.GetSecurityRights Method (String, String, String)
This method convert the legacy Access Permission model (prior to PI 3.4.380) 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 owner,
	string group,
	string accessRules
)
Public Shared Function GetSecurityRights ( 
	owner As String,
	group As String,
	accessRules As String
) As IList(Of KeyValuePair(Of String, AFSecurityRights))

Dim owner As String
Dim group As String
Dim accessRules As String
Dim returnValue As IList(Of KeyValuePair(Of String, AFSecurityRights))

returnValue = PIDatabaseSecurity.GetSecurityRights(owner, 
	group, accessRules)
public:
static IList<KeyValuePair<String^, AFSecurityRights>>^ GetSecurityRights(
	String^ owner, 
	String^ group, 
	String^ accessRules
)
static member GetSecurityRights : 
        owner : string * 
        group : string * 
        accessRules : string -> IList<KeyValuePair<string, AFSecurityRights>> 

Parameters

owner
Type: SystemString
The name of the security owner associated with the returned security rights.
group
Type: SystemString
The name of the security group associated with the returned security rights.
accessRules
Type: SystemString
The access rules for the returned security rights.

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 legacy PIPoint security attribute. Example of owner, group, and accessRules input parameters: Owner: “piadmin”, Group: “piadmin”, Access: “o:rw g:r w:r” This will result into three AFSecurityRights where the keys are: "piadmin" (ReadWrite access), "piadmin" (Read access), and "piworld" (Read 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