- Timestamp:
- 03/05/12 22:29:59 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r7536 r7553 663 663 #region UserGroupBase 664 664 public IEnumerable<DT.UserGroupBase> GetAllLeightweightUsersAndGroups() { 665 //TODO: it must be possible to include a role so not all users are returned but only the ones who are allowed to use a certain service 666 List<DT.UserGroup> userGroups = new List<DT.UserGroup>(); 667 List<DT.UserGroupBase> result = new List<DT.UserGroupBase>(); 668 669 // this is just for generating users from asp.net authenticaton db; we should maybe provide an updatescript instead 670 List<Guid> accessUserGuids = null; 671 using (DA.ASPNETAuthenticationDataContext context = new DA.ASPNETAuthenticationDataContext()) { 672 var query = from u in context.aspnet_Users 673 select u.UserId; 674 accessUserGuids = query.ToList(); 675 } 676 var lightweightUsers = accessUserGuids.Select(x => BuildLightweightUserDto(x)); 677 678 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 679 var query = from u in context.UserGroupBases.OfType<DA.UserGroup>() 680 select Convert.ToDto(u); 681 userGroups = query.ToList(); 682 } 683 684 result.AddRange(lightweightUsers); 685 result.AddRange(userGroups); 686 687 return result; 688 } 689 690 public IEnumerable<DT.UserGroupBase> GetLeightweightUsersAndGroups(IEnumerable<Guid> ids) { 665 691 List<DA.UserGroupBase> dbUserGroupsBases = new List<DA.UserGroupBase>(); 666 692 List<DT.UserGroupBase> result = new List<DT.UserGroupBase>(); … … 668 694 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 669 695 var query = from u in context.UserGroupBases 696 where ids.Contains(u.Id) 670 697 select u; 671 698 dbUserGroupsBases = query.ToList(); … … 683 710 return result; 684 711 } 685 686 public IEnumerable<DT.UserGroupBase> GetLeightweightUsersAndGroups(IEnumerable<Guid> ids) {687 List<DA.UserGroupBase> dbUserGroupsBases = new List<DA.UserGroupBase>();688 List<DT.UserGroupBase> result = new List<DT.UserGroupBase>();689 690 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {691 var query = from u in context.UserGroupBases692 where ids.Contains(u.Id)693 select u;694 dbUserGroupsBases = query.ToList();695 }696 697 foreach (var ugb in dbUserGroupsBases) {698 if (ugb.GetType() == typeof(DA.User)) {699 var user = BuildLightweightUserDto(ugb.Id);700 result.Add(user);701 } else if (ugb.GetType() == typeof(DA.UserGroup)) {702 var group = Convert.ToDto(ugb as DA.UserGroup);703 result.Add(group);704 }705 }706 return result;707 }708 712 #endregion 709 713
Note: See TracChangeset
for help on using the changeset viewer.