Changeset 4926
- Timestamp:
- 11/24/10 20:37:39 (14 years ago)
- Location:
- branches/UserManagement/HeuristicLab.Services.Authentication
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UserManagement/HeuristicLab.Services.Authentication/AuthenticationService.cs
r4740 r4926 13 13 public class AuthenticationService : IAuthenticationService 14 14 { 15 15 16 #region User 16 17 18 17 19 public DataTransfer.User GetUser(Guid id) 18 20 { 19 21 using (UserManagementDataContext db = new UserManagementDataContext()) 20 22 { 21 var user = db.aspnet_Users.Where(x => x.UserId == id).FirstOrDefault(); 22 var membership = db.aspnet_Memberships.Where(x => x.UserId == id).FirstOrDefault(); 23 24 25 return Convert.ToDataTransfer(user, membership); 26 //Table<aspnet_User> UserTable = db.GetTable<aspnet_User>(); 27 28 //var User = from item in UserTable 29 // where item.UserId == id 30 // select item; 31 //aspnet_User eUser = User.Single(); 32 33 //User user = Convert.ToDataTransfer((aspnet_User)eUser); 34 35 //if (user == null) { return null; } 36 37 //Table<aspnet_Membership> MembershipTable = db.GetTable<aspnet_Membership>(); 38 39 //var Membership = from item in MembershipTable 40 // where item.UserId == id 41 // select item; 42 43 //Membership membership = Convert.ToDataTransfer((aspnet_Membership)eUser.aspnet_Membership); 44 45 //if (membership == null) { return null; } 46 //user.Membership = membership; 47 48 //return user; 49 50 } 51 } 23 var user = db.aspnet_Users.Where(x => x.UserId == id).FirstOrDefault(); 24 var membership = db.aspnet_Memberships.Where(x => x.UserId == id).FirstOrDefault(); 25 26 27 return Convert.ToDataTransfer(user, membership); 28 29 30 } 31 } 32 33 public IEnumerable<DataTransfer.User> GetUsers(Guid applicationId) 34 { 35 List<DataTransfer.User> userList = new List<DataTransfer.User>(); 36 using (UserManagementDataContext db = new UserManagementDataContext()) 37 { 38 var users = db.aspnet_Users.Where(x => x.ApplicationId == applicationId).ToList<aspnet_User>(); 39 40 foreach (aspnet_User user in users) 41 { 42 var membership = db.aspnet_Memberships.Where(x => x.UserId == user.UserId).FirstOrDefault(); 43 44 userList.Add(Convert.ToDataTransfer(user, membership)); 45 46 } 47 48 49 50 } 51 return userList; 52 } 53 54 public bool InsertUser(User user) 55 { 56 if (user != null) 57 { 58 using (UserManagementDataContext db = new UserManagementDataContext()) 59 { 60 61 aspnet_User eUser = new aspnet_User(); 62 aspnet_Membership eMembership = new aspnet_Membership(); 63 64 Convert.ToEntity(user, eUser, eMembership); 65 try 66 { 67 db.aspnet_Users.InsertOnSubmit(eUser); 68 db.aspnet_Memberships.InsertOnSubmit(eMembership); 69 db.SubmitChanges(); 70 } 71 catch (Exception ex) 72 { 73 return false; 74 } 75 76 return true; 77 78 79 } 80 81 } 82 return false; 83 } 84 85 public bool DeleteUser(Guid id) 86 { 87 88 using (UserManagementDataContext db = new UserManagementDataContext()) 89 { 90 var user = db.aspnet_Users.Where(x => x.UserId == id).FirstOrDefault(); 91 var membership = db.aspnet_Memberships.Where(x => x.UserId == id).FirstOrDefault(); 92 var userinroles = db.aspnet_UsersInRoles.Where(x => x.UserId == id).ToList<aspnet_UsersInRole>(); 93 try 94 { 95 db.aspnet_UsersInRoles.DeleteAllOnSubmit(userinroles); 96 db.aspnet_Memberships.DeleteOnSubmit(membership); 97 db.aspnet_Users.DeleteOnSubmit(user); 98 db.SubmitChanges(); 99 } 100 catch (Exception ex) 101 { 102 return false; 103 } 104 return true; 105 106 } 107 return false; 108 } 109 110 111 public bool UpdateUser(User user) 112 { 113 if (user != null) 114 { 115 using (UserManagementDataContext db = new UserManagementDataContext()) 116 { 117 118 var eUser = db.aspnet_Users.Where(x => x.UserId == user.Id).FirstOrDefault(); 119 var eMembership = db.aspnet_Memberships.Where(x => x.UserId == user.Id).FirstOrDefault(); 120 Convert.ToEntity(user, eUser, eMembership); 121 try 122 { 123 124 db.SubmitChanges(); 125 } 126 catch (Exception ex) 127 { 128 return false; 129 } 130 131 return true; 132 133 } 134 135 } 136 return false; 137 } 138 139 52 140 53 141 #endregion 54 142 55 143 56 //public DataTransfer.User GetUser(Guid applicationId, string userName) 57 //{ 58 // using (UserManagementDataContext db = new UserManagementDataContext()) 59 // { 60 // try 61 // { 62 // Table<aspnet_User> UserTable = db.GetTable<aspnet_User>(); 63 64 // var User = from item in UserTable 65 // where item.UserName == userName && item.ApplicationId == applicationId 66 // select item; 67 68 // User user = Convert.ToDataTransfer((aspnet_User)User.Single()); 69 70 // if (user == null) { return null; } 71 72 // Table<aspnet_Membership> MembershipTable = db.GetTable<aspnet_Membership>(); 73 74 // var Membership = from item in MembershipTable 75 // where item.UserId == user.UserId 76 // select item; 77 78 // Membership membership = Convert.ToDataTransfer((aspnet_Membership)Membership.Single()); 79 80 // if (membership == null) { return null; } 81 // user.Membership = membership; 82 83 // return user; 84 85 86 87 88 // } 89 // catch (Exception ex) 90 // { 91 // Debug.WriteLine(ex.InnerException); 92 // return null; 93 // } 94 // } 95 //} 96 97 //public IEnumerable<DataTransfer.User> GetUsers(Guid applicationId) 98 //{ 99 // List<DataTransfer.User> UserList = new List<DataTransfer.User>(); 100 // using (UserManagementDataContext db = new UserManagementDataContext()) 101 // { 102 // try 103 // { 104 // Table<aspnet_User> UserTable = db.GetTable<aspnet_User>(); 105 // var Users = from item in UserTable 106 // where item.ApplicationId == applicationId 107 // select item; 108 // foreach (var eUser in Users) 109 // { 110 111 // User user = Convert.ToDataTransfer(eUser); 112 113 // if (user== null) { return null; } 114 115 // //Table<aspnet_Membership> MembershipTable = db.GetTable<aspnet_Membership>(); 116 117 // //var Membership = from item in MembershipTable 118 // // where item.UserId == user.UserId 119 // // select item; 120 121 // Membership membership = Convert.ToDataTransfer((aspnet_Membership)eUser.aspnet_Membership); 122 123 // if (membership == null) { return null; } 124 // user.Membership = membership; 125 126 // UserList.Add(user); 127 // } 128 // } 129 // catch (Exception ex) 130 // { 131 // Debug.WriteLine(ex.InnerException); 132 // return new List<User>(); 133 // } 134 // } 135 136 // return UserList; 137 //} 138 //public bool InsertUser(User user) 139 //{ 140 // if (user != null) 141 // { 142 // using (UserManagementDataContext db = new UserManagementDataContext()) 143 // { 144 // try 145 // { 146 147 // Guid? userId = null; 148 // Application application = GetApplication(user.ApplicationId); 149 // if(application == null){return false;} 150 // if (user.Membership == null) { return false; } 151 152 // int? passwordFormat = 1; 153 // int? uniqueEmail = null; 154 // int result = db.aspnet_Membership_CreateUser(application.ApplicationName, user.UserName, user.Membership.Password, user.Membership.PasswordSalt, user.Membership.Email, user.Membership.PasswordQuestion, user.Membership.PasswordAnswer, user.Membership.IsApproved, DateTime.UtcNow, DateTime.Now, uniqueEmail, passwordFormat, ref userId); 155 156 // if (result != 0) 157 // { 158 // return false; 159 // } 160 161 // if (userId != null) 162 // { 163 // return true; 164 // } 165 // else 166 // { 167 // return false; 168 // } 169 // } 170 // catch (Exception ex) 171 // { 172 // Debug.WriteLine(ex.InnerException); 173 // return false; 174 // } 175 // } 176 177 // } 178 // return false; 179 //} 180 //public bool DeleteUser(Guid id) 181 //{ 182 183 // User user = GetUser(id); 184 // if (user != null) 185 // { 186 187 // using (UserManagementDataContext db = new UserManagementDataContext()) 188 // { 189 // try 190 // { 191 // Application application = GetApplication(user.ApplicationId); 192 // if (application == null) 193 // { 194 // return false; 195 // } 196 197 // int? tablesToDeleteFrom = 99; 198 // int? numTablesDeletedFrom = null; 199 // db.aspnet_Users_DeleteUser(application.ApplicationName, user.UserName, tablesToDeleteFrom, ref numTablesDeletedFrom); 200 201 // if (numTablesDeletedFrom != null) 202 // { 203 // return true; 204 // } 205 // else 206 // { 207 // return false; 208 // } 209 // } 210 // catch (Exception ex) 211 // { 212 // Debug.WriteLine(ex.InnerException); 213 // return false; 214 // } 215 // } 216 // } 217 // return false; 218 //} 219 220 //public bool UpdateUser(User user) 221 //{ 222 223 // if (user != null) 224 // { 225 226 // using (UserManagementDataContext db = new UserManagementDataContext()) 227 // { 228 // try 229 // { 230 // if (user.Membership == null) 231 // { 232 // return false; 233 // } 234 235 // Table<aspnet_User> UserTable = db.GetTable<aspnet_User>(); 236 237 // var User = from item in UserTable 238 // where item.UserId == user.UserId 239 // select item; 240 // aspnet_User eUser = ((aspnet_User)User.Single()); 241 242 243 // Table<aspnet_Membership> MembershipTable = db.GetTable<aspnet_Membership>(); 244 245 // var Membership = from item in MembershipTable 246 // where item.UserId == user.UserId 247 // select item; 248 249 // aspnet_Membership eMembership = ((aspnet_Membership)Membership.Single()); 250 251 // Convert.ToEntity(user, eUser); 252 253 // Convert.ToEntity(user.Membership, eMembership); 254 // if (eUser == null) 255 // { 256 // return false; 257 // } 258 // if (eMembership == null) 259 // { 260 // return false; 261 // } 262 // db.SubmitChanges(); 263 // } 264 // catch (Exception ex) 265 // { 266 // Debug.WriteLine(ex.InnerException); 267 // return false; 268 // } 269 // } 270 // } return false; 271 //} 272 273 //#endregion 274 275 //#region Role 276 277 //public Role GetRole(Guid id) 278 //{ 279 // using (UserManagementDataContext db = new UserManagementDataContext()) 280 // { 281 // try 282 // { 283 // Table<aspnet_Role> RoleTable = db.GetTable<aspnet_Role>(); 284 285 // var Role = from item in RoleTable 286 // where item.RoleId == id 287 // select item; 288 // return Convert.ToDataTransfer((aspnet_Role)Role.Single()); 289 // } 290 // catch (Exception ex) 291 // { 292 // Debug.WriteLine(ex.InnerException); 293 // return null; 294 // } 295 // } 296 //} 297 298 //public Role GetRole(Guid applicationId, string roleName) 299 //{ 300 // using (UserManagementDataContext db = new UserManagementDataContext()) 301 // { 302 // try 303 // { 304 // Table<aspnet_Role> RoleTable = db.GetTable<aspnet_Role>(); 305 306 // var Role = from item in RoleTable 307 // where item.RoleName == roleName && item.ApplicationId == applicationId 308 // select item; 309 // return Convert.ToDataTransfer((aspnet_Role)Role.Single()); 310 // } 311 // catch (Exception ex) 312 // { 313 // Debug.WriteLine(ex.InnerException); 314 // return null; 315 // } 316 // } 317 //} 318 319 //public bool RoleExists(Guid roleId) 320 //{ 321 // if (roleId != null) 322 // { 323 // using (UserManagementDataContext db = new UserManagementDataContext()) 324 // { 325 // try 326 // { 327 // Role role = GetRole(roleId); 328 // if (role == null) 329 // { 330 // return false; 331 // } 332 // Application application = GetApplication(role.ApplicationId); 333 // if (application == null) 334 // { 335 // return false; 336 // } 337 338 // int result = db.aspnet_Roles_RoleExists(application.ApplicationName, role.RoleName); 339 340 // return (result == 0); 341 // } 342 // catch (Exception ex) 343 // { 344 // Debug.Write(ex.InnerException); 345 // return false; 346 // } 347 // } 348 349 // } return false; 350 //} 351 352 //public IEnumerable<Role> GetRoles(Guid applicationId) 353 //{ 354 // List<Role> RoleList = new List<Role>(); 355 356 // using (UserManagementDataContext db = new UserManagementDataContext()) 357 // { 358 // try 359 // { 360 // // db.aspnet_Roles_GetAllRoles(applicationName); 361 // Table<aspnet_Role> RoleTable = db.GetTable<aspnet_Role>(); 362 363 // var Roles = from item in RoleTable 364 // where item.ApplicationId == applicationId 365 // select item; 366 // foreach (var Role in Roles) 367 // { 368 // RoleList.Add(Convert.ToDataTransfer((aspnet_Role)Role)); 369 // } 370 // } 371 // catch (Exception ex) 372 // { 373 // Debug.WriteLine(ex.InnerException); 374 // return new List<Role>(); 375 // } 376 // } 377 378 // return RoleList; 379 //} 380 381 //public bool InsertRole(Role role) 382 //{ 383 // if (role != null) 384 // { 385 // using (UserManagementDataContext db = new UserManagementDataContext()) 386 // { 387 // try 388 // { 389 // Application application = GetApplication(role.ApplicationId); 390 // if (application == null) 391 // { 392 // return false; 393 // } 394 // int result = db.aspnet_Roles_CreateRole(application.ApplicationName, role.RoleName); 395 396 // return (result == 0); // checken, welchen rückgabewert (in db, procedure) 397 398 // } 399 // catch (Exception ex) 400 // { 401 // Debug.WriteLine(ex.InnerException); 402 // return false; 403 // } 404 // } 405 406 // } 407 // return false; 408 //} 409 //public bool UpdateRole(Role role) 410 //{ 411 412 // if (role != null) 413 // { 414 415 // using (UserManagementDataContext db = new UserManagementDataContext()) 416 // { 417 // try 418 // { 419 420 // Table<aspnet_Role> RoleTable = db.GetTable<aspnet_Role>(); 421 422 // var Role = from item in RoleTable 423 // where item.RoleId == role.RoleId 424 // select item; 425 // aspnet_Role eRole = ((aspnet_Role)Role.Single()); 426 427 428 // Convert.ToEntity(role, eRole); 429 430 // if (eRole != null) 431 // { 432 // db.SubmitChanges(); 433 // } 434 // else 435 // { 436 // return false; 437 // } 438 // } 439 // catch (Exception ex) 440 // { 441 // Debug.WriteLine(ex.InnerException); 442 // return false; 443 // } 444 // } 445 // } return false; 446 //} 447 448 //public bool DeleteRole(Guid id) 449 //{ 450 // if (id != null) 451 // { 452 // using (UserManagementDataContext db = new UserManagementDataContext()) 453 // { 454 // try 455 // { 456 // Role role = GetRole(id); 457 458 // bool deleteOnlyIfRoleIsEmpty = false; 459 // if (role == null) 460 // { 461 // return false; 462 // } 463 // Application application = GetApplication(role.ApplicationId); 464 // if (application == null) 465 // { 466 // return false; 467 // } 468 // db.aspnet_Roles_DeleteRole(application.ApplicationName, role.RoleName, deleteOnlyIfRoleIsEmpty); 469 470 471 472 // return true; 473 // } 474 // catch (Exception ex) 475 // { 476 // Debug.WriteLine(ex.InnerException); 477 // return false; 478 // } 479 // } 480 481 // } 482 // return false; 483 //} 484 485 //public bool IsUserInRole(Guid roleId, Guid userId) 486 //{ 487 // if (roleId != null && userId != null) 488 // { 489 // using (UserManagementDataContext db = new UserManagementDataContext()) 490 // { 491 492 // try 493 // { 494 // User user = GetUser(userId); 495 // if (user == null) { return false; } 496 497 // Application application = GetApplication(user.ApplicationId); 498 // if (application == null) { return false; } 499 500 // Role role = GetRole(roleId); 501 // if (role == null) { return false; } 502 503 // int result = db.aspnet_UsersInRoles_IsUserInRole(application.ApplicationName, user.UserName, role.RoleName); 504 505 // return (result == 0); 506 // } 507 // catch (Exception ex) 508 // { 509 // Debug.WriteLine(ex.InnerException); 510 // return false; 511 512 // } 513 514 // } 515 516 // } return false; 517 //} 518 519 //public bool AddUserToRole(Guid roleId, Guid userId) 520 //{ 521 // using (UserManagementDataContext db = new UserManagementDataContext()) 522 // { 523 // try 524 // { 525 // Role role = GetRole(roleId); 526 // if (role == null) 527 // { 528 // return false; 529 // } 530 // Application application = GetApplication(role.ApplicationId); 531 // if (application == null) 532 // { 533 // return false; 534 // } 535 // User user = GetUser(userId); 536 // if (user == null) 537 // { 538 // return false; 539 // } 540 541 // db.aspnet_UsersInRoles_AddUsersToRoles(application.ApplicationName, user.UserName, role.RoleName,DateTime.Now); 542 // return true; 543 // } 544 // catch (Exception ex) 545 // { 546 // Debug.WriteLine(ex.InnerException); 547 // return false; 548 // } 549 // } 550 551 //} 552 //public bool RemoveUserFromRole(Guid roleId, Guid userId) 553 //{ 554 // using (UserManagementDataContext db = new UserManagementDataContext()) 555 // { 556 // try 557 // { 558 // Role role = GetRole(roleId); 559 // if (role == null) 560 // { 561 // return false; 562 // } 563 // Application application = GetApplication(role.ApplicationId); 564 // if (application == null) 565 // { 566 // return false; 567 // } 568 // User user = GetUser(userId); 569 // if (user == null) 570 // { 571 // return false; 572 // } 573 574 // db.aspnet_UsersInRoles_RemoveUsersFromRoles(application.ApplicationName, user.UserName, role.RoleName); 575 // return true; 576 577 // } 578 // catch (Exception ex) 579 // { 580 // Debug.WriteLine(ex.InnerException); 581 // return false; 582 // } 583 // } 584 585 //} 586 //public IEnumerable<Role> GetRolesForUser(Guid userId) 587 //{ 588 // List<Role> roles = new List<Role>(); 589 // using (UserManagementDataContext db = new UserManagementDataContext()) 590 // { 591 // try 592 // { 593 // User user = GetUser(userId); 594 // if (user == null) 595 // { 596 // return roles; 597 // } 598 // Application application = GetApplication(user.ApplicationId); 599 // if (application == null) 600 // { 601 // return roles; 602 // } 603 604 605 // ISingleResult<aspnet_UsersInRoles_GetRolesForUserResult> results = db.aspnet_UsersInRoles_GetRolesForUser(application.ApplicationName,user.UserName); 606 // foreach (aspnet_UsersInRoles_GetRolesForUserResult userInRole in results) 607 // { 608 // roles.Add(GetRole(application.ApplicationId,userInRole.RoleName)); 609 // } 610 // } 611 // catch (Exception ex) 612 // { 613 // Debug.WriteLine(ex.InnerException); 614 // return new List<Role>(); 615 // } 616 // } 617 618 // return roles; 619 //} 620 621 //public IEnumerable<User> GetUsersInRole(Guid roleId) 622 //{ 623 // List<User> users = new List<User>(); 624 625 // using(UserManagementDataContext db = new UserManagementDataContext()){ 626 // try 627 // { 628 // Role role = GetRole(roleId); 629 630 // if (role != null) 631 // { 632 // Application application = GetApplication(role.ApplicationId); 633 634 // if (application != null) 635 // { 636 637 638 // ISingleResult<aspnet_UsersInRoles_GetUsersInRolesResult> result = db.aspnet_UsersInRoles_GetUsersInRoles(application.ApplicationName, role.RoleName); 639 // foreach (aspnet_UsersInRoles_GetUsersInRolesResult usersInRole in result) 640 // { 641 // users.Add(GetUser(application.ApplicationId,usersInRole.UserName)); 642 // } 643 // } 644 // } 645 // } 646 // catch (Exception ex) 647 // { 648 // Debug.WriteLine(ex.InnerException); 649 // return new List<User>(); 650 // } 651 // } 652 653 // return users; 654 //} 655 656 //#endregion 657 658 //#region Application 659 660 //public Application InsertApplication(Application application) 661 //{ 662 // if (application != null) 663 // { 664 // using (UserManagementDataContext db = new UserManagementDataContext()) 665 // { 666 // try 667 // { 668 // Guid? applicationId = null; 669 // int result = db.aspnet_Applications_CreateApplication(application.ApplicationName, ref applicationId); 670 // Console.WriteLine("result=" + result); 671 // if (applicationId != null) 672 // { 673 // application.ApplicationId = (Guid)applicationId; 674 // return application; 675 // } 676 // else 677 // { 678 // return null; 679 // } 680 // } 681 // catch (Exception ex) 682 // { 683 // Debug.WriteLine(ex.InnerException); 684 // return null; 685 // } 686 // } 687 688 // } 689 // return null; 690 //} 691 692 //public bool DeleteApplication(Application application) 693 //{ 694 // return false; 695 //} 696 697 //public Application GetApplication(Guid id) 698 //{ 699 // using (UserManagementDataContext db = new UserManagementDataContext()) 700 // { 701 // try 702 // { 703 // Table<aspnet_Application> ApplicationTable = db.GetTable<aspnet_Application>(); 704 705 // var Application = from item in ApplicationTable 706 // where item.ApplicationId == id 707 // select item; 708 // return Convert.ToDataTransfer((aspnet_Application)Application.Single()); 709 // } 710 // catch (Exception ex) 711 // { 712 // Debug.WriteLine(ex.InnerException); 713 // return null; 714 // } 715 // } 716 //} 717 718 //public IEnumerable<DataTransfer.Application> GetApplications() 719 //{ 720 // List<DataTransfer.Application> ApplicationList = new List<DataTransfer.Application>(); 721 // using (UserManagementDataContext db = new UserManagementDataContext()) 722 // { 723 // try 724 // { 725 // Table<aspnet_Application> ApplicationTable = db.GetTable<aspnet_Application>(); 726 // var Applications = from item in ApplicationTable 727 // select item; 728 // foreach (var eApplication in Applications) 729 // { 730 731 // Application application = Convert.ToDataTransfer(eApplication); 732 733 // if (application == null) { return null; } 734 735 736 // ApplicationList.Add(application); 737 // } 738 // } 739 // catch (Exception ex) 740 // { 741 // Debug.WriteLine(ex.InnerException); 742 // return new List<Application>(); 743 // } 744 // } 745 746 // return ApplicationList; 747 //} 748 749 750 751 //#endregion 752 753 //#region Membership 754 755 //public Membership InsertMembership(Membership membership) 756 //{ 757 758 // if (membership != null) 759 // { 760 // using (UserManagementDataContext db = new UserManagementDataContext()) 761 // { 762 // try 763 // { 764 // Application application = GetApplication(membership.ApplicationId); 765 // if (application == null) { return null; } 766 767 // } 768 // catch (Exception ex) 769 // { 770 // Debug.WriteLine(ex.InnerException); 771 // return null; 772 // } 773 // } 774 // } 775 // return null; 776 //} 777 778 //#endregion 144 145 #region Role 146 147 public Role GetRole(Guid id) 148 { 149 using (UserManagementDataContext db = new UserManagementDataContext()) 150 { 151 var role = db.aspnet_Roles.Where(x => x.RoleId == id).FirstOrDefault(); 152 return Convert.ToDataTransfer(role); 153 } 154 } 155 156 public IEnumerable<Role> GetRoles(Guid applicationId) 157 { 158 List<DataTransfer.Role> roleList = new List<DataTransfer.Role>(); 159 using (UserManagementDataContext db = new UserManagementDataContext()) 160 { 161 var roles = db.aspnet_Roles.Where(x => x.ApplicationId == applicationId).ToList<aspnet_Role>(); 162 163 foreach (aspnet_Role role in roles) 164 { 165 roleList.Add(Convert.ToDataTransfer(role)); 166 } 167 168 } 169 return roleList; 170 } 171 172 public bool InsertRole(Role role) 173 { 174 175 if (role != null) 176 { 177 using (UserManagementDataContext db = new UserManagementDataContext()) 178 { 179 180 aspnet_Role eRole = new aspnet_Role(); 181 182 Convert.ToEntity(role, eRole); 183 try 184 { 185 db.aspnet_Roles.InsertOnSubmit(eRole); 186 db.SubmitChanges(); 187 } 188 catch (Exception ex) 189 { 190 return false; 191 } 192 193 return true; 194 } 195 196 } 197 return false; 198 } 199 200 public bool DeleteRole(Guid id) 201 { 202 using (UserManagementDataContext db = new UserManagementDataContext()) 203 { 204 var role = db.aspnet_Roles.Where(x => x.RoleId == id).FirstOrDefault(); 205 206 207 try 208 { 209 db.aspnet_Roles.DeleteOnSubmit(role); 210 db.SubmitChanges(); 211 } 212 catch (Exception ex) 213 { 214 return false; 215 } 216 return true; 217 218 219 } 220 } 221 222 public bool AddUserToRole(Guid roleId, Guid userId) 223 { 224 using (UserManagementDataContext db = new UserManagementDataContext()) 225 { 226 try 227 { 228 aspnet_UsersInRole r = new aspnet_UsersInRole(); 229 r.RoleId = roleId; 230 r.UserId = userId; 231 db.aspnet_UsersInRoles.InsertOnSubmit(r); 232 db.SubmitChanges(); 233 return true; 234 } 235 catch (Exception ex) 236 { 237 Debug.WriteLine(ex.InnerException); 238 return false; 239 } 240 } 241 } 242 243 public bool RemoveUserFromRole(Guid roleId, Guid userId) 244 { 245 using (UserManagementDataContext db = new UserManagementDataContext()) 246 { 247 try 248 { 249 var role = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId && x.UserId == userId).FirstOrDefault(); 250 251 db.aspnet_UsersInRoles.DeleteOnSubmit(role); 252 db.SubmitChanges(); 253 return true; 254 255 } 256 catch (Exception ex) 257 { 258 Debug.WriteLine(ex.InnerException); 259 return false; 260 } 261 } 262 263 } 264 265 public IEnumerable<Role> GetRolesForUser(Guid userId) 266 { 267 List<Role> roleList = new List<Role>(); 268 using (UserManagementDataContext db = new UserManagementDataContext()) 269 { 270 try 271 { 272 var roles = db.aspnet_UsersInRoles.Where(x => x.UserId == userId).ToList<aspnet_UsersInRole>(); 273 274 foreach (aspnet_UsersInRole r in roles) 275 { 276 roleList.Add(GetRole(r.RoleId)); 277 278 } 279 280 } 281 catch (Exception ex) 282 { 283 Debug.WriteLine(ex.InnerException); 284 return new List<Role>(); 285 } 286 } 287 288 return roleList; 289 } 290 291 public IEnumerable<User> GetUsersInRole(Guid roleId) 292 { 293 List<User> userList = new List<User>(); 294 using (UserManagementDataContext db = new UserManagementDataContext()) 295 { 296 try 297 { 298 var users = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId).ToList<aspnet_UsersInRole>(); 299 300 foreach (aspnet_UsersInRole u in users) 301 { 302 userList.Add(GetUser(u.UserId)); 303 304 } 305 306 } 307 catch (Exception ex) 308 { 309 Debug.WriteLine(ex.InnerException); 310 return new List<User>(); 311 } 312 } 313 314 return userList; 315 } 316 317 318 319 public bool UpdateRole(Role role) 320 { 321 if (role != null) 322 { 323 using (UserManagementDataContext db = new UserManagementDataContext()) 324 { 325 326 var eRole = db.aspnet_Roles.Where(x => x.RoleId == role.Id).FirstOrDefault(); 327 328 Convert.ToEntity(role, eRole); 329 try 330 { 331 332 db.SubmitChanges(); 333 } 334 catch (Exception ex) 335 { 336 return false; 337 } 338 339 return true; 340 341 } 342 343 } 344 return false; 345 } 346 347 348 349 #endregion 350 351 352 353 #region Application 354 355 public bool InsertApplication(Application application) 356 { 357 if (application != null) 358 { 359 using (UserManagementDataContext db = new UserManagementDataContext()) 360 { 361 362 aspnet_Application eApplication = new aspnet_Application(); 363 364 Convert.ToEntity(application, eApplication); 365 try 366 { 367 db.aspnet_Applications.InsertOnSubmit(eApplication); 368 db.SubmitChanges(); 369 } 370 catch (Exception ex) 371 { 372 return false; 373 } 374 375 return true; 376 377 } 378 379 } 380 return false; 381 } 382 383 public bool UpdateApplication(Application application) 384 { 385 if (application != null) 386 { 387 using (UserManagementDataContext db = new UserManagementDataContext()) 388 { 389 390 var eApplication = db.aspnet_Applications.Where(x => x.ApplicationId == application.Id).FirstOrDefault(); 391 392 Convert.ToEntity(application, eApplication); 393 try 394 { 395 396 db.SubmitChanges(); 397 } 398 catch (Exception ex) 399 { 400 return false; 401 } 402 403 return true; 404 405 } 406 407 } 408 return false; 409 } 410 411 412 public bool DeleteApplication(Guid applicationId) 413 { 414 using (UserManagementDataContext db = new UserManagementDataContext()) 415 { 416 var users = db.aspnet_Users.Where(x => x.ApplicationId == applicationId).ToList<aspnet_User>(); 417 var memberships = db.aspnet_Memberships.Where(x => x.ApplicationId == applicationId).ToList<aspnet_Membership>(); 418 419 var roles = db.aspnet_Roles.Where(x => x.ApplicationId == applicationId).ToList<aspnet_Role>(); 420 var application = db.aspnet_Applications.Where(x => x.ApplicationId == applicationId).FirstOrDefault(); 421 422 try 423 { 424 foreach (aspnet_User u in users) 425 { 426 var userinroles = db.aspnet_UsersInRoles.Where(x => x.UserId == u.UserId).ToList<aspnet_UsersInRole>(); 427 db.aspnet_UsersInRoles.DeleteAllOnSubmit(userinroles); 428 } 429 430 db.aspnet_Memberships.DeleteAllOnSubmit(memberships); 431 db.aspnet_Users.DeleteAllOnSubmit(users); 432 db.aspnet_Roles.DeleteAllOnSubmit(roles); 433 db.aspnet_Applications.DeleteOnSubmit(application); 434 db.SubmitChanges(); 435 } 436 catch (Exception ex) 437 { 438 return false; 439 } 440 return true; 441 442 443 } 444 return false; 445 } 446 447 public Application GetApplication(Guid id) 448 { 449 using (UserManagementDataContext db = new UserManagementDataContext()) 450 { 451 var application = db.aspnet_Applications.Where(x => x.ApplicationId == id).FirstOrDefault(); 452 return Convert.ToDataTransfer(application); 453 } 454 } 455 456 public IEnumerable<DataTransfer.Application> GetApplications() 457 { 458 List<DataTransfer.Application> applicationList = new List<DataTransfer.Application>(); 459 using (UserManagementDataContext db = new UserManagementDataContext()) 460 { 461 var apps = db.aspnet_Applications.ToList<aspnet_Application>(); 462 463 foreach (aspnet_Application app in apps) 464 { 465 applicationList.Add(Convert.ToDataTransfer(app)); 466 } 467 468 } 469 return applicationList; 470 } 471 472 #endregion 779 473 } 474 780 475 } 781 476 -
branches/UserManagement/HeuristicLab.Services.Authentication/Convert.cs
r4740 r4926 8 8 9 9 #region User 10 11 /// <summary>12 /// converts data transfer object to data access objet13 /// </summary>14 /// <param name="source">data transfer object</param>15 /// <returns>data access object</returns>16 public static aspnet_User ToEntity(User source)17 {18 if (source == null) return null;19 return new aspnet_User()20 {21 ApplicationId = source.ApplicationId,22 UserId = source.Id,23 UserName = source.Name,24 //LoweredUserName = source.LoweredUserName,25 //IsAnonymous = source.IsAnonymous,26 LastActivityDate = source.LastActivityDate27 };28 }29 30 ///// <summary>31 ///// converts data transfer object to data access objet32 ///// </summary>33 ///// <param name="source">data transfer object</param>34 ///// <returns>data access object</returns>35 //public static aspnet_Membership ToEntity(User source) {36 // if (source == null) return null;37 // return new aspnet_Membership() {38 // ApplicationId = source.ApplicationId,39 // UserId = source.Id,40 // Password = source.Password,41 // PasswordFormat = 1,42 // PasswordSalt = source.PasswordSalt,43 // Email = source.Email,44 // IsApproved = source.IsApproved,45 // IsLockedOut = source.IsLookedOut,46 // CreateDate = source.CreateDate,47 // LastLoginDate = source.LastLoginDate,48 // LastPasswordChangedDate = source.LastPasswordChangeDate,49 // LastLockoutDate = source.LastLockoutDate,50 // FailedPasswordAttemptCount = 0,51 // FailedPasswordAttemptWindowStart = new System.DateTime(1900, 01, 01),52 // FailedPasswordAnswerAttemptCount = 0,53 // FailedPasswordAnswerAttemptWindowStart = new System.DateTime(1900, 01, 01),54 // Comment = source.Comment55 // };56 //}57 10 58 11 /// <summary> … … 94 47 if ((source != null) && (userTarget != null) && (membershipTarget != null)) 95 48 { 96 userTarget.ApplicationId = source.ApplicationId;97 membershipTarget.ApplicationId = source.ApplicationId;98 userTarget.UserId = source.Id;99 membershipTarget.UserId = source.Id;100 userTarget.UserName = source.Name;101 userTarget.LoweredUserName = source.Name;102 userTarget.IsAnonymous = false;103 userTarget.LastActivityDate = source.LastActivityDate;104 membershipTarget.Password = source.Password;105 membershipTarget.PasswordFormat = 1;106 membershipTarget.PasswordSalt = source.PasswordSalt;107 membershipTarget.Email = source.Email;108 membershipTarget.IsApproved = source.IsApproved;109 membershipTarget.IsLockedOut = source.IsLookedOut;110 membershipTarget.CreateDate = source.CreateDate;111 membershipTarget.LastLoginDate = source.LastLoginDate;112 membershipTarget.LastPasswordChangedDate = source.LastPasswordChangeDate;113 membershipTarget.LastLockoutDate = source.LastLockoutDate;114 membershipTarget.FailedPasswordAttemptCount = 0;115 membershipTarget.FailedPasswordAttemptWindowStart = new System.DateTime(1900, 01, 01);116 membershipTarget.FailedPasswordAnswerAttemptCount = 0;117 membershipTarget.FailedPasswordAnswerAttemptWindowStart = new System.DateTime(1900, 01, 01);118 membershipTarget.Comment = source.Comment;49 userTarget.ApplicationId = source.ApplicationId; 50 membershipTarget.ApplicationId = source.ApplicationId; 51 userTarget.UserId = source.Id; 52 membershipTarget.UserId = source.Id; 53 userTarget.UserName = source.Name; 54 userTarget.LoweredUserName = source.Name; 55 userTarget.IsAnonymous = false; 56 userTarget.LastActivityDate = source.LastActivityDate; 57 membershipTarget.Password = source.Password; 58 membershipTarget.PasswordFormat = 1; 59 membershipTarget.PasswordSalt = source.PasswordSalt; 60 membershipTarget.Email = source.Email; 61 membershipTarget.IsApproved = source.IsApproved; 62 membershipTarget.IsLockedOut = source.IsLookedOut; 63 membershipTarget.CreateDate = source.CreateDate; 64 membershipTarget.LastLoginDate = source.LastLoginDate; 65 membershipTarget.LastPasswordChangedDate = source.LastPasswordChangeDate; 66 membershipTarget.LastLockoutDate = source.LastLockoutDate; 67 membershipTarget.FailedPasswordAttemptCount = 0; 68 membershipTarget.FailedPasswordAttemptWindowStart = new System.DateTime(1900, 01, 01); 69 membershipTarget.FailedPasswordAnswerAttemptCount = 0; 70 membershipTarget.FailedPasswordAnswerAttemptWindowStart = new System.DateTime(1900, 01, 01); 71 membershipTarget.Comment = source.Comment; 119 72 120 73 } … … 127 80 #region Application 128 81 129 /// //<summary>130 /// // converts data transfer object to data access objet131 /// //</summary>132 /// // <param name="source">data transferobject</param>133 /// // <returns>data accessobject</returns>134 //public static aspnet_Application ToEntity(Application source)135 //{136 //if (source == null) return null;137 // return new aspnet_Application()138 //{139 // ApplicationId = source.ApplicationId,140 // ApplicationName = source.ApplicationName,141 //LoweredApplicationName = source.LoweredApplicationName,142 //Description = source.Description143 //};144 //}82 /// <summary> 83 /// converts data access object to data transfer object 84 /// </summary> 85 /// <param name="source">data access object</param> 86 /// <returns>data transfer object</returns> 87 public static Application ToDataTransfer(aspnet_Application source) 88 { 89 if (source == null) return null; 90 return new Application() 91 { 92 Id = source.ApplicationId, 93 Name = source.ApplicationName, 94 LoweredApplicationName = source.LoweredApplicationName, 95 Description = source.Description 96 }; 97 } 145 98 146 ///// <summary> 147 ///// converts data access object to data transfer object 148 ///// </summary> 149 ///// <param name="source">data access object</param> 150 ///// <returns>data transfer object</returns> 151 //public static Application ToDataTransfer(aspnet_Application source) 152 //{ 153 // if (source == null) return null; 154 // return new Application() 155 // { 156 // ApplicationId = source.ApplicationId, 157 // ApplicationName = source.ApplicationName, 158 // LoweredApplicationName = source.LoweredApplicationName, 159 // Description = source.Description 160 // }; 161 //} 99 /// <summary> 100 /// converts data transfer object to data access object 101 /// </summary> 102 /// <param name="source">data transfer object</param> 103 /// <param name="target">data access object</param> 104 public static void ToEntity(Application source, aspnet_Application target) 105 { 106 if ((source != null) && (target != null)) 107 { 108 target.ApplicationId = source.Id; 109 target.ApplicationName = source.Name; 110 target.LoweredApplicationName = source.LoweredApplicationName; 111 target.Description = source.Description; 112 } 162 113 163 ///// <summary> 164 ///// converts data transfer object to data access object 165 ///// </summary> 166 ///// <param name="source">data transfer object</param> 167 ///// <param name="target">data access object</param> 168 //public static void ToEntity(Application source, aspnet_Application target) 169 //{ 170 // if ((source != null) && (target != null)) 171 // { 172 // target.ApplicationId = source.ApplicationId; 173 // target.ApplicationName = source.ApplicationName; 174 // target.LoweredApplicationName = source.LoweredApplicationName; 175 // target.Description = source.Description; 176 // } 177 178 //} 179 180 #endregion 181 182 #region Membership 183 184 ///// <summary> 185 ///// converts data transfer object to data access objet 186 ///// </summary> 187 ///// <param name="source">data transfer object</param> 188 ///// <returns>data access object</returns> 189 //public static aspnet_Membership ToEntity(Membership source) 190 //{ 191 // if (source == null) return null; 192 // return new aspnet_Membership() 193 // { 194 // ApplicationId = source.ApplicationId, 195 // UserId = source.UserId, 196 // Password = source.Password, 197 // PasswordAnswer = source.PasswordAnswer, 198 // PasswordSalt = source.PasswordSalt, 199 // PasswordQuestion = source.PasswordQuestion, 200 201 // Email = source.Email, 202 // LoweredEmail = source.LoweredEmail, 203 // IsApproved = source.IsApproved, 204 // IsLockedOut = source.IsLockedOut, 205 // CreateDate = source.CreateDate, 206 // LastLoginDate = source.LastLoginDate, 207 // LastPasswordChangedDate = source.LastPasswordChangedDate, 208 // LastLockoutDate = source.LastLockoutDate, 209 // Comment = source.Comment 210 211 212 // }; 213 //} 214 215 ///// <summary> 216 ///// converts data access object to data transfer object 217 ///// </summary> 218 ///// <param name="source">data access object</param> 219 ///// <returns>data transfer object</returns> 220 //public static Membership ToDataTransfer(aspnet_Membership source) 221 //{ 222 // if (source == null) return null; 223 // return new Membership() 224 // { 225 // ApplicationId = source.ApplicationId, 226 // UserId = source.UserId, 227 // Password = source.Password, 228 // PasswordAnswer = source.PasswordAnswer, 229 // PasswordSalt = source.PasswordSalt, 230 // PasswordQuestion = source.PasswordQuestion, 231 232 // Email = source.Email, 233 // LoweredEmail = source.LoweredEmail, 234 // IsApproved = source.IsApproved, 235 // IsLockedOut = source.IsLockedOut, 236 // CreateDate = source.CreateDate, 237 // LastLoginDate = source.LastLoginDate, 238 // LastPasswordChangedDate = source.LastPasswordChangedDate, 239 // LastLockoutDate = source.LastLockoutDate, 240 // Comment = source.Comment 241 // }; 242 //} 243 244 ///// <summary> 245 ///// converts data transfer object to data access object 246 ///// </summary> 247 ///// <param name="source">data transfer object</param> 248 ///// <param name="target">data access object</param> 249 //public static void ToEntity(Membership source, aspnet_Membership target) 250 //{ 251 // if ((source != null) && (target != null)) 252 // { 253 // target.ApplicationId = source.ApplicationId; 254 // target.UserId = source.UserId; 255 // target.Password = source.Password; 256 // target.PasswordAnswer = source.PasswordAnswer; 257 // target.PasswordSalt = source.PasswordSalt; 258 // target.PasswordQuestion = source.PasswordQuestion; 259 260 // target.Email = source.Email; 261 // target.LoweredEmail = source.LoweredEmail; 262 // target.IsApproved = source.IsApproved; 263 // target.IsLockedOut = source.IsLockedOut; 264 // target.CreateDate = source.CreateDate; 265 // target.LastLoginDate = source.LastLoginDate; 266 // target.LastPasswordChangedDate = source.LastPasswordChangedDate; 267 // target.LastLockoutDate = source.LastLockoutDate; 268 // target.Comment = source.Comment; 269 // } 270 271 //} 114 } 272 115 273 116 #endregion … … 275 118 #region Role 276 119 277 /// //<summary>278 /// // converts data transfer object to data access objet279 /// //</summary>280 /// // <param name="source">data transferobject</param>281 /// // <returns>data accessobject</returns>282 //public static aspnet_Role ToEntity(Role source)283 //{284 //if (source == null) return null;285 // return new aspnet_Role()286 //{287 //ApplicationId = source.ApplicationId,288 // RoleId = source.RoleId,289 // RoleName = source.RoleName,290 // LoweredRoleName = source.LoweredRoleName,291 // Description = source.Description292 //};293 //}120 /// <summary> 121 /// converts data access object to data transfer object 122 /// </summary> 123 /// <param name="source">data access object</param> 124 /// <returns>data transfer object</returns> 125 public static Role ToDataTransfer(aspnet_Role source) 126 { 127 if (source == null) return null; 128 return new Role() 129 { 130 ApplicationId = source.ApplicationId, 131 Id = source.RoleId, 132 Name = source.RoleName, 133 Description = source.Description, 134 LoweredRoleName = source.LoweredRoleName, 135 }; 136 } 294 137 295 ///// <summary> 296 ///// converts data access object to data transfer object 297 ///// </summary> 298 ///// <param name="source">data access object</param> 299 ///// <returns>data transfer object</returns> 300 //public static Role ToDataTransfer(aspnet_Role source) 301 //{ 302 // if (source == null) return null; 303 // return new Role() 304 // { 305 // ApplicationId = source.ApplicationId, 306 // RoleId = source.RoleId, 307 // RoleName = source.RoleName, 308 // LoweredRoleName = source.LoweredRoleName, 309 // Description = source.Description 310 // }; 311 //} 138 /// <summary> 139 /// converts data transfer object to data access object 140 /// </summary> 141 /// <param name="source">data transfer object</param> 142 /// <param name="target">data access object</param> 143 public static void ToEntity(Role source, aspnet_Role target) 144 { 145 if ((source != null) && (target != null)) 146 { 147 target.ApplicationId = source.ApplicationId; 148 target.RoleId = source.Id; 149 target.RoleName = source.Name; 150 target.LoweredRoleName = source.LoweredRoleName; 151 target.Description = source.Description; 152 } 312 153 313 ///// <summary> 314 ///// converts data transfer object to data access object 315 ///// </summary> 316 ///// <param name="source">data transfer object</param> 317 ///// <param name="target">data access object</param> 318 //public static void ToEntity(Role source, aspnet_Role target) 319 //{ 320 // if ((source != null) && (target != null)) 321 // { 322 // target.ApplicationId = source.ApplicationId; 323 // target.RoleId = source.RoleId; 324 // target.RoleName = source.RoleName; 325 // target.LoweredRoleName = source.LoweredRoleName; 326 // target.Description = source.Description; 327 // } 328 329 //} 154 } 330 155 331 156 #endregion -
branches/UserManagement/HeuristicLab.Services.Authentication/HeuristicLab.Services.Authentication.csproj
r4647 r4926 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>8.0. 30703</ProductVersion>6 <ProductVersion>8.0.50727</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 <ProjectGuid>{ FF763830-EE9B-4FF7-9A55-4E2552E20C9A}</ProjectGuid>8 <ProjectGuid>{0E7ADDD6-C7EA-45F6-A7ED-48041ABF1A87}</ProjectGuid> 9 9 <OutputType>Library</OutputType> 10 10 <AppDesignerFolder>Properties</AppDesignerFolder> 11 11 <RootNamespace>HeuristicLab.Services.Authentication</RootNamespace> 12 12 <AssemblyName>HeuristicLab.Services.Authentication</AssemblyName> 13 <ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> 14 <StartArguments>/client:"WcfTestClient.exe"</StartArguments> 13 15 <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 14 < FileAlignment>512</FileAlignment>16 <TargetFrameworkProfile>Client</TargetFrameworkProfile> 15 17 </PropertyGroup> 16 18 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> … … 32 34 </PropertyGroup> 33 35 <ItemGroup> 36 <Reference Include="Microsoft.CSharp" /> 34 37 <Reference Include="System" /> 35 38 <Reference Include="System.Core" /> 39 <Reference Include="System.Data" /> 36 40 <Reference Include="System.Data.Linq" /> 37 <Reference Include="System.Data.Services" />38 41 <Reference Include="System.Runtime.Serialization" /> 39 42 <Reference Include="System.ServiceModel" /> 43 <Reference Include="System.Xml" /> 40 44 <Reference Include="System.Xml.Linq" /> 41 <Reference Include="System.Data.DataSetExtensions" />42 <Reference Include="Microsoft.CSharp" />43 <Reference Include="System.Data" />44 <Reference Include="System.Xml" />45 45 </ItemGroup> 46 46 <ItemGroup> 47 <Compile Include="Convert.cs" /> 48 <Compile Include="Interface\IAuthenticationService.cs" /> 49 <Compile Include="Properties\AssemblyInfo.cs" /> 47 50 <Compile Include="AuthenticationService.cs" /> 48 <Compile Include="Convert.cs" /> 49 <Compile Include="Interfaces\IAuthenticationService.cs" /> 50 <Compile Include="Properties\AssemblyInfo.cs" /> 51 </ItemGroup> 52 <ItemGroup> 53 <None Include="App.config" /> 54 <None Include="HeuristicLab.snk" /> 51 55 </ItemGroup> 52 56 <ItemGroup> … … 60 64 </ProjectReference> 61 65 </ItemGroup> 62 <ItemGroup> 63 <WCFMetadata Include="Service References\" /> 64 </ItemGroup> 65 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 66 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 67 <ProjectExtensions> 68 <VisualStudio> 69 <FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}"> 70 <WcfProjectProperties> 71 <AutoStart>True</AutoStart> 72 </WcfProjectProperties> 73 </FlavorProperties> 74 </VisualStudio> 75 </ProjectExtensions> 66 76 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 67 77 Other similar extension points exist, see Microsoft.Common.targets. -
branches/UserManagement/HeuristicLab.Services.Authentication/Interfaces/IAuthenticationService.cs
r4740 r4926 15 15 User GetUser(Guid id); 16 16 17 //[OperationContract] 18 //User GetUser(Guid applicationId, string userName); 17 18 [OperationContract] 19 IEnumerable<User> GetUsers(Guid applicationId); 19 20 20 //[OperationContract]21 //IEnumerable<User> GetUsers(Guid applicationId);21 [OperationContract] 22 bool InsertUser(User user); 22 23 23 //[OperationContract]24 //bool InsertUser(User user);24 [OperationContract] 25 bool DeleteUser(Guid id); 25 26 26 //[OperationContract]27 //bool DeleteUser(Guid id);27 [OperationContract] 28 bool UpdateUser(User user); 28 29 29 //[OperationContract]30 //bool UpdateUser(User user);30 [OperationContract] 31 bool AddUserToRole(Guid roleId, Guid userId); 31 32 32 //[OperationContract]33 //bool AddUserToRole(Guid roleId, Guid userId);33 [OperationContract] 34 bool RemoveUserFromRole(Guid roleId, Guid userId); 34 35 35 //[OperationContract] 36 //bool RemoveUserFromRole(Guid roleId, Guid userId); 37 38 //[OperationContract] 39 //IEnumerable<Role> GetRolesForUser(Guid userId); 36 [OperationContract] 37 IEnumerable<Role> GetRolesForUser(Guid userId); 40 38 41 39 #endregion … … 43 41 #region Role 44 42 45 //[OperationContract] 46 //Role GetRole(Guid id); 47 48 //[OperationContract] 49 //Role GetRole(Guid applicationId, string roleName); 43 [OperationContract] 44 Role GetRole(Guid id); 50 45 51 //[OperationContract] 52 //IEnumerable<Role> GetRoles(Guid applicationId); 46 53 47 54 //[OperationContract]55 //bool RoleExists(Guid roleId);48 [OperationContract] 49 IEnumerable<Role> GetRoles(Guid applicationId); 56 50 57 //[OperationContract] 58 //bool IsUserInRole(Guid roleId, Guid userId); 59 60 //[OperationContract] 61 //bool InsertRole(Role role); 51 [OperationContract] 52 bool InsertRole(Role role); 62 53 63 //[OperationContract]64 //bool UpdateRole(Role role);54 [OperationContract] 55 bool UpdateRole(Role role); 65 56 66 //[OperationContract]67 //bool DeleteRole(Guid id);57 [OperationContract] 58 bool DeleteRole(Guid id); 68 59 69 //[OperationContract]70 //IEnumerable<User> GetUsersInRole(Guid roleId);71 60 [OperationContract] 61 IEnumerable<User> GetUsersInRole(Guid roleId); 62 72 63 #endregion 73 64 74 65 #region Application 75 66 76 //[OperationContract]77 //Application GetApplication(Guid id);67 [OperationContract] 68 Application GetApplication(Guid id); 78 69 79 //[OperationContract]80 //ApplicationInsertApplication(Application application);70 [OperationContract] 71 bool InsertApplication(Application application); 81 72 82 //[OperationContract]83 //bool DeleteApplication(Application application);73 [OperationContract] 74 bool DeleteApplication(Guid id); 84 75 85 //[OperationContract]86 //IEnumerable<DataTransfer.Application> GetApplications();76 [OperationContract] 77 IEnumerable<DataTransfer.Application> GetApplications(); 87 78 88 79 #endregion 89 80 90 #region Membership 91 92 //[OperationContract] 93 //Membership InsertMembership(Membership membership); 94 95 #endregion 81 96 82 } 97 83 } -
branches/UserManagement/HeuristicLab.Services.Authentication/Properties/AssemblyInfo.cs
r4584 r4926 6 6 // set of attributes. Change these attribute values to modify the information 7 7 // associated with an assembly. 8 [assembly: AssemblyTitle("HeuristicLab.Services.Authentication .Service")]8 [assembly: AssemblyTitle("HeuristicLab.Services.Authentication")] 9 9 [assembly: AssemblyDescription("")] 10 10 [assembly: AssemblyConfiguration("")] 11 [assembly: AssemblyCompany(" Microsoft")]12 [assembly: AssemblyProduct("HeuristicLab.Services.Authentication .Service")]13 [assembly: AssemblyCopyright("Copyright © Microsoft2010")]11 [assembly: AssemblyCompany("")] 12 [assembly: AssemblyProduct("HeuristicLab.Services.Authentication")] 13 [assembly: AssemblyCopyright("Copyright © 2010")] 14 14 [assembly: AssemblyTrademark("")] 15 15 [assembly: AssemblyCulture("")] … … 21 21 22 22 // The following GUID is for the ID of the typelib if this project is exposed to COM 23 [assembly: Guid(" d0959a99-16df-429c-b9f5-50888717e468")]23 [assembly: Guid("c63abe4c-1254-463f-91f8-ba4972bc0f52")] 24 24 25 25 // Version information for an assembly consists of the following four values:
Note: See TracChangeset
for help on using the changeset viewer.