-
-
Notifications
You must be signed in to change notification settings - Fork 197
Description
In the application I need to implement authorization. In this context, I need user information with permissions.
When user navigates in the app, I need to check if the user has permission to do action or to view the related page.
For this goal, I wrote a model class ( authmodel) which stores user permissions and a function named "hasAccess" . Need to use this function in lots of pages. When concerning MVVM pattern, I can not directly use authmodel class in viewmodel classes. So, I need to define wrapper functions which calls the function of authmodel class ( authmodel::hasAccess ). This means that I need to define a function for every page. Lets give an example;
need to check permission of user on Registration Module which is implemented using the following classes;
- RegistrationView,
- RegistrationViewModel,
- RegistrationModel
I need to import authmodel class in RegistrationViewModel class, return the result of "authmodel::hasAccess" and to check the visibility of an item in RegistrationView
For every page, I need to import authmodel and define a new function which checks access.
I just wanna use this function (hasAccess) directly but it does not applicable with mvvm pattern.
Is there any way of accessing user info and check access from every viewmodels I need in a centralized way?
Just wanna use user information in pages I need. In this context, I can not directly use authmodel class due to the fact that it does not applicable with mvvm patern. How to achieve this goal ?