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).
WRITEPERMISSION (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).
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)
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 this
VAR
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.
Comments
From Help
Hope this helps
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 S
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 this
Haven't tested this but hope it gives you a start.