Changeset 7380
- Timestamp:
- 01/20/12 13:24:10 (13 years ago)
- Location:
- branches/ClientUserManagement
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/AccessClient.cs
r7375 r7380 93 93 94 94 public static void Store(IAccessItem item) { 95 //TODO: never used? delete?95 //TODO: prevent storing of lightweight users 96 96 } 97 97 -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/Views/LightweightUserView.cs
r7375 r7380 31 31 32 32 [View("LightweightUser View")] 33 [Content(typeof( CheckedItemList<LightweightUser>), true)]33 [Content(typeof(ReadOnlyCheckedItemList<LightweightUser>), true)] 34 34 public partial class LightweightUserView : CheckedItemListView<LightweightUser> { 35 35 public LightweightUserView() { 36 36 InitializeComponent(); 37 37 this.showDetailsCheckBox.Checked = false; 38 this.itemsGroupBox.Text = "Users"; 38 39 } 39 40 40 41 protected override void SetEnabledStateOfControls() { 41 42 base.SetEnabledStateOfControls(); 42 this.addButton.Enabled = false;43 43 this.showDetailsCheckBox.Enabled = false; 44 this.removeButton.Enabled = false;45 }46 47 protected override void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {48 base.itemsListView_SelectedIndexChanged(sender, e);49 this.removeButton.Enabled = false;50 44 } 51 45 -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/Views/RefreshableLightweightUserView.cs
r7375 r7380 34 34 public RefreshableLightweightUserView() { 35 35 InitializeComponent(); 36 37 36 } 38 37 39 //set an action like a webservice call to retrieve the users which should be marked as checked 40 //TODO: disable refresh button if not set 38 //set an action like a webservice call to retrieve the users which should be marked as checked 41 39 public Func<List<Guid>> FetchSelectedUsers { get; set; } 42 40 private List<Guid> selectedUsers; … … 64 62 checkedUsers.SetItemCheckedState(idx, selectedUsers.Contains(u.Id)); 65 63 }); 66 lightweightUserView.Content = checkedUsers; 64 lightweightUserView.Content = checkedUsers.AsReadOnly(); 65 } 66 67 protected override void SetEnabledStateOfControls() { 68 base.SetEnabledStateOfControls(); 69 refreshButton.Enabled = FetchSelectedUsers != null; 67 70 } 68 71 69 72 public ICheckedItemList<LightweightUser> GetCheckedUsers() { 70 if (lightweightUserView.Content == null) 71 return null; 72 else 73 return lightweightUserView.Content; 73 return (lightweightUserView.Content == null) ? null : lightweightUserView.Content; 74 74 } 75 75 -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/Views/RefreshableView.cs
r7368 r7380 49 49 } 50 50 51 52 protected override void OnContentChanged() {53 base.OnContentChanged();54 if (Content == null) {55 //TODO: remove?56 } else {57 58 }59 }60 61 51 protected override void SetEnabledStateOfControls() { 62 52 base.SetEnabledStateOfControls(); -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r7368 r7380 278 278 DA.User accessUser = null; 279 279 280 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {281 var query = from u in context.UserGroupBases.OfType<DA.User>()282 where u.Id == userId283 select u;284 if (query.Count() == 1) {285 accessUser = query.First();286 } else {287 //if the user is not in the access db at it288 DA.User user = new DA.User();289 user.Id = userId;290 user.FullName = "Not set";291 context.UserGroupBases.InsertOnSubmit(user);292 context.SubmitChanges();293 accessUser = user;294 }295 }296 297 280 using (DA.ASPNETAuthenticationDataContext context = new DA.ASPNETAuthenticationDataContext()) { 298 281 var userQuery = from u in context.aspnet_Users … … 311 294 } 312 295 296 if (aspUser == null || aspMembership == null) { 297 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 298 var query = from u in context.UserGroupBases.OfType<DA.User>() 299 where u.Id == userId 300 select u; 301 if (query.Count() == 1) { 302 accessUser = query.First(); 303 } else { 304 //if the user is not in the access db add it (this makes it easy to upgrade with an existing asp.net authentication db) 305 DA.User user = new DA.User(); 306 user.Id = userId; 307 user.FullName = "Not set"; 308 context.UserGroupBases.InsertOnSubmit(user); 309 context.SubmitChanges(); 310 accessUser = user; 311 } 312 } 313 } 314 313 315 if (aspUser == null || aspMembership == null || accessUser == null) { 314 //TODO: error handling 315 return null; 316 throw new Exception("User with id " + userId + " not found."); 316 317 } else { 317 318 return Convert.ToDto(accessUser, aspUser, aspMembership); … … 332 333 } 333 334 334 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 335 var query = from u in context.UserGroupBases.OfType<DA.User>() 336 where u.Id == userId 337 select u; 338 if (query.Count() == 1) { 339 accessUser = query.First(); 340 } else { 341 //if the user is not in the access db at it 342 DA.User user = new DA.User(); 343 user.Id = userId; 344 user.FullName = "Not set"; 345 context.UserGroupBases.InsertOnSubmit(user); 346 context.SubmitChanges(); 347 accessUser = user; 335 if (aspUser != null) { 336 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 337 var query = from u in context.UserGroupBases.OfType<DA.User>() 338 where u.Id == userId 339 select u; 340 if (query.Count() == 1) { 341 accessUser = query.First(); 342 } else { 343 //if the user is not in the access db add it (this makes it easy to upgrade with an existing asp.net authentication db) 344 DA.User user = new DA.User(); 345 user.Id = userId; 346 user.FullName = "Not set"; 347 context.UserGroupBases.InsertOnSubmit(user); 348 context.SubmitChanges(); 349 accessUser = user; 350 } 348 351 } 349 352 } 350 353 351 354 if (aspUser == null || accessUser == null) { 352 //TODO: error handling 353 return null; 355 throw new Exception("User with id " + userId + " not found."); 354 356 } else { 355 357 return Convert.ToDto(accessUser, aspUser); … … 365 367 List<Guid> accessUserGuids = null; 366 368 367 using (DA. ClientManagementDataContext context = new DA.ClientManagementDataContext()) {368 var query = from u in context. UserGroupBases.OfType<DA.User>()369 select u. Id;369 using (DA.ASPNETAuthenticationDataContext context = new DA.ASPNETAuthenticationDataContext()) { 370 var query = from u in context.aspnet_Users 371 select u.UserId; 370 372 accessUserGuids = query.ToList(); 371 373 } 372 373 374 return accessUserGuids.Select(x => BuildLightweightUserDto(x)); 374 375 } … … 377 378 List<Guid> accessUserGuids = null; 378 379 379 using (DA. ClientManagementDataContext context = new DA.ClientManagementDataContext()) {380 var query = from u in context. UserGroupBases.OfType<DA.User>()381 select u. Id;380 using (DA.ASPNETAuthenticationDataContext context = new DA.ASPNETAuthenticationDataContext()) { 381 var query = from u in context.aspnet_Users 382 select u.UserId; 382 383 accessUserGuids = query.ToList(); 383 384 }
Note: See TracChangeset
for help on using the changeset viewer.