Implementing a suspension or penalty system for users in ASP.NET MVC

I am writing a site in ASP.NET MVC that will have user accounts. Since the site will be discussion oriented, I think I need a system for administrators to be able to moderate users, as here in Stack Overflow. I would like to be able to put the user in a β€œsuspension” so that they can log in to the site (at this moment they come across a message such as β€œYour account was suspended before [DATE]”), but they cannot perform functions that users can usually perform .

What is the best way to implement this?

I was thinking of creating a Suspended role, but the fact is that I have several different roles for regular users, with different privileges.

Have you ever developed such a feature before? How am I supposed to do this? Thanks in advance.

+5
source share
3 answers

, , , , , " ". , , , , , .

, WellGroomedAndBehavesSelf, , .

web.config ReinstateDate ( UngroundedOnDate;-D).

, WellGroomedAndBehavesSelf ReinstateDate.

OnAuthenticate ReinstateDate, , WellGroomedAndBehavesSelf.

.

UPDATE: , , , , - , , WellGroomedAndBehavesSelf , , ReinstateDate. , WellGroomedAndBehavesSelf.

, .

:

- Site, . p >

- , .

+2

, - , .

Active, . , .

, , . Simples.

+3

, , , .

: , , , , , -. , DateTime "" , DateTime.MinValue . , "", suspendedUntil .

DateTime suspendedUntil = DateTime.MinValue;

, , , suspendedUntil DateTime.Now. suspendedUntil DateTime.Now, , . . , , suspendedUntil, DateTime.Now.

bool userIsSuspended = suspendedUntil > DateTime.Now;

DateTime suspendedUntil.ToBinary() "" DateTime.FromBinary(long).

+2

All Articles