Answer the question
In order to leave comments, you need to log in
Is there a pattern for implementing a user upgrade on the site?
There is a site where a person can register and leave an ad.
There are paid and free accounts. Free - you can only write text. Paid - you can add a picture to the ad, the ad will get an orange frame, and the title will be highlighted in bold.
It is necessary to consider easy enabling and disabling of a paid account. Enabled - all ads of the user have the above-mentioned buns. Turned off - everything turned off.
Is there any pattern, how to correctly implement it?
Answer the question
In order to leave comments, you need to log in
If I understand you correctly
https://en.wikipedia.org/wiki/Role-based_access_control
You want complex behavior, and patterns don't describe it. Roughly speaking, patterns don't even describe real-world processes - they describe concise definitions of entities, from which you can already assemble complex processes based on the layout.
But you can google Permission-Based auth.
In principle, this is, in part, the dependency tree that xmoonlight
is talking about.
Most often it is applied to authorization, but it can also be transferred to your case without any problems
Modification of the role dependency tree (this is called)
is used both with adjectives (properties) and with verbs (manipulators)
If the "user" role does not have a "dependency tree", then there are no cartoons)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question