Knowledgebase: Managing permissions
Authorization depending on data stored in the db
Posted by Jean-jacques Jouanneaux on 26 August 2010 02:05 PM

How could we define authorization depending on data stored in the db?

You can define a VG Expression or a regular expression that would:

o Execute a VG action if a condition involving a data is successful
For instance: the permission applies if the customer is American
SalesOrder.Customer.Country == 'USA'

o Apply a value to a property calculated with other data in the form
For instance : button cb_2 is visible when button cb_1 is

Other examples:

• Permissions with parameters:
You need to set a maximum amount allowed (in a purchase order for instance).
This limit can rely on a property updated with a VG property action.
In the VG permission, you can set a parameter defining this limit.
Thus, administrators can change the limit anytime and grant different limits
from one role to another.

• Multiple criteria:
You want to disable the modification in a sales order form, if the customer is based in the USA and the product is not shipped yet (the field “shipping date”is empty).
You can define the following condition to disable modifications in the form:

SalesOrder.Customer.Country == 'USA' and
SalesOrder.ShippedDate !=System.DateTime.MinValue

Visual Guard .NET

(0 vote(s))
Not helpful

Comments (0)
Help Desk by Novalys