public UserSession(ISession session) { var userName = HttpContext.Current.User.Identity.Name; IsAuthenticated = !string.IsNullOrEmpty(userName); if (IsAuthenticated) { CurrentUser = new UserByUserName { UserName = userName } }
public User Authenticate(string userName, string password) { var user = new UserByUserName { UserName = userName }.Load(session); if (user != null && user.Password.Matches(password)) { return(user); } return(null); }
public void Test() { var user = new UserByUserName { UserName = "******" }.Load(session); var contest = session.CreateCriteria <Contest>().List <Contest>()[0]; rep.CreateOperation("/Xyu/Pizda"); var everyone = rep.CreateUsersGroup("Everyone"); rep.AssociateUserWith(user, everyone); pbs.Allow("/Xyu/Pizda").For(everyone).OnEverything().DefaultLevel().Save(); var xxx = r.IsAllowed(user, contest, "/Xyu/Pizda"); xxx = xxx; return; }