Using an expression in a condition of a security action

Estimated reading: 2 minutes 307 views

  • #Permission: AVGIPermission object containing the permission for which the security action
    is executed. You can access to the value of a permission argument by using the syntax:
    #Permission[‘myarg’].
  • #EventArgs: This variable references the arguments passed to the
    event that raises the security action. This variable is available only when the
    security action is raised for a specific event. The type of this variable depends
    of the type of the event handler used to handles the event. For example, when
    you create an action raised on the ‘Validating’ event of a textbox, the type of
    the #EventArgs variable will be ‘CancelEventArgs’
    since the type of the event is ‘CancelEventHandler’.
  • #UserId: A string value containing the Visual Guard repository
    Id of the user for which the action is executed.
  • #UserName: A string value containing the name of the user
    for which the action is executed.
  • #Principal: A VGIPrincipal object containing the principal for which the action is executed.
    You can use this variable to check whether the user is authenticated or not (#Principal.Identity.IsAuthenticated)
    or if the current user is member of a specific role (#Principal.IsInRole(‘administrator’)).


Evaluation of the expression


Error on expression at design time


Examples of expression

_btnDelete.Enabled and _txbCountry.Text == 'USA'

!#EventArgs.Cancel