3 Replies Latest reply on Nov 21, 2012 8:15 PM by Dmitriy Kolasnikov-Oracle

    Controlling Visibility and Security: <SecurityProfile> Evaluators

    Hai Ha
      We have a custom button called PrintViewButton located at the Action Navigation. We want to apply some security around that button. I'm creating a new CustomSecurityEvaluator class. Below is example code per Oracle documentation. I have two questions.

      1. What dll or dlls do I need to reference so my class can access the following
      Imports Xeno.Web.UI.Common.Controls.ObjectHeader
      Imports Xeno.Web.UI.Providers.Security

      2. Do you have a C# example?

      Example code per documentation:

      Step 2. Create a plugin named MyEvaluator and compile.

      Imports Xeno.Prodika.Application
      Imports Xeno.Prodika.Services
      Imports Xeno.Web.UI.Common.Controls.ObjectHeader
      Imports Xeno.Web.UI.Providers.Security

      Public Class MyEvaluator : Implements ICustomSecurityEvaluator
      Private ReadOnly Property SpecService() As ISpecificationService
      Return AppPlatformHelper.ServiceManager(Constants.GetInstance().SPECIFICATION_SERVICE)
      End Get
      End Property

      Public Function Evaluate() As Boolean Implements ICustomSecurityEvaluator.Evaluate
      If (SpecService.Current Is Nothing) Then
      Return False
      End If
      //<Your codes here>
      Return //<Your result here>
      End Function
      End Class

      Edited by: Hai at Tyson on Oct 29, 2012 2:51 PM
        • 1. Re: Controlling Visibility and Security: <SecurityProfile> Evaluators
          Ron M-Oracle
          You will need to use the XenoWebControls.dll assembly when implementing a CustomSecurityEvaluator class.

          I do not think you need the ObjectHeader import, so I would take that import out:
          Imports Xeno.Web.UI.Common.Controls.ObjectHeader

          We do not yet have a C# reference implementation, but you can easily convert that code through some online utilities.
          Also, remember that the PLM4PExtensionUtils has some useful classes you can leverage, such as the SpecWorkflowTagEvaluator.IsSpecInWorkflowStatusByTagID method.
          • 2. Re: Controlling Visibility and Security: <SecurityProfile> Evaluators
            Hai Ha
            thanks. so here's my plugin in C#. what dll do i need to reference to have access to Constants?

            example code:

            using Xeno.Prodika.Application;
            using Xeno.Prodika.Services;
            //using Xeno.Web.UI.Common.Controls.ObjectHeader;
            using Xeno.Web.UI.Providers.Security;

            namespace Tyson.Pdm.SecurityEvaluatorPlugins.Lib
            public class PrintViewButtonPlugin : ICustomSecurityEvaluator
            private static ISpecificationService SpecService
            get { return AppPlatformHelper.ServiceManager(Constants.GetInstance().SPECIFICATION_SERVICE); }

            public bool Evaluate()
            if (SpecService.Current == null)
            return false;

            //<Your codes here>
            //Return //<Your result here>

            throw new System.NotImplementedException();
            • 3. Re: Controlling Visibility and Security: <SecurityProfile> Evaluators
              Dmitriy Kolasnikov-Oracle
              Constants class is located ing GSMWebUI.dll, but using it would be difficult.
              I would suggest to get to the service in the following manner (I assume you've already referenced GSMLib dll as that is where SpecificationService is located).
                      private static ISpecificationService SpecService
                          get { return AppPlatformHelper.ServiceManager.GetServiceByType<ISpecificationService>(); }
              1 person found this helpful