Security to push button in Vendor Card

souravb
Member Posts: 135
Hi,
I was trying to use authorization in a way that people who dont have the SUPER role will not be allowed to calculate the vendor score in the Cal Score pushbutton of Vendor menu item. I wrote a code like this:
GVMemberOf = Record of Member Of Table
GVMemberOf.SETRANGE(GVMemberOf."User ID",USERID);
IF GVMemberOf.FIND('-') THEN
GVMemberOf.SETFILTER(GVMemberOf."Role ID",'<>SUPER');
IF GVMemberOf.FIND('-') THEN
ERROR('ABCD');
CalcRoutineCall.
But the code doesn't have any effect. Plz help me how to do it.
I was trying to use authorization in a way that people who dont have the SUPER role will not be allowed to calculate the vendor score in the Cal Score pushbutton of Vendor menu item. I wrote a code like this:
GVMemberOf = Record of Member Of Table
GVMemberOf.SETRANGE(GVMemberOf."User ID",USERID);
IF GVMemberOf.FIND('-') THEN
GVMemberOf.SETFILTER(GVMemberOf."Role ID",'<>SUPER');
IF GVMemberOf.FIND('-') THEN
ERROR('ABCD');
CalcRoutineCall.
But the code doesn't have any effect. Plz help me how to do it.
0
Comments
-
Try this:
GVMemberOf.SETRANGE(GVMemberOf."User ID",USERID); GVMemberOf.SETRANGE(GVMemberOf."Role ID",'SUPER'); IF NOT(GVMemberOf.FINDFIRST) THEN ERROR('ABCD');
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Hi,
Don't forget to filter by the Company Name though.
Rgds,
Jon.Rgds,
Jon.0 -
Hi,
and if you are using windows authentication don't forget the Windows Access Control table either...
I mean you can create a function HasRole(RoleName: Code[20]): Boolean like this:MemberOf.RESET; MemberOf.SETRANGE("User ID", UPPERCASE(USERID)); MemberOf.SETRANGE("Role Name", RoleName); IF MemberOf.FINDFIRST THEN EXIT(TRUE); WinAccControl.RESET; WinAccControl.SETRANGE("Role ID", RoleName); WinAccControl.SETFILTER("Login ID", '*\' + USERID); EXIT(WinAccControl.FINDFIRST);
0 -
And if you are using Windows authentication, do not forget to search for all AD groups which is the user member of. :-) Using windows authentication correctly is not easy...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions