Esempio n. 1
0
        public bool SuspendUser(bool suspend, Enumerations.SuspendedReasonEnumeration?reason, bool callerIsAdmin)
        {
            bool result = true;

            if (suspend)
            {
                this.ClientStatusId = Enumerations.GetClientStatusId(Enumerations.ClientStatusEnumeration.SUSPENDED);

                if (reason.HasValue)
                {
                    this.ReasonForSuspensionId = Enumerations.GetSuspendedReasonId(reason.Value);
                }
            }
            else
            {
                //Remove suspension?  Check if the user can remove their own suspension
                if (this.IsSuspended() && this.ReasonForSuspensionId == Enumerations.GetSuspendedReasonId(Enumerations.SuspendedReasonEnumeration.AdminSuspendedUserOnlyAdminCanReactive) && callerIsAdmin == false)
                {
                    //The user is trying to resume themselves, but they have SPECIFICALLY been suspended by an administrator
                    //Only an admin can resume their usage.
                    result = false;
                }
                else
                {
                    if (!this.PriorStatusId.isNullOrEmpty())
                    {
                        this.ClientStatusId = this.PriorStatusId;
                    }
                    else
                    {
                        this.ClientStatusId = Enumerations.GetClientStatusId(Enumerations.ClientStatusEnumeration.PREREGISTERED);
                    }

                    this.ReasonForSuspensionId = null;
                }
            }

            return(result);
        }
Esempio n. 2
0
 public bool IsSuspended()
 {
     return(this.ClientStatusId == Enumerations.GetClientStatusId(Enumerations.ClientStatusEnumeration.SUSPENDED));
 }