- Timestamp:
- 03/12/12 17:22:59 (13 years ago)
- Location:
- branches/ClientUserManagement/HeuristicLab.Services.Access/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r7553 r7599 347 347 DA.aspnet_User aspUser = null; 348 348 DA.User accessUser = null; 349 List<DA.aspnet_Role> roles = new List<DA.aspnet_Role>(); 350 List<DA.UserGroup> groups = new List<DA.UserGroup>(); 351 349 352 350 353 using (DA.ASPNETAuthenticationDataContext context = new DA.ASPNETAuthenticationDataContext()) { … … 354 357 if (userQuery.Count() == 1) { 355 358 aspUser = userQuery.First(); 359 roles = (from ur in context.aspnet_UsersInRoles 360 where ur.UserId == aspUser.UserId 361 join r in context.aspnet_Roles on ur.RoleId equals r.RoleId 362 select r).ToList(); 356 363 } 357 364 } … … 364 371 if (query.Count() == 1) { 365 372 accessUser = query.First(); 373 groups = (from ug in context.UserGroupUserGroups 374 where ug.UserGroupUserGroupId == accessUser.Id 375 join g in context.UserGroupBases.OfType<DA.UserGroup>() on ug.UserGroupId equals g.Id 376 select g).ToList(); 366 377 } else { 367 378 //if the user is not in the access db add it (this makes it easy to upgrade with an existing asp.net authentication db) … … 379 390 throw new Exception("User with id " + userId + " not found."); 380 391 } else { 381 return Convert.ToDto(accessUser, aspUser );392 return Convert.ToDto(accessUser, aspUser, roles, groups); 382 393 } 383 394 } -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/Convert.cs
r7534 r7599 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using DA = HeuristicLab.Services.Access.DataAccess; … … 286 287 #region User 287 288 288 public static DT.LightweightUser ToDto(DA.User source, DA.aspnet_User aspUserSource ) {289 public static DT.LightweightUser ToDto(DA.User source, DA.aspnet_User aspUserSource, List<DA.aspnet_Role> roles, List<DA.UserGroup> groups) { 289 290 return new DT.LightweightUser() { 290 291 Id = source.Id, 291 292 FullName = source.FullName, 292 UserName = aspUserSource.UserName 293 UserName = aspUserSource.UserName, 294 Roles = roles.Select(x => Convert.ToDto(x)).ToArray(), 295 Groups = groups.Select(x => Convert.ToDto(x)).ToArray() 293 296 }; 294 297 } -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/DataTransfer/LightweightUser.cs
r7367 r7599 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Runtime.Serialization; 23 24 … … 29 30 [DataMember] 30 31 public string FullName { get; set; } 32 [DataMember] 33 public IEnumerable<DataTransfer.Role> Roles { get; set; } 34 [DataMember] 35 public IEnumerable<DataTransfer.UserGroup> Groups { get; set; } 31 36 } 32 37 }
Note: See TracChangeset
for help on using the changeset viewer.