Restrict a user accessing a particular field

ananthanathanananthanathan Member Posts: 20
edited 2004-03-31 in Navision Attain
hi,
I need to know if the following is possible using the SQL server option for Navision Attain
The Sales person incharge should be able to see all the information in a sales order.
But the Data entry operator who enters all the order information should not be allowed to view those price information.
Can this be made possible. Please help.
Thanks in advance.
Anantha
Regards,
Ananthanathan.G

Comments

  • giulio.cipogiulio.cipo Member Posts: 77
    hi,

    a quick solution but with some code is to create a code where the sistem open two differents form for two different user or type of user.

    Another solution is modify the proprierty of control for different user or type of user but not the property "visible" because this property could be change manualy by user.

    I don't know if there are more solution in sql database but in navision db you couldn't give permission to field but only to table.
  • Christian_BuehlChristian_Buehl Member Posts: 145
    I solved it this way:

    Is OnOpenForm
    Groups.SETRANGE(Groups."User ID",USERID);
    Groups.SETRANGE(Groups."Role ID",'SALES');
    IF (Groups.FIND('-') ) OR (userlevel = userlevel::Sales) THEN BEGIN
      CurrForm."Currency Code".visible := false;
      CurrForm."Any_Field_Name".editable := false;
    END;
    

    This must be done in the form. You can set access limits (I've done it with the classic database)
    I can imagine a similar solution set in the "OnValidate Field" or in the "On Modify" section of the table.
  • Timo_LässerTimo_Lässer Member Posts: 481
    Sorry, Christian, but this is not a solution because the user can set this fields visible.
    If you want to do so, you must check the permissions in OnActivate-Trigger of the form too and restrict the users rights so he can't use the "Zoom".
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Christian_BuehlChristian_Buehl Member Posts: 145
    Timoi you are right,
    the visible proberty enables still viewing with the F8-zoom
    I used only the editable property in my code and figured out how to put unneccessary data out of the general view and focus users on the data they need.
    To really protect against unwanted views, you have to do it like you said.
  • bhaganbhagan Member Posts: 25
    What is the code necessary to restrict zoom on a particular form?
    Beth Hagan
  • Timo_LässerTimo_Lässer Member Posts: 481
    You cannot restrict the zoom for a specific form.
    You only can setup whether the user has the permission or not.

    In this case, you must restrict the user permissions so that he cannot show the zoom.
    Furthermore you must ensure by C/AL code that the user doesn't show the specific fields.
    Sample:
    OnActivateForm()
    IF NOT UserSetup."Show Unit Cost" THEN
      CurrForm."Unit Cost".VISIBLE := FALSE;
    
    What happens?
    - The user (who has no permissions to the field "Unit Cost") doesn't see this field.
    - He want to show this field and select it via the Menu.
    - After he returns from the "Select Columns" dialog, he (re)activates the form (That's the behavior of Navision).
    - This form now wants to display the field "Unit Cost".
    - The code in this form hides the field still before the window is updated.
    Result: The field will never appear.


    Note: This is not the same as
    OnActivateForm()
    CurrForm."Unit Cost".VISIBLE := UserSetup."Show Unit Cost";
    
    because the users (with permissions to the field) should be able to hide it (if they want).
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Sign In or Register to comment.