disabling modifications from GUI

EugeneEugene Member Posts: 309
i was asked to disable modifications (inserts and deletes included) to the table from user interface (i named it GUI here) and allow changes to be made only from the programming code ( in reports codeunits etc).

I have heard one could utilize CurrfieldNo variable to distinguish between two . Is it correct ? Is this method used ? I find it to be a bad idea and would prefer to use set-access functions in table object and disable any modifications by deafault - whoever wants to modify the table will have to use set-access functions.

Comments

  • KonradKonrad Member Posts: 30
    How about taking away insert and modify permissions on the tables from users and give them to the navision objects (using permission properties)?
  • girish.joshigirish.joshi Member Posts: 407
    The most standard way would be leveraging Navision various ways of addressing security (what's on the menu, and permissions).

    Only give users indirect access to tables.

    Very strange request though. Are you creating some sort of archive for your users?
  • kinekine Member Posts: 12,562
    There are the ways how you can do that. Select the most appropriate for your situation:

    1) Modify all forms working with the table and set EDITABLE to no (or property AllowInsert, AllowDelete, AllowModify) - it is working for all users and it means the SUPER user is not allowed to change the data through forms too

    2) Assign just indirect permissions to the users for insert/delete/modify and add permissions into the object properties of the codeunit/report which are changing the data. - you can set the permissions just for some set of users and allow others to edit what they want

    3) Make a special set of forms for the limited users and use way no. 1 for them. But you need to do changes everywhere the forms are called...

    For me the way 2 looks like best one... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • babbab Member Posts: 65
    It could be a solution, to add a global boolean variable to the table (ModifyAllowed), and a function, to set the value of this variable (SetModifyAllowed). After you can add code to OnInsert, OnDelete, OnModify triggers, to test this value.
    From GUI, users could not set this variable, but you can do it with the SetModifyAllowed function.
    The other solution could be, to add an ERROR('') to the OnInsert, etc. triggers, and from CAL you can call INSERT(FALSE), but it only works, if you have no necessary funcions implented in these triggers.
  • EugeneEugene Member Posts: 309
    sorry, i forgot to mention that the data access should be read-only or read/write based on the values of the certain fields.
  • kinekine Member Posts: 12,562
    Than you need to add code to each form or into OnModify etc. but you need to make difference between calling from code and by user by setting some flag in code...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.