Changeset 7612
- Timestamp:
- 03/13/12 17:28:04 (13 years ago)
- Location:
- branches/ClientUserManagement
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/UserViews/ChangePasswordDialog.cs
r7611 r7612 46 46 MessageBox.Show("Couldn't fetch user information from the server." + Environment.NewLine + "Please verify that you have an existing user and that your user name and password is correct. ", "HeuristicLab Access Service", MessageBoxButtons.OK, MessageBoxIcon.Error); 47 47 } else { 48 bool result = AccessClient.CallAccessService<bool>(x => x. ResetPassword(UserInformation.Instance.User.Id, oldPasswordTextBox.Text, newPasswordTextBox.Text));48 bool result = AccessClient.CallAccessService<bool>(x => x.ChangePassword(UserInformation.Instance.User.Id, oldPasswordTextBox.Text, newPasswordTextBox.Text)); 49 49 if (result) { 50 50 MessageBox.Show("Password change successfull.", "HeuristicLab Access Service", MessageBoxButtons.OK, MessageBoxIcon.Information); -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ServiceClients/AccessServiceClient.cs
r7611 r7612 11 11 namespace HeuristicLab.Clients.Access { 12 12 13 14 [System.Diagnostics.DebuggerStepThroughAttribute()]15 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]16 [System.Runtime.Serialization.DataContractAttribute(Name = "UserGroupBase", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" +17 "")]18 [System.SerializableAttribute()]19 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroup))]20 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.User))]21 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))]22 public partial class UserGroupBase : HeuristicLab.Clients.Access.AccessItem {23 24 [System.Runtime.Serialization.OptionalFieldAttribute()]25 private System.Guid IdField;26 27 [System.Runtime.Serialization.DataMemberAttribute()]28 public System.Guid Id {29 get {30 return this.IdField;31 }32 set {33 if ((this.IdField.Equals(value) != true)) {34 this.IdField = value;35 this.RaisePropertyChanged("Id");36 }37 }38 }39 }40 13 41 14 [System.Diagnostics.DebuggerStepThroughAttribute()] … … 73 46 74 47 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 48 49 75 50 } 76 51 … … 680 655 this.TimestampField = value; 681 656 this.RaisePropertyChanged("Timestamp"); 657 } 658 } 659 } 660 } 661 662 [System.Diagnostics.DebuggerStepThroughAttribute()] 663 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 664 [System.Runtime.Serialization.DataContractAttribute(Name = "UserGroupBase", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Access.DataTransfer" + 665 "")] 666 [System.SerializableAttribute()] 667 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.UserGroup))] 668 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.User))] 669 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Access.LightweightUser))] 670 public partial class UserGroupBase : HeuristicLab.Clients.Access.AccessItem { 671 672 [System.Runtime.Serialization.OptionalFieldAttribute()] 673 private System.Guid IdField; 674 675 [System.Runtime.Serialization.DataMemberAttribute()] 676 public System.Guid Id { 677 get { 678 return this.IdField; 679 } 680 set { 681 if ((this.IdField.Equals(value) != true)) { 682 this.IdField = value; 683 this.RaisePropertyChanged("Id"); 682 684 } 683 685 } … … 1059 1061 public interface IAccessService { 1060 1062 1063 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/RemoveUserGroupBaseFromGroup", ReplyAction = "http://tempuri.org/IAccessService/RemoveUserGroupBaseFromGroupResponse")] 1064 void RemoveUserGroupBaseFromGroup(HeuristicLab.Clients.Access.UserGroupBase resource, HeuristicLab.Clients.Access.UserGroup group); 1065 1061 1066 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/GetUsersAndGroups", ReplyAction = "http://tempuri.org/IAccessService/GetUsersAndGroupsResponse")] 1062 1067 System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroupBase> GetUsersAndGroups(); … … 1200 1205 void RemoveUserFromRole(HeuristicLab.Clients.Access.Role role, HeuristicLab.Clients.Access.User user); 1201 1206 1207 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/ChangePassword", ReplyAction = "http://tempuri.org/IAccessService/ChangePasswordResponse")] 1208 bool ChangePassword(System.Guid userId, string oldPassword, string newPassword); 1209 1202 1210 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/ResetPassword", ReplyAction = "http://tempuri.org/IAccessService/ResetPasswordResponse")] 1203 bool ResetPassword(System.Guid userId, string oldPassword, string newPassword);1211 string ResetPassword(System.Guid userId); 1204 1212 1205 1213 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/GetAllUserGroups", ReplyAction = "http://tempuri.org/IAccessService/GetAllUserGroupsResponse")] … … 1223 1231 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/AddUserGroupBaseToGroup", ReplyAction = "http://tempuri.org/IAccessService/AddUserGroupBaseToGroupResponse")] 1224 1232 void AddUserGroupBaseToGroup(HeuristicLab.Clients.Access.UserGroupBase resource, HeuristicLab.Clients.Access.UserGroup group); 1225 1226 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IAccessService/RemoveUserGroupBaseFromGroup", ReplyAction = "http://tempuri.org/IAccessService/RemoveUserGroupBaseFromGroupResponse")]1227 void RemoveUserGroupBaseFromGroup(HeuristicLab.Clients.Access.UserGroupBase resource, HeuristicLab.Clients.Access.UserGroup group);1228 1233 } 1229 1234 … … 1255 1260 } 1256 1261 1262 public void RemoveUserGroupBaseFromGroup(HeuristicLab.Clients.Access.UserGroupBase resource, HeuristicLab.Clients.Access.UserGroup group) { 1263 base.Channel.RemoveUserGroupBaseFromGroup(resource, group); 1264 } 1265 1257 1266 public System.Collections.Generic.List<HeuristicLab.Clients.Access.UserGroupBase> GetUsersAndGroups() { 1258 1267 return base.Channel.GetUsersAndGroups(); … … 1443 1452 } 1444 1453 1445 public bool ResetPassword(System.Guid userId, string oldPassword, string newPassword) { 1446 return base.Channel.ResetPassword(userId, oldPassword, newPassword); 1454 public bool ChangePassword(System.Guid userId, string oldPassword, string newPassword) { 1455 return base.Channel.ChangePassword(userId, oldPassword, newPassword); 1456 } 1457 1458 public string ResetPassword(System.Guid userId) { 1459 return base.Channel.ResetPassword(userId); 1447 1460 } 1448 1461 … … 1474 1487 base.Channel.AddUserGroupBaseToGroup(resource, group); 1475 1488 } 1476 1477 public void RemoveUserGroupBaseFromGroup(HeuristicLab.Clients.Access.UserGroupBase resource, HeuristicLab.Clients.Access.UserGroup group) {1478 base.Channel.RemoveUserGroupBaseFromGroup(resource, group);1479 }1480 1489 } 1481 1490 } -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r7611 r7612 36 36 private IUserManager UserManager { 37 37 get { 38 if (userManager == null) userManager = new UserManager();38 if (userManager == null) userManager = AccessServiceLocator.Instance.UserManager; 39 39 return userManager; 40 40 } … … 44 44 private IRoleVerifier RoleVerifier { 45 45 get { 46 if (roleVerifier == null) roleVerifier = new RoleVerifier();46 if (roleVerifier == null) roleVerifier = AccessServiceLocator.Instance.RoleVerifier; 47 47 return roleVerifier; 48 48 } … … 143 143 144 144 public void DeleteClient(DT.Client client) { 145 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 146 145 147 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 146 148 //load client because we could get a detached object … … 198 200 199 201 public void DeleteClientGroup(DT.ClientGroup clientGroup) { 202 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 203 200 204 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 201 205 //load clientGroup because we could get a detached object … … 289 293 290 294 public void DeleteClientLog(DT.ClientLog log) { 295 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 296 291 297 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 292 298 context.ClientLogs.DeleteOnSubmit(Convert.ToEntity(log)); … … 484 490 485 491 public DT.User AddUser(DT.User user) { 492 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 493 486 494 DA.User accessUser; 487 495 DA.aspnet_User aspUser; … … 529 537 530 538 public void DeleteUser(DT.User user) { 539 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 540 531 541 if (user.Id != null && user.Id != Guid.Empty) { 532 542 //delete asp.net user … … 551 561 552 562 public void UpdateUser(DT.User user) { 563 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 564 553 565 AddUser(user); 554 566 } 555 567 556 568 public void AddUserToRole(DT.Role role, DT.User user) { 569 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 570 557 571 //TODO: usernames and rolenames have to be unique! 558 572 MembershipUser msUser = Membership.GetUser((object)user.Id); … … 563 577 564 578 public void RemoveUserFromRole(DT.Role role, DT.User user) { 579 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 580 565 581 MembershipUser msUser = Membership.GetUser((object)user.Id); 566 582 if (msUser != null) { … … 569 585 } 570 586 571 public bool ResetPassword(Guid userId, string oldPassword, string newPassword) {587 public bool ChangePassword(Guid userId, string oldPassword, string newPassword) { 572 588 MembershipUser msUser = Membership.GetUser(userId); 573 589 if (msUser != null) { … … 575 591 } 576 592 return false; 593 } 594 595 public string ResetPassword(Guid userId) { 596 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 597 598 MembershipUser msUser = Membership.GetUser(userId); 599 if (msUser != null) { 600 return msUser.ResetPassword(); 601 } else { 602 throw new Exception("Password reset failed."); 603 } 577 604 } 578 605 #endregion … … 626 653 627 654 public void DeleteUserGroup(DT.UserGroup group) { 655 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 656 628 657 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 629 658 context.UserGroupBases.DeleteOnSubmit(Convert.ToEntity(group)); … … 733 762 734 763 public DT.Role AddRole(DT.Role role) { 764 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 765 735 766 Roles.CreateRole(role.Name); 736 767 return role; … … 738 769 739 770 public void DeleteRole(DT.Role role) { 771 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 772 740 773 Roles.DeleteRole(role.Name); 741 774 } … … 767 800 768 801 public void RemoveRoleFromGroup(DT.UserGroup userGroup, DT.Role role) { 802 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 803 769 804 Guid[] userIds; 770 805 string[] aspUsers; … … 795 830 796 831 public IEnumerable<DT.ClientError> GetClientErrors() { 832 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 833 797 834 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 798 835 var query = from c in context.ClientErrors … … 803 840 804 841 public IEnumerable<DT.ClientError> GetLastClientErrors(DateTime startDate) { 842 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 843 805 844 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 806 845 var query = from c in context.ClientErrors … … 812 851 813 852 public void DeleteError(DT.ClientError error) { 853 roleVerifier.AuthenticateForAllRoles(AccessServiceRoles.Administrator); 854 814 855 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 815 856 var query = context.ClientErrors.Where(x => x.Id == error.Id); -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/IAccessService.cs
r7611 r7612 104 104 105 105 #region User 106 //TODO: i don't think this method is needed107 106 [OperationContract] 108 107 LightweightUser Login(); … … 142 141 143 142 [OperationContract] 144 bool ResetPassword(Guid userId, string oldPassword, string newPassword); 143 bool ChangePassword(Guid userId, string oldPassword, string newPassword); 144 145 [OperationContract] 146 string ResetPassword(Guid userId); 145 147 #endregion 146 148
Note: See TracChangeset
for help on using the changeset viewer.