Table's Modify Permission from Code

logu_cbe
Member Posts: 54
Hi Everybody,
I would like to know, how i can find (using coding) whether current user having the 'Modify permission' alone for one table record (Say Item Ledger Enteries).
Thanks in Advance,
Loganathan S
I would like to know, how i can find (using coding) whether current user having the 'Modify permission' alone for one table record (Say Item Ledger Enteries).
Thanks in Advance,
Loganathan S
0
Comments
-
Hi Loganathan
From HelpWRITEPERMISSION (Record)
Use this function to find out if you can write to a table. This function can test for both full write permission and a partial write permission that has been granted with a security filter. A write permission consists of Insert, Delete and Modify permissions.
This function uses the filter that is currently applied to the Record to determine whether or not you have write permission. If no filter is applied, the function tests for full write permission. If a filter has been set, the function only tests for write permission within the range of the filter.
To determine whether or not the user has a partial write permission, because a security filter has been applied, use the SETPERMISSIONFILTER (Record) function before testing the permission with WRITEPERMISSION (Record).
Ok := Record.WRITEPERMISSION
Hope this helps0 -
Hi Albertvh,
Thanks for your reply.....
Still i am facing problem...Because WRITEPERMISSION returns True only if it has complete permission. (i.e All permissions Insert, Modify and Delete should set to Yes).
I would like to test for only Modify Permission. Is it any way (pre-defined functions in any code unit) to find the same? (Using Permission Table and user id)
Can you please help me in this regard?
Thanks,
Loganathan S0 -
Hi Loganathan,
Perhaps you will have to write a small codeunit that uses the following tables
2000000003 Member of
2000000005 Permission
Filter Member of by USERID and read through the permission.
Maybe something like thisVAR LFound Type Boolean MembOf Type Record Member of Permission Type Record Permission CheckModify(RecID) : Boolean LFound := FALSE; MembOf.Setrange("User ID",USERID); IF MembOF.FIND('-') THEN REPEAT Permission.SETRANGE("Role ID",MembOf."Role ID"); Permission.SETRANGE("Object Type",Permission."Object Type"::TableData); Permission.SETRANGE("Object ID",RecID); IF Permission.FIND('-') THEN IF (NOT ("Insert Permission") AND ("Delete Permission") AND ("Execute Permission")) AND ("Modify Permission" THEN LFound := TRUE; UNTIL Membof.NEXT = 0; EXIT(LFound);
Haven't tested this but hope it gives you a start.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