What are good approaches for handling a large number of permutations in the user interface?

I am looking for some tips on working with the user interface, in particular, with the web interface, where a lot of different settings and switches change what is displayed to the user. Settings are tied to the user, so each user has a unique experience (depending on many factors). The current approach is to use multiple conditional statements; obviously not scalable and makes for a nightmare of service.

I will use the MVC pattern to post problems, but I have to imagine a design pattern or best practice for setting up highly dynamic views.

Based on user credentials, I have:

  • Functions that can be turned on and off
  • Opportunities can be expanded or expanded.
    • Think of a list of flags where one flag is not displayed for one group and the entire list may not be available for other groups. (As a list of options, and the user does not have access to all of them, perhaps some of them are disabled, maybe some of them are invisible.)

The question is: how to keep the presentation as clean as possible while maintaining the context and purpose of the presentation? Am I creating separate โ€œhandlersโ€ that output specific HTML (if they are linked to each other through some authorization provider)? If so, how can I work with functions that are distributed among several groups, but can vary slightly from one to another?

, , , - .


, , ProductViewModel ( #):

public class ProductViewModel {
   public bool DisplayPrice { get; set; }
}

, , Model.DisplayPrice == true, , . , . , - if ( UserInRole("Vendor") || UserInRole("Distributor") ).

, - . if ( UserInRole("Vendor") || UserInRole("Distributor") ), . , , , VIP-, 30 ...

/ ? , "" ?

+3
1

...

, , ACL. , . .

, , , , . , , , , . , , , . , , , , , ...

+1

Source: https://habr.com/ru/post/1761347/


All Articles