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();
- 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?