1. We are not accepting any new account registrations at this time.

User role and authority definitions

Discussion in 'News, Freeware, Open Source and Discussions' started by SadiSerdari, Dec 21, 2018.

  1. SadiSerdari

    SadiSerdari Registered User

    Joined:
    Sep 23, 2017
    Messages:
    6
    Likes Received:
    4
    I am trying to develop a c # desktop application. What I want to do is provide users access to forms according to their authorization and roles, and define, add, update, delete, or monitor access. I can determine the roles and powers on enum and get the results according to the information from the database. But I couldn't put the idea of how to reflect it on forms and buttons. Waiting for help and suggestions. Thanks.
     
  2. computerjin

    computerjin is a Trusted Warez Postercomputerjin Board Translator DEV Guild Reverser Translator

    Joined:
    Feb 14, 2008
    Messages:
    525
    Likes Received:
    10,705
    I can give you a hint to start relating UI Resources to User Roles for proper Access. You can use any OR/M tool with Entity Framework to code your logic for user authentication & authorization.

    [​IMG]
     
    4 people like this.
  3. SadiSerdari

    SadiSerdari Registered User

    Joined:
    Sep 23, 2017
    Messages:
    6
    Likes Received:
    4
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
    I'm saving it to the user rights table according to the rights types in the table above.
    [​IMG]
    [​IMG]
    I did not create a relationship between tables. I couldn't figure out how to go under authenticated where the second image was.
     
    Last edited: Dec 22, 2018
  4. Ak

    AkeB0N0 Registered User

    Joined:
    Jun 15, 2008
    Messages:
    300
    Likes Received:
    4,305
    If I am not mistaken, in this way, you can specify maximum 64 roles is because of the system architecture (64 bit OS). Also, in this way, you can generate forms on demand. Therefore, there will be many if-else block in your code. I understood what you want to do but I have no idea how you can do.

    Controls Based Security in a Windows Forms Application
    Code:
    https://www.red-gate.com/simple-talk/dotnet/windows-forms/controls-based-security-in-a-windows-forms-application/
    Visual Guard Express Edition
    Code:
    https://www.visual-guard.com/EN/net-powerbuilder-application-security-authentication-permission-access-control-rbac/visual-guard-express-edition-form.html
     
    Last edited: Dec 22, 2018
    1 person likes this.
  5. li

    limevanilla Registered User

    Joined:
    Jul 28, 2017
    Messages:
    7
    Likes Received:
    7
    Wow.. this is something good. I'm just using database table "usertype" and put code in my registration winform only. Didn't know about this.
     
  6. Ak

    AkeB0N0 Registered User

    Joined:
    Jun 15, 2008
    Messages:
    300
    Likes Received:
    4,305
  7. t3

    t304pk Registered User

    Joined:
    Jul 30, 2010
    Messages:
    257
    Likes Received:
    3,124
    What I used to do, when I was novice, is I assigned ObjectID's to forms (on their Tag property) and AccessLevels to controls on them (on their Tags again). Then on load of each form, the code checked the access level for the ObjectID for the form and enabled controls with access level less than or equal to the value assigned to the user for that ObjectID.
    Those apps are still running for the clients, but I don't provide support for them anymore :).