Programmatically determine if user linked to a role

ireneg
Member Posts: 30
Hi there
Navision security: I need to determine if a user is linked to a specific role. Is there a command that can do this?
Thanks
Navision security: I need to determine if a user is linked to a specific role. Is there a command that can do this?
Thanks
Irene Grassow
0
Answers
-
Hi
Do a lookup to the "Member Of" table 20000000030 -
Hi
You could use the "Member of" (2000000003) table and set a range on the user and role id to see if the user exist for that role.
Hope this helps
Albert0 -
It is not so easy, because you need to count with two cases:
DB User
Windows User
and the second one means that you can be member of group which is member of the role... ;-)IsMemberOf(UserIDVal : Code[20];RoleID : Code[20]) : Boolean Var MemberOf : Record 2000000003 begin IF MemberOf.GET(UserIDVal,RoleID) THEN EXIT(TRUE); EXIT(IsWinMemberOf(UserIDVal,RoleID)); end; IsWinMemberOf(UserIDVal : Code[20];RoleID : Code[20]) : Boolean Var Domain : Record 2000000056 WinMemberOf : Record 2000000053 begin IF Domain.FIND('-') THEN REPEAT IF WinMemberOf.GET(Domain.SID,RoleID,'') THEN EXIT(TRUE); UNTIL Domain.NEXT=0; EXIT(FALSE); end;
You can use the IsMemberOf function with UserID and RoleID to detect if the user is member of the role, BUT this function works correctly only if the UserID is the ID of the logged in user or ID of some Database User. If you enter ID of another windows user, it will not work correctly, because the virtual tables used in IsWinMemberOf are filled just with records for the logged in Windows User.0 -
Check also this one : http://www.mibuso.com/forum/viewtopic.php?t=10695Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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