Guarding Access to Buttons Built in ASP Pages

Less than one minute read time.
Imagine that you have created a new page that lists data from either Sage CRM or an external system. It maybe that you have classified your users into two types. The first can only view the data, so the actions buttons should be hidden, but the second user type should be able to access the buttons and to carry out tasks on the data.

One way of accomplishing this would be to add a new field to the user table called user_customright that can have to values 'Y' and 'N'. This means that any button added in the code can be guarded by using

var strButton = eWare.Button("buttontext","buttonimage.gif",eWare.URL("custompage.asp"));
if (eWare.GetContextInfo("user","user_customright")=='Y')
{
myBlock.AddButton(strButton);
}

You can also use standard security rights to guard the buttons.

This example shows the control of buttons display on screen using entity security. The button below is only available for users with insert rights on company entity.

var strNewCompanySecurityButton = eWare.Button("New","newcompany.gif", eWare.Url(1200),"COMPANY","INSERT");