Exemplo n.º 1
0
        private bool LoginPostValidations(out ActionResult redirectToRoute)
        {
            //if no owner is present show takeownership page
            if (!_accountBusinessLogic.SuperAdminExist())
            {
                redirectToRoute = this.RedirectToRoute(
                    "Default", new { tenancy = Tenants.SuperAdmin, controller = "Account", action = "TakeOwnership" });
                return(true);
            }

            //if user on default tenancy and do not have tenancy show the authentication code page
            var user = this.User as ApplicationUser;

            if (user == null)
            {
                redirectToRoute = this.RedirectToAction("Index", "User");
                return(true);
            }

            if (string.IsNullOrEmpty(user.Tenancy)
                ||
                (user.Tenancy.Equals(Tenants.SuperAdmin, StringComparison.InvariantCultureIgnoreCase)
                 &&
                 !user.IsInRole(_accountBusinessLogic.GetRoleIdByRoleName(Tenants.SuperAdmin, Roles.ApplicationName))))
            {
                redirectToRoute = this.RedirectToAction("AuthenticationInviteCode");
                return(true);
            }

            //if user on current tenancy but do not have TenantOperationsAdmin role and
            //its email has an invitation show the authentication code page
            if (user.Tenancy.Equals(TenantManager.CurrentTenancy, StringComparison.OrdinalIgnoreCase))
            {
                var    invitationLogic = new OwnerInvitationBusinessLogic();
                string code;
                var    hasInvitation = invitationLogic.UserHasInvitation(user.ContactEmail, user.Tenancy, out code);

                if (hasInvitation)
                {
                    redirectToRoute = this.RedirectToRoute(
                        "Default",
                        new
                    {
                        tenancy    = user.Tenancy,
                        controller = "OwnerInvitation",
                        action     = "AcceptInvitation",
                        id         = code
                    });
                    return(true);
                }
            }

            redirectToRoute = null;
            return(false);
        }
Exemplo n.º 2
0
 public UserUILogic()
 {
     _userBusinessLogic            = new UserBusinessLogic();
     _ownerInvitationBusinessLogic = new OwnerInvitationBusinessLogic();
     _tagUILogic = new TagUILogic();
 }