public ActionResult Details(string id) { UserGroup ug = _factory.CreateUserGroupDao().Get(id); IList <User> users = _factory.CreateUserDao().GetUsers(ug); return(View(new UserGroupDetailInfor(ug, users))); }
/// <summary> /// </summary> /// <param name="daoFactory"></param> /// <returns></returns> public bool Send(IMemberShipFactory daoFactory) { if (daoFactory == null) { throw new ArgumentNullException("daoFactory"); } if (String.IsNullOrEmpty(Id)) { throw new ArgumentException("Id", "Id is empty"); } User myUsers = daoFactory.CreateUserDao().Get(Id); if (myUsers == null) { throw new ArgumentException("Id", String.Format("can not find any use with id={0}", Id)); } EmailVerifier token = myUsers.Contact.VerifyEmail(30, daoFactory); var deleage = new CreateVariablesHandler(user => new Dictionary <string, string> { { "name", user.Name }, { "parameters", token.CreateQueryString() } }); OrnamentContext.Configuration.MessagesConfig.VerifyEmailAddress.Publish(daoFactory, deleage, myUsers); daoFactory.CreateUserDao().SaveOrUpdate(myUsers); return(true); }
public IEnumerable <object> Match([FromUri] UserSearch search) { if (OrnamentContext.MemberShip.HasRight("User", UserOperator.Read)) { search = search ?? new UserSearch(); int total; IList <User> result = _factory.CreateUserDao() .Search(search, 0, 15, out total); return(from user in result select new { id = user.Id, name = user.Name, email = user.Contact.Email, loginId = user.LoginId }); } return(new object[] { new { id = Resources.alertMsg_PermissionNotPermintAccessUsers, name = Resources.alertMsg_PermissionNotPermintAccessUsers, email = Resources.alertMsg_PermissionNotPermintAccessUsers, loginId = Resources.alertMsg_PermissionNotPermintAccessUsers } }); }
public JsonResult NotDuplicate(string loginId, string id) { if (loginId == null) { throw new ArgumentNullException("loginId"); } loginId = Request.QueryString[0]; return(Json(_memberShipFactory.CreateUserDao().Count(loginId, id) == 0, JsonRequestBehavior.AllowGet)); }
public User Save(IMemberShipFactory memberShipFactory) { if (memberShipFactory == null) throw new ArgumentNullException("memberShipFactory"); User user = memberShipFactory.CreateUserDao().Get(Id); UpdateOn(user); Permissions.UpdateOn(user); memberShipFactory.CreateUserDao().SaveOrUpdate(user); SessionManager.GetSessionWrapper().CurrentSession.SaveOrUpdate(user.Contact); if (VerifyEmail && EmailHasChanged) { SendVerifyEmail(user, memberShipFactory); } return user; }
/// <summary> /// /// </summary> /// <param name="id">Product's Id</param> /// <returns></returns> public ActionResult Create(int id) { var performers = new List <IPerformer>(); performers.AddRange(_memberShipFactory.CreateUserDao().GetAll()); performers.AddRange(_memberShipFactory.CreateUserGroupDao().GetAll()); ViewData["performers"] = performers; var v = new ProjectModel { Product = _dao.ProductDao.Get(id) }; return(View(v)); }
public User Save(IMemberShipFactory memberShipFactory) { if (memberShipFactory == null) { throw new ArgumentNullException("memberShipFactory"); } User user = memberShipFactory.CreateUserDao().Get(Id); UpdateOn(user); Permissions.UpdateOn(user); memberShipFactory.CreateUserDao().SaveOrUpdate(user); SessionManager.GetSessionWrapper().CurrentSession.SaveOrUpdate(user.Contact); if (VerifyEmail && EmailHasChanged) { SendVerifyEmail(user, memberShipFactory); } return(user); }
public ActionResult Details(string id) { IOrgDao orgDao = _factory.CreateOrgDao(); Org org = orgDao.Get(id); IList <User> users = _factory.CreateUserDao().GetUsers(org); ViewData["ParentOrg"] = org.Parent; return(View(new OrgDetailsModel(org, users))); }
/// <summary> /// </summary> /// <param name="daoFactory"></param> public RetrievePasswordResult Retrieve(IMemberShipFactory daoFactory) { User user = daoFactory.CreateUserDao().GetByLoginId(AccountOrEmail) ?? daoFactory.CreateUserDao().GetUserByEmail(AccountOrEmail); if (user == null) { return RetrievePasswordResult.NotExistAccountOrEmail; } EmailVerifier emailToken = user.Security.ResetPassword(daoFactory, 50); var direct = new Dictionary<string, string> { {"name", user.Name}, {"loginId", user.LoginId}, {"parameters", emailToken.CreateQueryString()} }; OrnamentContext.Configuration.MessagesConfig.RetrivePassword.Publish(daoFactory, direct, user); return RetrievePasswordResult.Success; }
/// <summary> /// </summary> /// <param name="daoFactory"></param> public RetrievePasswordResult Retrieve(IMemberShipFactory daoFactory) { User user = daoFactory.CreateUserDao().GetByLoginId(AccountOrEmail) ?? daoFactory.CreateUserDao().GetUserByEmail(AccountOrEmail); if (user == null) { return(RetrievePasswordResult.NotExistAccountOrEmail); } EmailVerifier emailToken = user.Security.ResetPassword(daoFactory, 50); var direct = new Dictionary <string, string> { { "name", user.Name }, { "loginId", user.LoginId }, { "parameters", emailToken.CreateQueryString() } }; OrnamentContext.Configuration.MessagesConfig.RetrivePassword.Publish(daoFactory, direct, user); return(RetrievePasswordResult.Success); }
/// <summary> /// </summary> /// <param name="token"></param> /// <param name="daoFactory"></param> /// <returns></returns> /// <exception cref="EmailSecurityTimeoutException">User Token is Timeout</exception> public virtual VerifyResult Verify(string token, IMemberShipFactory daoFactory) { VerifyResult re = Verify(token); if (re == VerifyResult.Success) { this.Account.Contact.EmailVerified = true; daoFactory.CreateUserDao().SaveOrUpdate(this.Account); } daoFactory.CreateEmailVerifierDao().SaveOrUpdate(this); return(re); }
/// <summary> /// </summary> /// <param name="daoFactory"></param> /// <returns></returns> public bool Send(IMemberShipFactory daoFactory) { if (daoFactory == null) throw new ArgumentNullException("daoFactory"); if (String.IsNullOrEmpty(Id)) throw new ArgumentException("Id", "Id is empty"); User myUsers = daoFactory.CreateUserDao().Get(Id); if (myUsers == null) { throw new ArgumentException("Id", String.Format("can not find any use with id={0}", Id)); } EmailVerifier token = myUsers.Contact.VerifyEmail(30, daoFactory); var deleage = new CreateVariablesHandler(user => new Dictionary<string, string> { {"name", user.Name}, {"parameters", token.CreateQueryString()} }); OrnamentContext.Configuration.MessagesConfig.VerifyEmailAddress.Publish(daoFactory, deleage, myUsers); daoFactory.CreateUserDao().SaveOrUpdate(myUsers); return true; }
public object Execute(IMemberShipFactory factory) { IUserDao dao = factory.CreateUserDao(); for (int i = 0; i < Ids.Length; i++) { string id = Ids[i]; User user = dao.Load(id); user.IsDeny = IsDeny; dao.SaveOrUpdate(user); } return new {success = true}; }
public object Execute(IMemberShipFactory factory) { IUserDao dao = factory.CreateUserDao(); for (int i = 0; i < Ids.Length; i++) { string id = Ids[i]; User user = dao.Load(id); user.IsDeny = IsDeny; dao.SaveOrUpdate(user); } return(new { success = true }); }
public VerifyResult Save(IMemberShipFactory factory) { EmailVerifier userToken = factory.CreateEmailVerifierDao().Get(Id); if (userToken == null) { return VerifyResult.NotFoundTokenId; } if (userToken.Verify(TokenId, factory) == VerifyResult.Success) { userToken.Account.Security.ChangePassword(PasswordModel.NewPassword); factory.CreateUserDao().Update(userToken.Account); return VerifyResult.Success; } return VerifyResult.Failed; }
public VerifyResult Save(IMemberShipFactory factory) { EmailVerifier userToken = factory.CreateEmailVerifierDao().Get(Id); if (userToken == null) { return(VerifyResult.NotFoundTokenId); } if (userToken.Verify(TokenId, factory) == VerifyResult.Success) { userToken.Account.Security.ChangePassword(PasswordModel.NewPassword); factory.CreateUserDao().Update(userToken.Account); return(VerifyResult.Success); } return(VerifyResult.Failed); }
// PUT api/friends/5 public void Put(string userId, [FromBody] string @group) { FriendGroup friendGroup = _dao.CreateFriendGroupDao().GetByName(@group); User user = _dao.CreateUserDao().Get(userId); if (friendGroup == null) { friendGroup = new FriendGroup { Name = @group } } ; friendGroup.Friends.Add(new Friend(user)); }
/// <summary> /// </summary> /// <param name="loginUser"></param> /// <param name="token"></param> /// <param name="daoFactory"></param> /// <returns></returns> public VerifyResult Verify(User loginUser, string token, IMemberShipFactory daoFactory) { if (loginUser != _emailVerifier.Account) { return(VerifyResult.Failed); } if (_emailVerifier.Type == VerifyType.Email && _emailVerifier.Verify(token, daoFactory) == VerifyResult.Success) { daoFactory.CreateUserDao().SaveOrUpdate(loginUser); return(VerifyResult.Success); } return(VerifyResult.Failed); }
public object Execute(IMemberShipFactory factory) { IUserDao dao = factory.CreateUserDao(); for (int i = 0; i < Ids.Length; i++) { string id = Ids[i]; User user = dao.Get(id); if (!Lockout) { user.Security.Unlock(); } else { user.Security.Lockout(); } } return new {success = true}; }
public object Execute(IMemberShipFactory factory) { IUserDao dao = factory.CreateUserDao(); for (int i = 0; i < Ids.Length; i++) { string id = Ids[i]; User user = dao.Get(id); if (!Lockout) { user.Security.Unlock(); } else { user.Security.Lockout(); } } return(new { success = true }); }
/// <summary> /// Create a user and send a active email to user. /// </summary> public bool Create(IMemberShipFactory dao, out string errorMessage) { errorMessage = null; var createUser = new User(LoginId, Password); UpdateOn(createUser); //Check duplicate account. IUserDao userDao = dao.CreateUserDao(); User user = userDao.GetByLoginId(createUser.LoginId); if (user != null) { errorMessage = "Duplciate login Id."; return false; } userDao.SaveOrUpdate(createUser); userDao.Flush(); if (this.VerifyEmail) { SendVerifyEmail(createUser, dao); } return true; }
/// <summary> /// Create a user and send a active email to user. /// </summary> public bool Create(IMemberShipFactory dao, out string errorMessage) { errorMessage = null; var createUser = new User(LoginId, Password); UpdateOn(createUser); //Check duplicate account. IUserDao userDao = dao.CreateUserDao(); User user = userDao.GetByLoginId(createUser.LoginId); if (user != null) { errorMessage = "Duplciate login Id."; return(false); } userDao.SaveOrUpdate(createUser); userDao.Flush(); if (this.VerifyEmail) { SendVerifyEmail(createUser, dao); } return(true); }
public UserController(IMemberShipFactory memberShipFactory) { _memberShipFactory = memberShipFactory; _userDao = _memberShipFactory.CreateUserDao(); }
protected override IList <User> GetInsideUsers(IMemberShipFactory memberShipFactory) { return(memberShipFactory.CreateUserDao().GetUsersInRole(Name)); }
public bool ChangePassword([FromBody] ChangePasswordModel password) { return(password.ChangePassword(OrnamentContext.MemberShip.CurrentUser(), _memberShipFactory.CreateUserDao())); }
public UserController(IMemberShipFactory memberShipFactory) { _memberShipFactory = memberShipFactory; _userDao = _memberShipFactory.CreateUserDao(); }
/// <summary> /// </summary> /// <param name="loginUser"></param> /// <param name="token"></param> /// <param name="daoFactory"></param> /// <returns></returns> public VerifyResult Verify(User loginUser, string token, IMemberShipFactory daoFactory) { if (loginUser != _emailVerifier.Account) { return VerifyResult.Failed; } if (_emailVerifier.Type == VerifyType.Email && _emailVerifier.Verify(token, daoFactory) == VerifyResult.Success) { daoFactory.CreateUserDao().SaveOrUpdate(loginUser); return VerifyResult.Success; } return VerifyResult.Failed; }
protected override IList <User> GetInsideUsers(IMemberShipFactory memberShipFactory) { return(memberShipFactory.CreateUserDao().GetUsers(this.UserGroup)); }