Skip to main content
formatting
Source Link
Malachi
  • 28.7k
  • 11
  • 86
  • 188

My user model has a list called permissionspermissions which holds the permissions of the current user. (eg: CAN_EDIT_ACCOUNT)

LetsLet's say the main form has buttons for every module and we need to enable a button if the user has permissions to access that particular module (eg. btnBankAccountModule should be enabled to access BANK ACCOUNT module if the user has permission). There is a public bool property for every button in the form and in the Load event, OnControlPermission will be fired and LoginPresenter will listen to this event and it will set the properties True or False based on the details provided by the UserPermissionService. (please see ControlPermission() method in the LoginPresenter code)

        var BankAccountPresenter = new BankAccountPresenter(modle, view, dataService, PermissionsService);
        BankAccountPresenter.Show();
  1. Or else is it better to instantiate an new instance of UserPermissionService in the Main form ? Then how should I inject the current user to the permission service?

OR

  • Is it better to instantiate an new instance of UserPermissionService in the Main form ? Then how should I inject the current user to the permission service?

My user model has a list called permissions which holds the permissions of the current user. (eg: CAN_EDIT_ACCOUNT)

Lets say the main form has buttons for every module and we need to enable a button if the user has permissions to access that particular module (eg. btnBankAccountModule should be enabled to access BANK ACCOUNT module if the user has permission). There is a public bool property for every button in the form and in the Load event, OnControlPermission will be fired and LoginPresenter will listen to this event and it will set the properties True or False based on the details provided by the UserPermissionService. (please see ControlPermission() method in the LoginPresenter code)

        var BankAccountPresenter = new BankAccountPresenter(modle, view, dataService, PermissionsService);
        BankAccountPresenter.Show();
  1. Or else is it better to instantiate an new instance of UserPermissionService in the Main form ? Then how should I inject the current user to the permission service?

My user model has a list called permissions which holds the permissions of the current user. (eg: CAN_EDIT_ACCOUNT)

Let's say the main form has buttons for every module and we need to enable a button if the user has permissions to access that particular module (eg. btnBankAccountModule should be enabled to access BANK ACCOUNT module if the user has permission). There is a public bool property for every button in the form and in the Load event, OnControlPermission will be fired and LoginPresenter will listen to this event and it will set the properties True or False based on the details provided by the UserPermissionService. (please see ControlPermission() method in the LoginPresenter code)

    var BankAccountPresenter = new BankAccountPresenter(modle, view, dataService, PermissionsService);
    BankAccountPresenter.Show();

OR

  • Is it better to instantiate an new instance of UserPermissionService in the Main form ? Then how should I inject the current user to the permission service?
Tweeted twitter.com/#!/StackCodeReview/status/515072029444571136
Post Reopened by CAD, chillworld, Mathieu Guindon, BenVlodgi, BeetDemGuise
Post Closed as "Not suitable for this site" by RubberDuck, Alex L, rolfl
No need to shout bro!
Source Link
Marc-Andre
  • 6.7k
  • 5
  • 38
  • 65

NOTENote : I AM NOT FAMILIAR WITHam not familiar with IOC, so I'd appreciate if you could give an other explanation which would go inline with my current work?

NOTE : I AM NOT FAMILIAR WITH IOC so I'd appreciate if you could give an other explanation which would go inline with my current work?

Note : I am not familiar with IOC, so I'd appreciate if you could give an other explanation which would go inline with my current work?

edited tags
Link
Mathieu Guindon
  • 75.1k
  • 18
  • 191
  • 463
added 5 characters in body
Source Link
Malachi
  • 28.7k
  • 11
  • 86
  • 188
Loading
Source Link
CAD
  • 1.8k
  • 6
  • 25
  • 38
Loading