I presently have a user logon that has an access level that hides and unhides various procedures depending on a user level field.
Is there a way with which I can have a simple setting to allow a Guest user have the ability to view but not add, change or delete?
Hi Kenns,
on your browse init embed point you can add this code priority 9500
BRW1.Init PROCEDURE
If UserAccessLevel = GuestUser
SELF.InsertControl = 0
SELF.ChangeControl = 0
SELF.DeleteControl = 0
end
You can improve this on an extension template.
HTH
Tuz
What Templates ABC or Legacy?
Did you add a View button on all your Browses? That View button control template requires a View extension on the Form and some configuration to work.
Without a View button I would add code to the Form to spot the Guest User and make it impossible for them to change fields or the file:
- Spot Request of Add or Delete and reject that
- Change the Cancel button to Close
- Disable the OK button and Hide it
- Disable all other buttons, they often do lookups
- Make all controls ReadOnly and Skip
- Ok Accepted and Event Completed check for Guest and reject
- Etc
I would do this on a Global Extension that looks for the Save button, that is what makes it a form.
The Guest extension could look for Browse update buttons and rename Change to View, plus prevent Add or Delete from working.
I’m going to assume ABC, because I don’t remember legacy at this point ![]()
In the form, thisWindow.init there a point high up where the request is set.
You need to set localRequest = ViewRecord The form will do the rest.
As noted above you can create an extension template to do it everywhere.
Thanks for the response. I am having difficulty in determining where I should be looking to locate “thisWindow.init”. I am using ABC, and an looking in the form’s embed points. Is this correct, or should I be looking elsewhere?
Regards, Kenn
@seanh is refering to the ABC Form.
Example Apps: ABCForms.app
Form (Procedure): Form_Discounts
ThisWindow.Init PROCEDURE
ReturnValue BYTE,AUTO
! Start of "WindowManager Method Data Section"
! [Priority 5000]
! End of "WindowManager Method Data Section"
CODE
! Start of "WindowManager Method Executable Code Section"
! [Priority 300]
! Enter procedure scope
GlobalErrors.SetProcedureName('Form_Discounts')
! [Priority 2700]
IF Condition
GlobalRequest = ViewRecord ! See Line 8 in C:\Clarion6\LibSrc\ABFILE.EQU
END
! Snap-shot GlobalRequest
SELF.Request = GlobalRequest ! Store the incoming request
! [Priority 4950]
@Tuz_Mwaura doesnt specify which Browse Init method in the Browse window, theres 3 to choose from.
