Changeset 6465
- Timestamp:
- 06/21/11 17:54:32 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/HiveExperimentPermissionView.cs
r6463 r6465 34 34 public HiveExperimentPermissionView() { 35 35 InitializeComponent(); 36 permissionComboBox.Items.Add(Permission.Read Only);36 permissionComboBox.Items.Add(Permission.Read); 37 37 permissionComboBox.Items.Add(Permission.Full); 38 permissionComboBox.SelectedItem = Permission.Read Only;38 permissionComboBox.SelectedItem = Permission.Read; 39 39 } 40 40 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentListView.cs
r6381 r6465 33 33 public RefreshableHiveExperimentListView() { 34 34 InitializeComponent(); 35 this.itemsListView.View = View.Details; 36 this.itemsListView.Columns.Clear(); 37 this.itemsListView.Columns.Add(new ColumnHeader("Date") { Text = "Date" }); 38 this.itemsListView.Columns.Add(new ColumnHeader("Name") { Text = "Name" }); 39 this.itemsListView.HeaderStyle = ColumnHeaderStyle.Clickable; 40 this.itemsListView.FullRowSelect = true; 35 41 } 36 42 … … 45 51 } 46 52 } 53 54 protected override ListViewItem CreateListViewItem(RefreshableHiveExperiment item) { 55 ListViewItem listViewItem = base.CreateListViewItem(item); 56 listViewItem.SubItems.Clear(); 57 listViewItem.SubItems.Insert(0, new ListViewItem.ListViewSubItem(listViewItem, item.HiveExperiment.DateCreated.ToString("dd.MM.yyyy HH:mm"))); 58 listViewItem.SubItems.Insert(1, new ListViewItem.ListViewSubItem(listViewItem, item.HiveExperiment.Name)); 59 listViewItem.Group = GetListViewGroup(item.HiveExperiment.OwnerUsername); 60 return listViewItem; 61 } 62 63 private ListViewGroup GetListViewGroup(string groupName) { 64 foreach (ListViewGroup group in itemsListView.Groups) { 65 if (group.Name == groupName) 66 return group; 67 } 68 var newGroup = new ListViewGroup(string.Format("Owner ({0})", groupName), HorizontalAlignment.Left) { Name = groupName }; 69 itemsListView.Groups.Add(newGroup); 70 return newGroup; 71 } 47 72 } 48 73 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveExperimentPermission.cs
r6463 r6465 28 28 private string grantedUserName; 29 29 public string GrantedUserName { 30 get { return grantedUserName; } 31 set { grantedUserName = value; OnPropertyChanged(new PropertyChangedEventArgs("GrantedUserName")); } 30 get { return this.grantedUserName; } 31 set { 32 this.grantedUserName = value; 33 this.OnPropertyChanged(new PropertyChangedEventArgs("GrantedUserName")); 34 } 32 35 } 33 36 34 37 #region Constructors and Cloning 35 38 public HiveExperimentPermission() { 36 this.Permission = Hive.Permission.Read Only;39 this.Permission = Hive.Permission.Read; 37 40 this.PropertyChanged += new PropertyChangedEventHandler(HiveExperimentPermission_PropertyChanged); 38 41 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r6463 r6465 607 607 608 608 [System.Runtime.Serialization.OptionalFieldAttribute()] 609 private string OwnerUsernameField; 610 611 [System.Runtime.Serialization.OptionalFieldAttribute()] 609 612 private HeuristicLab.Clients.Hive.Permission PermissionField; 610 613 … … 710 713 this.OwnerUserIdField = value; 711 714 this.RaisePropertyChanged("OwnerUserId"); 715 } 716 } 717 } 718 719 [System.Runtime.Serialization.DataMemberAttribute()] 720 public string OwnerUsername 721 { 722 get 723 { 724 return this.OwnerUsernameField; 725 } 726 set 727 { 728 if ((object.ReferenceEquals(this.OwnerUsernameField, value) != true)) 729 { 730 this.OwnerUsernameField = value; 731 this.RaisePropertyChanged("OwnerUsername"); 712 732 } 713 733 } … … 1452 1472 1453 1473 [System.Runtime.Serialization.EnumMemberAttribute()] 1454 Read Only= 1,1474 Read = 1, 1455 1475 1456 1476 [System.Runtime.Serialization.EnumMemberAttribute()] -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperiment.cs
r6457 r6465 37 37 [DataMember] 38 38 public Permission Permission { get; set; } // the permission for the currently logged in user 39 [DataMember] 40 public string OwnerUsername { get; set; } 39 41 40 42 /* ==== some computed statistics ==== */ -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r6463 r6465 244 244 && (x.OwnerUserId == userManager.CurrentUserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0) 245 245 ).FirstOrDefault(); 246 if (hiveExperiment != null) hiveExperiment.Permission = dao.GetPermissionForExperiment(hiveExperiment.Id, userManager.CurrentUserId); 246 if (hiveExperiment != null) { 247 hiveExperiment.Permission = dao.GetPermissionForExperiment(hiveExperiment.Id, userManager.CurrentUserId); 248 hiveExperiment.OwnerUsername = userManager.GetUserById(hiveExperiment.OwnerUserId).UserName; 249 } 247 250 return hiveExperiment; 248 251 } … … 254 257 author.AuthorizeForExperiment(he.Id, Permission.Read); 255 258 he.Permission = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId); 259 he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName; 256 260 } 257 261 return hiveExperiments; … … 261 265 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 262 266 var hiveExperiments = dao.GetHiveExperiments(x => true); 263 foreach (var he in hiveExperiments) // no authorization here, since this method is admin-only! (admin is allowed to read all jobs)267 foreach (var he in hiveExperiments) { // no authorization here, since this method is admin-only! (admin is allowed to read all jobs) 264 268 he.Permission = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId); 269 he.OwnerUsername = userManager.GetUserById(he.OwnerUserId).UserName; 270 } 265 271 return hiveExperiments; 266 272 } … … 287 293 author.AuthorizeForExperiment(hiveExperimentId, Permission.Full); 288 294 trans.UseTransaction(() => { 289 HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId);290 295 dao.DeleteHiveExperiment(hiveExperimentId); // child jobs will be deleted by db-trigger 291 296 });
Note: See TracChangeset
for help on using the changeset viewer.