Permission Control in C # and Windows Form [closed]

0

I would like to create in C # with Windows Forms (basically equal to Windows folder permission), access levels for users, but not as level 1, 2 and 3, but for example:

  • User A can only view a customer record;
  • User B can delete and delete;
  • User C can only view some fields in the client's registry.

What would be the best way to do this?

Thanks for the attention

    
asked by anonymous 08.03.2017 / 00:28

2 answers

1

You should build your application in the "Rule-Based" ( role-based) format.

For this, you can make your forms inherit some specific access control behaviors.

Here you will find a detailed tutorial on how to do this ( in English).

All in all, this tutorial does not reach the field level (forms only). This part you need to implement "on hand" through the Visible property of the components.

Another way to implement is to do access control before opening the form itself. Usually a menu based on data is used in the database and this data can be set whether or not the menu option is displayed.

But still, field-level permissions should be implemented manually.

Setar property Visibile to false can lead to layout problems if you are not using specific layout classes ( containers ) in your form.

If you do not already use it, I advise you to read FlowLayoutPanel and TableLayoutPanel

    
08.03.2017 / 20:00
1

1 - A table in the database with bool fields to store the permission (one field for each item you want to change the permission)
2 - An object on your system to receive permission data from the bank;

3- At system startup at login you should scan the components by setting it in the .enable component or comment.visible the corresponding permission value.

    
08.03.2017 / 19:30