/// <summary> /// Authorisation de l'utilisateur et affectation des variables users /// </summary> /// <param name="myuser"></param> protected void LocalAuthorizeUser(DataInvoice.SOLUTIONS.GENERAL.IDENTITY.USER.LocalUser myuser) { try { // on valide l'utilisateur (controles de bases) if (!myuser.IsAuthenticated) { throw new Exception("Utilisateur non authentifié"); } if (!myuser.IsInRole("STANDARD")) { throw new Exception("Utilisateur non admis"); } //this.UserDatas = new UserDataCache(myuser); // autres (obsolete) this.Session["myuser"] = myuser; this.Session["myUserId"] = myuser.UserId; //this.Session["myidentity"] = this.UserDatas.MySyndic.IDCEntity; } catch (Exception) { throw; } }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (httpContext.Session["myuser"] == null) { return(false); } DataInvoice.SOLUTIONS.GENERAL.IDENTITY.USER.LocalUser myuser = (DataInvoice.SOLUTIONS.GENERAL.IDENTITY.USER.LocalUser)httpContext.Session["myuser"]; if (!myuser.IsAuthenticated) { return(false); } if (!myuser.IsInRole("STANDARD")) { return(false); } return(base.AuthorizeCore(httpContext)); }