4 Replies Latest reply on Oct 5, 2010 7:41 PM by spilon

    PI Tag Permission/Security using PISDK

    mrai

      HI,

       

      I need to develop a PISDK based app to programmatically set the PI Tag permission via PISDK. Do you have any sample code for this ?

       

       

       

      Thanks in advance

       

      Biju

       

       

        • Re: PI Tag Permission/Security using PISDK

          This should help...

          string sSec = "yourSecurityString"; // e.g. piadmin: A(r,w) | piadmins: A(r,w) | PIWorld: A(r,w)
          myServer.PIPoints["yourTag"].PointAttributes.ReadOnly = false;
          myServer.PIPoints["yourTag"].PointAttributes["datasecurity"].Value = sSec; // datasecurity or ptsecurity

          The "Configuring PI Server Security" manual (available under the vCampus Library) should provide all the information you need on how to set the "datasecurity" and "ptsecurity" point attributes.

            • Re: PI Tag Permission/Security using PISDK
              mrai

              Steve,

               

              Thanks a lot for your quick reply. I will try implementing this with the sample.

               

              Thanks

               

              Biju

              • Re: PI Tag Permission/Security using PISDK
                mrai

                Steve,

                 

                Quick questions:

                 

                1. Doing myServer.PIPoints["yourTag"].PointAttributes["datasecurity"].Value = sSec; wipes out ALL existing default security for the tag. Is there anyway we could preserve existing security, but ONLY apply additional security on top of it ?

                 

                2. Do I need to reset the READONLY attribute to TRUE after I'm done changing the security ?

                 

                -> myServer.PIPoints["yourTag"].PointAttributes.ReadOnly = true;

                  • Re: PI Tag Permission/Security using PISDK

                    You could apply additional security by adding (+=) to the string rather than replacing it (=):
                    (this is pure programming... not related to PI)

                    sSec = " | SomeIdentity: A(r,w)";
                    myServer.PIPoints["yourTag"].PointAttributes["datasecurity"].Value += sSec;

                    Whether you set the ReadOnly property back to true is up to you and depends whether you need to change other point attributes... it would indeed be safer to set it back to true, to avoid inadvertent changes on the PI Point.