This discussion is archived
3 Replies Latest reply: Nov 21, 2012 12:15 PM by Dmitriy Kolasnikov RSS

Controlling Visibility and Security: <SecurityProfile> Evaluators

HaiatTyson Newbie
Currently Being Moderated
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
Get
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 Pro
    Currently Being Moderated
    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
    HaiatTyson Newbie
    Currently Being Moderated
    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 Explorer
    Currently Being Moderated
    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>(); }
            }

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points