Table's Modify Permission from Code

logu_cbelogu_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


  • AlbertvhAlbertvh Member Posts: 516
    Hi Loganathan

    From Help
    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).


    Hope this helps
  • logu_cbelogu_cbe Member Posts: 54
    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?

    Loganathan S
  • AlbertvhAlbertvh Member Posts: 516
    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 this
    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
          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;

    Haven't tested this but hope it gives you a start. :wink:
Sign In or Register to comment.