Set permissions for individual fields of a table

redknightredknight Member Posts: 16
I'm building a form where the user selects an employee in a lookup form and I would like to link it to the employee table so I don't need to maintain a separate list of employees. But even when I've created a lookup form with 2 fields of the employee table listed, the filter function can be used to guess at the values of other fields in the employee table. I also don't think it's a good idea or good practice to give permission to the employee table to low level employees at all.

Anyone have any alternative solutions for me?

Is there any way to set read permissions on individual fields of a table?

Answers

  • garakgarak Member Posts: 3,263
    no, you have only the permission to read the record (and so all the fields in this record).

    if i understood it correct, you have a new list form with 2 fields (No, Name) to select an employee. But the user haste the possibility to use the table filter (Ctrl+F7) to open the default employee list and then to open the employee card. And here, on the standard list / card, are fields that should not be shown for the user. correct?

    So, if it is so, you can create your own List and Card that is used for F5 / Shift + F5 or you write C/AL code in the onopenform trigger to check if the fields are visible or net based on the permissions, or u define the user permissions instead based on table data to forms, report, table, and so on. <- But this is a lot of and hard work.
    Do you make it right, it works too!
  • redknightredknight Member Posts: 16
    garak,

    Thanks for the response. I have already created my own permissions and if both the employee table and table data permissions are not given, the user cannot access the lookup form.

    The user cannot access the employee card or view the employee table directly, but even access to the filter area (of the 2 field lookup form) allows them to filter by Social Security Number and guess the first number by typing 1*,2*,3*,etc. If a employee is found at 3*, they can type 31*,32*,33*,34*,etc. to guess the second number and so on until they find the entire number.

    Is there any way to eliminate access to this field or deny access to the filter function on a specific form?

    Or, am I stuck with creating a new employee table (for basic, low security information) and if so how should I go about it so it will always have up to date information?
  • SunsetSunset Member Posts: 199
    Not sure if I understand the problem exactly. You need a solution where a person needs to lookup employees, but not have access to any employee values? If so, then I don't think there is any viable solution. Instead you could make a new table the you maintain from the employee table.

    Updates for

    OnInsert
    SecondaryTable.No := Employee.No;
    "Fill in any needed info"
    SecondaryTable.Insert;

    OnModify (for the fields that you want on the secondary table)
    SecondaryTable.get(rec.No);
    "Update needed fields"
    SecondaryTable.Modify;

    OnDelete
    SecondaryTable.get(xrec.No);
    SecondaryTable.delete;
    Don't just take my word for it, test it yourself
  • matttraxmatttrax Member Posts: 2,309
    If you don't want them to filter on SSN, then in the OnAfterGetRecords trigger do this:

    IF rec.GETFILTER(SSN) <> '' THEN BEGIN
    rec.SETRANGE(SSN); //To clear the filter
    MESSAGE('You cannot set a filter on SSN!');
    END;
  • David_SingletonDavid_Singleton Member Posts: 5,479
    redknight wrote:
    I'm building a form where the user selects an employee in a lookup form and I would like to link it to the employee table so I don't need to maintain a separate list of employees. But even when I've created a lookup form with 2 fields of the employee table listed, the filter function can be used to guess at the values of other fields in the employee table. I also don't think it's a good idea or good practice to give permission to the employee table to low level employees at all.

    Anyone have any alternative solutions for me?

    Is there any way to set read permissions on individual fields of a table?

    Take a look at Lanham's field level security. Ask your partner about it.
    David Singleton
  • redknightredknight Member Posts: 16
    Thanks for the replies guys. I think that matttrax's solution will suit my needs the best, but I'll check out "Lanham's field level security" that David mentioned as well. Adding another table was going to be my last ditch effort, but thanks sunset for the well written reply.
  • Yogi1983Yogi1983 Member Posts: 22
    Also take a look at 2-Controlware's Field Security. Ask your partner about it.
Sign In or Register to comment.