コード例 #1
0
        private static string GetSignUpMessage(APPUSER userObj, bool isPlayerUser, bool autoSignUp, string organizationName)
        {
            var result = new System.Text.StringBuilder();

            //result.AppendLine("Dear " + userObj.FIRSTNAME + " " + userObj.LASTNAME);
            //result.AppendLine("<p>Thank you for joining the MyFileIt service! You can now enjoy all the benefits of sharing your documents quickly and easily.</p>");

            if (isPlayerUser)
            {
                result.AppendLine("<p>Thank you for registering.</p>");
            }
            else
            {
                if (autoSignUp)
                {
                    result.AppendLine("<p>You have been registered for MyFile-IT by " + organizationName + "</p>");
                }
                else
                {
                    result.AppendLine("<p>You have been registered for MyFileIT.</p>");
                }
                result.AppendLine("<p>Please click the link to login to your account.</p>");
                result.AppendLine("<p>Your username is: " + userObj.USERNAME + "</p>");
                result.AppendLine("<p>Your password is: " + userObj.PASSWORD + "</p>");
                result.AppendLine("<p>Go to your app store (Apple,Antroid,Windows) and search for “Myfileit” and download and install it.</p>");
                result.AppendLine("<p>My FileIT Website</p>");
                result.AppendLine("<p><a href=\"http://myfileit.com\" >www.myfileit.com</a></p>");
            }
            result.AppendLine("<p>Myfile is powerful tool that allows 24/7/365 access in case of an emergency to you or your children’s important documents. Like Medical forms, membership info, Birth certificates, and permissions forms. These documents can be easily share if necessary.</p>");

            result.AppendLine("<p>Thank You");
            result.AppendLine("<br/>MyFileIt Team");
            result.AppendLine("<br/>" + MyFileItEmailLink + "</p>");

            return(result.ToString());
        }
コード例 #2
0
ファイル: LoginTest.cs プロジェクト: HiepPP/VR
        public void LoginNull()
        {
            APPUSER result = _oraAppUserService.Object.Check(_nulluser, _nullpass);

            Assert.IsNull(result);
        }
コード例 #3
0
ファイル: LoginTest.cs プロジェクト: HiepPP/VR
        public void LoginWrongUser()
        {
            APPUSER result = _oraAppUserService.Object.Check(_wronguser, _wrongpass);

            Assert.IsNull(result);
        }
コード例 #4
0
        public ActionResult Create(APPUSER appuser)
        {
            USERPERMISSION userpermission = db.USERPERMISSIONs.SingleOrDefault(u => u.USERID == appuser.ID);

            if (userpermission == null)
            {
                List <APPUSER>        appusers = new List <APPUSER>();
                List <SelectListItem> listItem = new List <SelectListItem>();
                listItem.Add(new SelectListItem
                {
                    Text  = "Bonder",
                    Value = "Bonder",
                });
                listItem.Add(new SelectListItem
                {
                    Text  = "Operation Admin",
                    Value = "Operation Admin",
                });
                appusers.Add(appuser);
                ViewBag.USERID   = new SelectList(appusers, "ID", "USERNAME");
                ViewBag.ROLENAME = listItem;
                ViewBag.BONDERID = new SelectList(db.BONDERs, "BONDERSLNO", "BONDERNAME");
                ViewBag.EMPLOYID = new SelectList(db.EMPLOYEEs, "EMPLOYEESLNO", "EMPLOYEENAME");
            }
            else
            {
                List <APPUSER> appusers = new List <APPUSER>();
                appusers.Add(appuser);
                List <SelectListItem> listItem = new List <SelectListItem>();
                if (userpermission.ROLENAME.Equals("Bonder"))
                {
                    listItem.Add(new SelectListItem
                    {
                        Text     = "Bonder",
                        Value    = "Bonder",
                        Selected = true,
                    });
                    listItem.Add(new SelectListItem
                    {
                        Text  = "Operation Admin",
                        Value = "Operation Admin"
                    });
                }
                else if (userpermission.ROLENAME.Equals("Operation Admin"))
                {
                    listItem.Add(new SelectListItem
                    {
                        Text  = "Bonder",
                        Value = "Bonder",
                    });
                    listItem.Add(new SelectListItem
                    {
                        Text     = "Operation Admin",
                        Value    = "Operation Admin",
                        Selected = true
                    });
                }
                ViewBag.USERID = new SelectList(appusers, "ID", "USERNAME");
                if (userpermission.BONDER != null)
                {
                    ViewBag.BONDERID = new SelectList(db.BONDERs, "BONDERSLNO", "BONDERNAME", userpermission.BONDER.BONDERNAME);
                }
                else
                {
                    ViewBag.BONDERID = new SelectList(db.BONDERs, "BONDERSLNO", "BONDERNAME");
                }
                if (userpermission.EMPLOYEE != null)
                {
                    ViewBag.EMPLOYID = new SelectList(db.EMPLOYEEs, "EMPLOYEESLNO", "EMPLOYEENAME", userpermission.EMPLOYEE.EMPLOYEENAME);
                }
                else
                {
                    ViewBag.EMPLOYID = new SelectList(db.EMPLOYEEs, "EMPLOYEESLNO", "EMPLOYEENAME");
                }
                ViewBag.ROLENAME = listItem;
                ViewBag.EMPLOYID = new SelectList(db.EMPLOYEEs, "EMPLOYEESLNO", "EMPLOYEENAME");
            }
            return(View());
        }
コード例 #5
0
        public ActionResult Create(USERPERMISSION userpermission, string type = "")
        {
            if (ModelState.IsValid)
            {
                USERPERMISSION userpermissionFound = db.USERPERMISSIONs.SingleOrDefault(u => u.USERID == userpermission.USERID);

                if (userpermissionFound != null)
                {
                    if (userpermission.BONDERID != null)
                    {
                        if (userpermission.ROLENAME == "Bonder")
                        {
                            BONDER bonder = db.BONDERs.SingleOrDefault(u => u.BONDERSLNO == userpermission.BONDERID);
                            userpermission.BONDER = bonder;
                        }
                        else
                        {
                            userpermission.BONDERID = null;
                        }
                    }
                    else if (userpermission.EMPLOYID != null)
                    {
                        EMPLOYEE employee = db.EMPLOYEEs.SingleOrDefault(u => u.EMPLOYEESLNO == userpermission.EMPLOYID);
                        userpermission.EMPLOYEE = employee;
                    }
                    if (userpermissionFound.EMPLOYID == null && userpermission.EMPLOYID != null)
                    {
                        userpermission.BONDER   = null;
                        userpermission.BONDERID = null;
                    }
                    if (userpermissionFound.BONDERID == null && userpermission.BONDERID != null)
                    {
                        userpermission.EMPLOYEE = null;
                        userpermission.EMPLOYID = null;
                    }
                    if (userpermission.USERID > 0)
                    {
                        APPUSER appuser = db.APPUSERs.SingleOrDefault(u => u.ID == userpermission.USERID);
                        userpermission.APPUSER      = appuser;
                        userpermissionFound.APPUSER = appuser;
                    }


                    ((IObjectContextAdapter)db).ObjectContext.Detach(userpermissionFound);
                    USERPERMISSION userpermissionFnd = db.USERPERMISSIONs.Find(userpermissionFound.ID);
                    db.USERPERMISSIONs.Remove(userpermissionFnd);
                    db.SaveChanges();
                    //db.Entry(userpermission).State = EntityState.Modified;
                    if (type.Equals("Operation Admin"))
                    {
                        userpermission.BONDER   = null;
                        userpermission.BONDERID = null;
                    }
                    else if (type.Equals("Bonder"))
                    {
                        userpermission.EMPLOYEE = null;
                        userpermission.EMPLOYID = null;
                    }
                    db.USERPERMISSIONs.Add(userpermission);
                    db.SaveChanges();
                }
                else
                {
                    if (type.Equals("Operation Admin"))
                    {
                        userpermission.BONDER   = null;
                        userpermission.BONDERID = null;
                    }
                    else if (type.Equals("Bonder"))
                    {
                        userpermission.EMPLOYEE = null;
                        userpermission.EMPLOYID = null;
                    }
                    db.USERPERMISSIONs.Add(userpermission);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index", "AppUser", null));
            }

            ViewBag.USERID   = new SelectList(db.APPUSERs, "ID", "USERNAME", userpermission.USERID);
            ViewBag.BONDERID = new SelectList(db.BONDERs, "BONDERSLNO", "BONDERNAME", userpermission.BONDERID);
            ViewBag.EMPLOYID = new SelectList(db.EMPLOYEEs, "EMPLOYEESLNO", "EMPLOYEENAME", userpermission.EMPLOYID);
            return(View(userpermission));
        }
コード例 #6
0
ファイル: CustomAuthorize.cs プロジェクト: nmizan/BMS-MVC
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            string idParam        = "";
            var    descriptor     = filterContext.ActionDescriptor;
            var    actionName     = descriptor.ActionName;
            var    controllerName = descriptor.ControllerDescriptor.ControllerName;

            if (!filterContext.HttpContext.User.Identity.IsAuthenticated)
            {
                //if not logged, it will work as normal Authorize and redirect to the Login
                base.HandleUnauthorizedRequest(filterContext);
                return;
            }
            else if (!this.Roles.Split(',').Select(x => x.Trim()).Distinct().ToArray().Any(filterContext.HttpContext.User.IsInRole))
            {
                // The user is not in any of the listed roles =>
                // show the unauthorized view
                filterContext.Result = filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
            }
            try
            {
                idParam = filterContext.Controller.ValueProvider.GetValue("id").AttemptedValue;
            }
            catch (NullReferenceException ex)
            {
                return;
            }
            int            id;
            string         username     = FormsAuthentication.Decrypt(HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;
            APPUSER        appuser      = db.APPUSERs.SingleOrDefault(u => u.USERNAME.Equals(username, StringComparison.OrdinalIgnoreCase));
            USERPERMISSION loggedinUser = new SessionAttributeRetreival().getStoredUserPermission();

            if (int.TryParse(idParam, out id))
            {
                if (System.Web.HttpContext.Current.User.IsInRole("Bonder"))
                {
                    if (id != appuser.ID && controllerName.Equals("AppUser"))
                    {
                        filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                    }
                    if (controllerName.Equals("ExBond"))
                    {
                        if (loggedinUser == null)
                        {
                            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                        }
                        else
                        {
                            EXBOND exbond = db.EXBONDs.SingleOrDefault(u => u.ID == id);
                            if (exbond != null && exbond.BONDERID != loggedinUser.BONDERID)
                            {
                                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                            }
                        }
                    }
                    if (controllerName.Equals("InBond"))
                    {
                        if (loggedinUser == null)
                        {
                            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                        }
                        else
                        {
                            INBOND inbond = db.INBONDs.SingleOrDefault(u => u.ID == id);
                            if (inbond != null && inbond.BONDERID != loggedinUser.BONDERID)
                            {
                                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                            }
                        }
                    }

                    /*if (controllerName.Equals("Back2BackLC"))
                     * {
                     *  if (loggedinUser == null)
                     *  {
                     *      filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                     *  }
                     *  else
                     *  {
                     *      BACKTOBACKLC back2back = db.BACKTOBACKLCs.SingleOrDefault(u => u.ID == id);
                     *      if (back2back!=null && back2back.BONDERID != loggedinUser.BONDERID)
                     *      {
                     *          filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                     *      }
                     *  }
                     * }*/

                    if (controllerName.Equals("UP"))
                    {
                        if (loggedinUser == null)
                        {
                            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                        }
                    }
                    if (controllerName.Equals("UPRequest"))
                    {
                        if (loggedinUser == null)
                        {
                            filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                        }
                        else
                        {
                            UPREQUEST uprequest = db.UPREQUESTs.SingleOrDefault(u => u.ID == id);
                            if (uprequest != null && uprequest.BONDERID != loggedinUser.BONDERID)
                            {
                                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
 public Form1(APPUSER pUsuario)
 {
     InitializeComponent();
     idUser = pUsuario;
 }
コード例 #8
0
 public frmPrincipal(APPUSER pUsuario)
 {
     InitializeComponent();
     usuario = pUsuario;
 }