- Timestamp:
- 07/10/18 23:06:00 (6 years ago)
- Location:
- branches/2839_HiveProjectManagement
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs
r15966 r15992 82 82 nameTextBox.Text = Content.Name; 83 83 descriptionTextBox.Text = Content.Description; 84 ownerComboBox.SelectedItem = AccessClient.Instance.UsersAndGroups.FirstOrDefault(x => x.Id == Content.OwnerUserId); 84 85 ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged; 86 var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>(); 87 if (!Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator)); 88 ownerComboBox.DataSource = users.ToList(); 89 ownerComboBox.SelectedItem = users.FirstOrDefault(x => x.Id == Content.OwnerUserId); 90 ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged; 91 85 92 createdTextBox.Text = Content.DateCreated.ToString("ddd, dd.MM.yyyy, HH:mm:ss"); 86 93 startDateTimePicker.Value = Content.StartDate; … … 135 142 finallyCallback: () => { 136 143 ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged; 137 ownerComboBox.DataSource = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>().ToList(); 144 var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>(); 145 if (Content != null && !Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator)); 146 ownerComboBox.DataSource = users.ToList(); 138 147 ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged; 139 148 }); … … 150 159 finallyCallback: () => { 151 160 ownerComboBox.SelectedIndexChanged -= ownerComboBox_SelectedIndexChanged; 152 ownerComboBox.DataSource = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>().ToList(); 153 ownerComboBox.SelectedItem = AccessClient.Instance.UsersAndGroups.FirstOrDefault(x => x.Id == persistedOwnerUserId); 161 var users = AccessClient.Instance.UsersAndGroups.OfType<LightweightUser>(); 162 if (Content != null && !Content.ParentProjectId.HasValue) users = users.Where(x => x.Roles.Select(y => y.Name).Contains(HiveRoles.Administrator)); 163 ownerComboBox.DataSource = users.ToList(); 164 ownerComboBox.SelectedItem = users.FirstOrDefault(x => x.Id == persistedOwnerUserId); 154 165 ownerComboBox.SelectedIndexChanged += ownerComboBox_SelectedIndexChanged; 155 166 refreshButton.Enabled = true; … … 203 214 private void indefiniteCheckBox_CheckedChanged(object sender, EventArgs e) { 204 215 if (Content == null) return; 205 var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : Content.StartDate;216 var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : endDateTimePicker.Value; 206 217 endDateTimePicker.Enabled = !indefiniteCheckBox.Checked; 207 218 if (Content.EndDate != newEndDate) { 208 219 DeregisterContentEvents(); 209 220 Content.EndDate = newEndDate; 210 endDateTimePicker.Value = newEndDate.HasValue ? newEndDate.Value : Content.StartDate;211 221 RegisterContentEvents(); 212 222 } -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r15966 r15992 110 110 bool enabled = Content != null && !Locked && !ReadOnly; 111 111 refreshButton.Enabled = enabled; 112 addButton.Enabled = enabled;113 removeButton.Enabled = enabled;114 saveProjectButton.Enabled = enabled;112 //addButton.Enabled = enabled; 113 //removeButton.Enabled = enabled; 114 //saveProjectButton.Enabled = enabled; 115 115 projectView.Enabled = enabled; 116 116 projectPermissionsView.Enabled = enabled; … … 199 199 Guid? parentProjectId = null; 200 200 201 if(selectedProject == null && !IsAdmin()) { 202 MessageBox.Show( 203 "You are not allowed to add a root project - please select a parent project.", 204 "HeuristicLab Hive Administrator", 205 MessageBoxButtons.OK, 206 MessageBoxIcon.Information); 207 return; 208 } 209 201 210 if (selectedProject != null && selectedProject.Id == Guid.Empty) { 202 211 MessageBox.Show( … … 459 468 bool projectIsNew = project != null && project.Id == Guid.Empty; 460 469 bool locked = project == null || projectIsNew; 470 471 // if the project is new, or: 472 // the project does have any descendant projects and 473 // the user is an admin or owner of a parent project 461 474 bool deleteEnabled = project != null && ( 462 475 projectIsNew 463 || HiveAdminClient.Instance.CheckOwnershipOfParentProject(project, UserInformation.Instance.User.Id) 464 || !HiveAdminClient.Instance.ProjectDescendants[project.Id].Any()); 465 466 addButton.Enabled = !locked; 476 || (!HiveAdminClient.Instance.ProjectDescendants[project.Id].Any() 477 && (HiveAdminClient.Instance.CheckOwnershipOfParentProject(project, UserInformation.Instance.User.Id) 478 || IsAdmin()) 479 ) 480 ); 481 482 bool addEnabled = !locked; 483 if (!IsAdmin() && project == null) addEnabled = false; 484 485 bool saveEnabled = project != null; 486 if (!IsAdmin() && !project.ParentProjectId.HasValue) saveEnabled = false; 487 488 addButton.Enabled = addEnabled; 467 489 removeButton.Enabled = deleteEnabled; 490 saveProjectButton.Enabled = saveEnabled; 468 491 projectPermissionsView.Locked = locked; 469 492 projectResourcesView.Locked = locked; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj
r15412 r15992 105 105 <Compile Include="ExtensionMethods\TreeNodeExtensions.cs" /> 106 106 <Compile Include="ListViewItemDateComparer.cs" /> 107 <Compile Include="ListViewItemComparer.cs" /> 107 108 <Compile Include="MenuItems\CreateHiveJobMenuItem.cs" /> 108 109 <Compile Include="MenuItems\RunInHiveMenuItem.cs" /> … … 244 245 <Private>False</Private> 245 246 </ProjectReference> 247 </ItemGroup> 248 <ItemGroup> 249 <EmbeddedResource Include="Views\RefreshableHiveJobView.resx"> 250 <DependentUpon>RefreshableHiveJobView.cs</DependentUpon> 251 </EmbeddedResource> 246 252 </ItemGroup> 247 253 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs
r15978 r15992 43 43 public const string additionalSlavesGroupDescription = "Contains additional slaves which are either ungrouped or the parenting slave group is not assigned to the selected project."; 44 44 45 private const string CURRENT_SELECTION_TAG = " [current selection]";46 private const string NEW_SELECTION_TAG = " [new selection]";47 private const string CHANGED_SELECTION_TAG = " [changed selection]";48 private const string ADDED_SELECTION_TAG = " [added selection]";49 private const string REMOVED_SELECTION_TAG = " [removed selection]";50 private const string SELECTED_TAG = " [ selected]";45 private const string CURRENT_SELECTION_TAG = " [current assignment]"; 46 private const string NEW_SELECTION_TAG = " [new assignment]"; 47 private const string CHANGED_SELECTION_TAG = " [changed assignment]"; 48 private const string ADDED_SELECTION_TAG = " [added assignment]"; 49 private const string REMOVED_SELECTION_TAG = " [removed assignment]"; 50 private const string SELECTED_TAG = " [assigned]"; 51 51 private const string INCLUDED_TAG = " [included]"; 52 52 private const string ADDED_INCLUDE_TAG = " [added include]"; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs
r14185 r15992 41 41 this.itemsListView.Columns.Add(new ColumnHeader("Date") { Text = "Date" }); 42 42 this.itemsListView.Columns.Add(new ColumnHeader("Name") { Text = "Name" }); 43 this.itemsListView.Columns.Add(new ColumnHeader("Project") { Text = "Project" }); 43 44 44 45 this.itemsListView.HeaderStyle = ColumnHeaderStyle.Clickable; 45 46 this.itemsListView.FullRowSelect = true; 46 47 47 this.itemsListView.ListViewItemSorter = new ListViewItemDateComparer(0, SortOrder.Ascending); 48 this.itemsListView.ListViewItemSorter = new ListViewItemComparer(new int[] { 2, 0 }, new SortOrder[] { SortOrder.Ascending, SortOrder.Ascending }); 49 50 foreach (ColumnHeader c in this.itemsListView.Columns) { 51 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 52 int w = c.Width; 53 c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 54 if(w > c.Width) { 55 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 56 } 57 } 48 58 } 49 59 50 60 protected override void SortItemsListView(SortOrder sortOrder) { 51 61 if (itemsListView.Sorting == sortOrder || sortOrder == SortOrder.None) return; 52 ((ListViewItem DateComparer)itemsListView.ListViewItemSorter).Order= sortOrder;62 ((ListViewItemComparer)itemsListView.ListViewItemSorter).Orders[1] = sortOrder; 53 63 itemsListView.Sorting = sortOrder; 54 64 itemsListView.Sort(); 55 AdjustListViewColumnSizes();65 //AdjustListViewColumnSizes(); 56 66 } 57 67 … … 133 143 base.Content_ItemsAdded(sender, e); 134 144 foreach (ColumnHeader c in this.itemsListView.Columns) { 145 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 146 int w = c.Width; 135 147 c.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); 148 if (w > c.Width) { 149 c.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); 150 } 136 151 } 137 152 foreach (var item in e.Items) { … … 180 195 listViewItem.SubItems.Insert(0, new ListViewItem.ListViewSubItem(listViewItem, item.Job.DateCreated.ToString())); 181 196 listViewItem.SubItems.Insert(1, new ListViewItem.ListViewSubItem(listViewItem, item.Job.Name)); 197 listViewItem.SubItems.Insert(2, new ListViewItem.ListViewSubItem(listViewItem, HiveClient.Instance.GetProjectAncestry(item.Job.ProjectId))); 198 182 199 listViewItem.Group = GetListViewGroup(item.Job.OwnerUsername); 183 200 return listViewItem; … … 189 206 listViewItem.SubItems[0].Text = item == null ? "null" : item.Job.DateCreated.ToString("dd.MM.yyyy HH:mm"); 190 207 listViewItem.SubItems[1].Text = item == null ? "null" : item.Job.Name; 208 listViewItem.SubItems[2].Text = item == null ? "null" : HiveClient.Instance.GetProjectAncestry(item.Job.ProjectId); 191 209 listViewItem.Group = GetListViewGroup(item.Job.OwnerUsername); 192 210 listViewItem.ToolTipText = item == null ? string.Empty : item.ItemName + ": " + item.ItemDescription; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r15953 r15992 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RefreshableHiveJobView)); 48 49 this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl(); 49 50 this.tasksTabPage = new System.Windows.Forms.TabPage(); … … 51 52 this.permissionTabPage = new System.Windows.Forms.TabPage(); 52 53 this.refreshPermissionsButton = new System.Windows.Forms.Button(); 54 this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.JobManager.Views.HiveJobPermissionListView(); 53 55 this.runsTabPage = new System.Windows.Forms.TabPage(); 54 56 this.runCollectionViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); … … 66 68 this.nameLabel = new System.Windows.Forms.Label(); 67 69 this.nameTextBox = new System.Windows.Forms.TextBox(); 70 this.descriptionLabel = new System.Windows.Forms.Label(); 71 this.descriptionTextBox = new System.Windows.Forms.TextBox(); 68 72 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 69 73 this.refreshButton = new System.Windows.Forms.Button(); 70 74 this.updateButton = new System.Windows.Forms.Button(); 71 75 this.UnloadButton = new System.Windows.Forms.Button(); 76 this.searchButton = new System.Windows.Forms.Button(); 72 77 this.refreshAutomaticallyCheckBox = new System.Windows.Forms.CheckBox(); 73 78 this.infoGroupBox = new System.Windows.Forms.GroupBox(); … … 78 83 this.calculatingLabel = new System.Windows.Forms.Label(); 79 84 this.jobsLabel = new System.Windows.Forms.Label(); 80 this.searchButton = new System.Windows.Forms.Button();81 this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.JobManager.Views.HiveJobPermissionListView();82 85 this.tabControl.SuspendLayout(); 83 86 this.tasksTabPage.SuspendLayout(); … … 100 103 this.tabControl.Controls.Add(this.stateTabPage); 101 104 this.tabControl.Controls.Add(this.logTabPage); 102 this.tabControl.Location = new System.Drawing.Point(0, 78);105 this.tabControl.Location = new System.Drawing.Point(0, 106); 103 106 this.tabControl.Name = "tabControl"; 104 107 this.tabControl.SelectedIndex = 0; … … 147 150 // refreshPermissionsButton 148 151 // 149 this.refreshPermissionsButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;152 this.refreshPermissionsButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshPermissionsButton.Image"))); 150 153 this.refreshPermissionsButton.Location = new System.Drawing.Point(3, 3); 151 154 this.refreshPermissionsButton.Name = "refreshPermissionsButton"; … … 155 158 this.refreshPermissionsButton.UseVisualStyleBackColor = true; 156 159 this.refreshPermissionsButton.Click += new System.EventHandler(this.refreshPermissionsButton_Click); 160 // 161 // hiveExperimentPermissionListView 162 // 163 this.hiveExperimentPermissionListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 164 | System.Windows.Forms.AnchorStyles.Left) 165 | System.Windows.Forms.AnchorStyles.Right))); 166 this.hiveExperimentPermissionListView.Caption = "HiveExperimentPermissionList View"; 167 this.hiveExperimentPermissionListView.Content = null; 168 this.hiveExperimentPermissionListView.HiveExperimentId = new System.Guid("00000000-0000-0000-0000-000000000000"); 169 this.hiveExperimentPermissionListView.Location = new System.Drawing.Point(3, 33); 170 this.hiveExperimentPermissionListView.Name = "hiveExperimentPermissionListView"; 171 this.hiveExperimentPermissionListView.ReadOnly = false; 172 this.hiveExperimentPermissionListView.ShowDetails = true; 173 this.hiveExperimentPermissionListView.Size = new System.Drawing.Size(703, 390); 174 this.hiveExperimentPermissionListView.TabIndex = 0; 157 175 // 158 176 // runsTabPage … … 235 253 // 236 254 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 237 this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;238 this.startButton.Location = new System.Drawing.Point(0, 5 36);255 this.startButton.Image = ((System.Drawing.Image)(resources.GetObject("startButton.Image"))); 256 this.startButton.Location = new System.Drawing.Point(0, 564); 239 257 this.startButton.Name = "startButton"; 240 258 this.startButton.Size = new System.Drawing.Size(24, 24); 241 this.startButton.TabIndex = 5;259 this.startButton.TabIndex = 4; 242 260 this.toolTip.SetToolTip(this.startButton, "Start/Resume Experiment"); 243 261 this.startButton.UseVisualStyleBackColor = true; … … 247 265 // 248 266 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 249 this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop;250 this.stopButton.Location = new System.Drawing.Point(60, 5 36);267 this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image"))); 268 this.stopButton.Location = new System.Drawing.Point(60, 564); 251 269 this.stopButton.Name = "stopButton"; 252 270 this.stopButton.Size = new System.Drawing.Size(24, 24); 253 this.stopButton.TabIndex = 7;271 this.stopButton.TabIndex = 6; 254 272 this.toolTip.SetToolTip(this.stopButton, "Stop Experiment"); 255 273 this.stopButton.UseVisualStyleBackColor = true; … … 260 278 this.executionTimeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 261 279 this.executionTimeLabel.AutoSize = true; 262 this.executionTimeLabel.Location = new System.Drawing.Point(491, 5 43);280 this.executionTimeLabel.Location = new System.Drawing.Point(491, 571); 263 281 this.executionTimeLabel.Name = "executionTimeLabel"; 264 282 this.executionTimeLabel.Size = new System.Drawing.Size(83, 13); 265 this.executionTimeLabel.TabIndex = 9;283 this.executionTimeLabel.TabIndex = 100; 266 284 this.executionTimeLabel.Text = "&Execution Time:"; 267 285 // … … 269 287 // 270 288 this.executionTimeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 271 this.executionTimeTextBox.Location = new System.Drawing.Point(580, 5 40);289 this.executionTimeTextBox.Location = new System.Drawing.Point(580, 568); 272 290 this.executionTimeTextBox.Name = "executionTimeTextBox"; 273 291 this.executionTimeTextBox.ReadOnly = true; 274 292 this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20); 275 this.executionTimeTextBox.TabIndex = 10 ;293 this.executionTimeTextBox.TabIndex = 100; 276 294 // 277 295 // pauseButton … … 279 297 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 280 298 this.pauseButton.Enabled = false; 281 this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause;282 this.pauseButton.Location = new System.Drawing.Point(30, 5 36);299 this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image"))); 300 this.pauseButton.Location = new System.Drawing.Point(30, 564); 283 301 this.pauseButton.Name = "pauseButton"; 284 302 this.pauseButton.Size = new System.Drawing.Size(24, 24); 285 this.pauseButton.TabIndex = 6;303 this.pauseButton.TabIndex = 5; 286 304 this.toolTip.SetToolTip(this.pauseButton, "Pause Experiment"); 287 305 this.pauseButton.UseVisualStyleBackColor = true; … … 291 309 // 292 310 this.projectLabel.AutoSize = true; 293 this.projectLabel.Location = new System.Drawing.Point(3, 56);311 this.projectLabel.Location = new System.Drawing.Point(3, 83); 294 312 this.projectLabel.Name = "projectLabel"; 295 313 this.projectLabel.Size = new System.Drawing.Size(43, 13); 296 this.projectLabel.TabIndex = 1 2;314 this.projectLabel.TabIndex = 100; 297 315 this.projectLabel.Text = "Project:"; 298 316 // … … 301 319 this.projectNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 302 320 | System.Windows.Forms.AnchorStyles.Right))); 303 this.projectNameTextBox.Location = new System.Drawing.Point( 82, 52);321 this.projectNameTextBox.Location = new System.Drawing.Point(100, 80); 304 322 this.projectNameTextBox.Name = "projectNameTextBox"; 305 323 this.projectNameTextBox.ReadOnly = true; 306 this.projectNameTextBox.Size = new System.Drawing.Size(4 89, 20);307 this.projectNameTextBox.TabIndex = 2;324 this.projectNameTextBox.Size = new System.Drawing.Size(471, 20); 325 this.projectNameTextBox.TabIndex = 100; 308 326 this.projectNameTextBox.Validated += new System.EventHandler(this.resourceNamesTextBox_Validated); 309 327 // … … 311 329 // 312 330 this.nameLabel.AutoSize = true; 313 this.nameLabel.Location = new System.Drawing.Point(3, 3 0);331 this.nameLabel.Location = new System.Drawing.Point(3, 35); 314 332 this.nameLabel.Name = "nameLabel"; 315 333 this.nameLabel.Size = new System.Drawing.Size(38, 13); 316 this.nameLabel.TabIndex = 20;334 this.nameLabel.TabIndex = 100; 317 335 this.nameLabel.Text = "Name:"; 318 336 // … … 321 339 this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 322 340 | System.Windows.Forms.AnchorStyles.Right))); 323 this.nameTextBox.Location = new System.Drawing.Point( 52, 27);341 this.nameTextBox.Location = new System.Drawing.Point(71, 32); 324 342 this.nameTextBox.Name = "nameTextBox"; 325 this.nameTextBox.Size = new System.Drawing.Size(5 19, 20);343 this.nameTextBox.Size = new System.Drawing.Size(500, 20); 326 344 this.nameTextBox.TabIndex = 1; 327 345 this.nameTextBox.Validated += new System.EventHandler(this.nameTextBox_Validated); 328 346 // 347 // descriptionLabel 348 // 349 this.descriptionLabel.AutoSize = true; 350 this.descriptionLabel.Location = new System.Drawing.Point(3, 59); 351 this.descriptionLabel.Name = "descriptionLabel"; 352 this.descriptionLabel.Size = new System.Drawing.Size(63, 13); 353 this.descriptionLabel.TabIndex = 100; 354 this.descriptionLabel.Text = "Description:"; 355 // 356 // descriptionTextBox 357 // 358 this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 359 | System.Windows.Forms.AnchorStyles.Right))); 360 this.descriptionTextBox.Location = new System.Drawing.Point(71, 56); 361 this.descriptionTextBox.Name = "descriptionTextBox"; 362 this.descriptionTextBox.Size = new System.Drawing.Size(500, 20); 363 this.descriptionTextBox.TabIndex = 2; 364 this.descriptionTextBox.Validated += new System.EventHandler(this.descriptionTextBox_Validated); 365 // 329 366 // refreshButton 330 367 // 331 this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;368 this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image"))); 332 369 this.refreshButton.Location = new System.Drawing.Point(3, 0); 333 370 this.refreshButton.Name = "refreshButton"; 334 371 this.refreshButton.Size = new System.Drawing.Size(24, 24); 335 this.refreshButton.TabIndex = 22;372 this.refreshButton.TabIndex = 7; 336 373 this.toolTip.SetToolTip(this.refreshButton, "Refresh Data"); 337 374 this.refreshButton.UseVisualStyleBackColor = true; … … 340 377 // updateButton 341 378 // 342 this.updateButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Save;379 this.updateButton.Image = ((System.Drawing.Image)(resources.GetObject("updateButton.Image"))); 343 380 this.updateButton.Location = new System.Drawing.Point(30, 0); 344 381 this.updateButton.Name = "updateButton"; 345 382 this.updateButton.Size = new System.Drawing.Size(24, 24); 346 this.updateButton.TabIndex = 23;383 this.updateButton.TabIndex = 8; 347 384 this.toolTip.SetToolTip(this.updateButton, "Update Job (Name, Project, Resources)"); 348 385 this.updateButton.UseVisualStyleBackColor = true; … … 351 388 // UnloadButton 352 389 // 353 this.UnloadButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Disconnect;390 this.UnloadButton.Image = ((System.Drawing.Image)(resources.GetObject("UnloadButton.Image"))); 354 391 this.UnloadButton.Location = new System.Drawing.Point(57, 0); 355 392 this.UnloadButton.Name = "UnloadButton"; 356 393 this.UnloadButton.Size = new System.Drawing.Size(24, 24); 357 this.UnloadButton.TabIndex = 27;394 this.UnloadButton.TabIndex = 9; 358 395 this.toolTip.SetToolTip(this.UnloadButton, "Unload Job"); 359 396 this.UnloadButton.UseVisualStyleBackColor = true; 360 397 this.UnloadButton.Click += new System.EventHandler(this.UnloadButton_Click); 398 // 399 // searchButton 400 // 401 this.searchButton.Image = ((System.Drawing.Image)(resources.GetObject("searchButton.Image"))); 402 this.searchButton.Location = new System.Drawing.Point(71, 79); 403 this.searchButton.Name = "searchButton"; 404 this.searchButton.Size = new System.Drawing.Size(24, 24); 405 this.searchButton.TabIndex = 3; 406 this.toolTip.SetToolTip(this.searchButton, "Select project and resources"); 407 this.searchButton.UseVisualStyleBackColor = true; 408 this.searchButton.Click += new System.EventHandler(this.searchButton_Click); 361 409 // 362 410 // refreshAutomaticallyCheckBox … … 366 414 this.refreshAutomaticallyCheckBox.Name = "refreshAutomaticallyCheckBox"; 367 415 this.refreshAutomaticallyCheckBox.Size = new System.Drawing.Size(127, 17); 368 this.refreshAutomaticallyCheckBox.TabIndex = 24;416 this.refreshAutomaticallyCheckBox.TabIndex = 100; 369 417 this.refreshAutomaticallyCheckBox.Text = "&Refresh automatically"; 370 418 this.refreshAutomaticallyCheckBox.UseVisualStyleBackColor = true; … … 380 428 this.infoGroupBox.Controls.Add(this.calculatingLabel); 381 429 this.infoGroupBox.Controls.Add(this.jobsLabel); 382 this.infoGroupBox.Location = new System.Drawing.Point(5 80, 5);430 this.infoGroupBox.Location = new System.Drawing.Point(578, 16); 383 431 this.infoGroupBox.Name = "infoGroupBox"; 384 432 this.infoGroupBox.Size = new System.Drawing.Size(133, 89); … … 394 442 this.finishedTextBox.Name = "finishedTextBox"; 395 443 this.finishedTextBox.Size = new System.Drawing.Size(53, 20); 396 this.finishedTextBox.TabIndex = 5;444 this.finishedTextBox.TabIndex = 100; 397 445 // 398 446 // calculatingTextBox … … 403 451 this.calculatingTextBox.Name = "calculatingTextBox"; 404 452 this.calculatingTextBox.Size = new System.Drawing.Size(53, 20); 405 this.calculatingTextBox.TabIndex = 4;453 this.calculatingTextBox.TabIndex = 100; 406 454 // 407 455 // jobsTextBox … … 412 460 this.jobsTextBox.Name = "jobsTextBox"; 413 461 this.jobsTextBox.Size = new System.Drawing.Size(53, 20); 414 this.jobsTextBox.TabIndex = 3;462 this.jobsTextBox.TabIndex = 100; 415 463 // 416 464 // finishedLabel … … 420 468 this.finishedLabel.Name = "finishedLabel"; 421 469 this.finishedLabel.Size = new System.Drawing.Size(49, 13); 422 this.finishedLabel.TabIndex = 2;470 this.finishedLabel.TabIndex = 100; 423 471 this.finishedLabel.Text = "Finished:"; 424 472 // … … 429 477 this.calculatingLabel.Name = "calculatingLabel"; 430 478 this.calculatingLabel.Size = new System.Drawing.Size(62, 13); 431 this.calculatingLabel.TabIndex = 1 ;479 this.calculatingLabel.TabIndex = 100; 432 480 this.calculatingLabel.Text = "Calculating:"; 433 481 // … … 438 486 this.jobsLabel.Name = "jobsLabel"; 439 487 this.jobsLabel.Size = new System.Drawing.Size(46, 13); 440 this.jobsLabel.TabIndex = 0;488 this.jobsLabel.TabIndex = 100; 441 489 this.jobsLabel.Text = "Waiting:"; 442 //443 // searchButton444 //445 this.searchButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Zoom;446 this.searchButton.Location = new System.Drawing.Point(52, 50);447 this.searchButton.Name = "searchButton";448 this.searchButton.Size = new System.Drawing.Size(24, 24);449 this.searchButton.TabIndex = 26;450 this.toolTip.SetToolTip(this.searchButton, "Select project and resources");451 this.searchButton.UseVisualStyleBackColor = true;452 this.searchButton.Click += new System.EventHandler(this.searchButton_Click);453 //454 // hiveExperimentPermissionListView455 //456 this.hiveExperimentPermissionListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)457 | System.Windows.Forms.AnchorStyles.Left)458 | System.Windows.Forms.AnchorStyles.Right)));459 this.hiveExperimentPermissionListView.Caption = "HiveExperimentPermissionList View";460 this.hiveExperimentPermissionListView.Content = null;461 this.hiveExperimentPermissionListView.HiveExperimentId = new System.Guid("00000000-0000-0000-0000-000000000000");462 this.hiveExperimentPermissionListView.Location = new System.Drawing.Point(3, 33);463 this.hiveExperimentPermissionListView.Name = "hiveExperimentPermissionListView";464 this.hiveExperimentPermissionListView.ReadOnly = false;465 this.hiveExperimentPermissionListView.ShowDetails = true;466 this.hiveExperimentPermissionListView.Size = new System.Drawing.Size(703, 390);467 this.hiveExperimentPermissionListView.TabIndex = 0;468 490 // 469 491 // RefreshableHiveJobView … … 478 500 this.Controls.Add(this.nameTextBox); 479 501 this.Controls.Add(this.nameLabel); 502 this.Controls.Add(this.descriptionTextBox); 503 this.Controls.Add(this.descriptionLabel); 480 504 this.Controls.Add(this.tabControl); 481 505 this.Controls.Add(this.startButton); … … 487 511 this.Controls.Add(this.stopButton); 488 512 this.Name = "RefreshableHiveJobView"; 489 this.Size = new System.Drawing.Size(717, 5 60);513 this.Size = new System.Drawing.Size(717, 588); 490 514 this.tabControl.ResumeLayout(false); 491 515 this.tasksTabPage.ResumeLayout(false); … … 515 539 private System.Windows.Forms.Label nameLabel; 516 540 private System.Windows.Forms.TextBox nameTextBox; 541 private System.Windows.Forms.Label descriptionLabel; 542 private System.Windows.Forms.TextBox descriptionTextBox; 517 543 private System.Windows.Forms.ToolTip toolTip; 518 544 private System.Windows.Forms.Button refreshButton; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.cs
r15966 r15992 121 121 if (Content == null) { 122 122 nameTextBox.Text = string.Empty; 123 descriptionTextBox.Text = string.Empty; 123 124 executionTimeTextBox.Text = string.Empty; 124 125 projectNameTextBox.Text = string.Empty; … … 139 140 140 141 nameTextBox.Text = Content.Job.Name; 142 descriptionTextBox.Text = Content.Job.Description; 141 143 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 142 144 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; … … 183 185 tabControl.Enabled = !Locked; 184 186 nameTextBox.Enabled = !Locked; 187 descriptionTextBox.Enabled = !Locked; 185 188 projectNameTextBox.Enabled = !Locked; 186 189 searchButton.Enabled = !Locked; … … 208 211 209 212 this.nameTextBox.ReadOnly = Content.IsProgressing; 213 this.descriptionTextBox.ReadOnly = Content.IsProgressing; 210 214 this.searchButton.Enabled = !Content.IsProgressing && Content.ExecutionState != ExecutionState.Stopped; 211 215 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded || Content.IsProgressing; … … 457 461 } 458 462 463 private void descriptionTextBox_Validated(object sender, EventArgs e) { 464 if (!SuppressEvents && Content.Job != null && Content.Job.Description != descriptionTextBox.Text) 465 Content.Job.Description = descriptionTextBox.Text; 466 } 467 459 468 private void resourceNamesTextBox_Validated(object sender, EventArgs e) { 460 469 //if (!SuppressEvents && Content.Job != null && Content.Job.ResourceNames != resourceNamesTextBox.Text) … … 478 487 } 479 488 489 private void updateButton_Click2(object sender, EventArgs e) { 490 if (Content.ExecutionState == ExecutionState.Stopped) { 491 MessageBox.Show("Job cannot be updated once it stopped.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); 492 return; 493 } 494 495 HiveClient.UpdateJob( 496 (Exception ex) => ErrorHandling.ShowErrorDialog(this, "Update failed.", ex), 497 Content, 498 new CancellationToken()); 499 UpdateSelectorDialog(); 500 } 501 480 502 private void updateButton_Click(object sender, EventArgs e) { 481 503 if (Content.ExecutionState == ExecutionState.Stopped) { … … 484 506 } 485 507 486 HiveClient.UpdateJob( 487 (Exception ex) => ErrorHandling.ShowErrorDialog(this, "Update failed.", ex), 488 Content, 489 new CancellationToken()); 508 var invoker = new Action<RefreshableJob>(HiveClient.UpdateJob); 509 invoker.BeginInvoke(Content, (ar) => { 510 try { 511 invoker.EndInvoke(ar); 512 } catch (Exception ex) { 513 ThreadPool.QueueUserWorkItem(delegate (object exception) { ErrorHandling.ShowErrorDialog(this, (Exception)exception); }, ex); 514 } 515 }, null); 490 516 UpdateSelectorDialog(); 491 517 } -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive/3.3/HiveClient.cs
r15978 r15992 151 151 }); 152 152 153 UpdateResourceGenealogy();154 UpdateProjectGenealogy();155 UpdateDisabledParentProjects();153 RefreshResourceGenealogy(); 154 RefreshProjectGenealogy(); 155 RefreshDisabledParentProjects(); 156 156 } 157 157 catch { … … 186 186 }); 187 187 188 UpdateResourceGenealogy();189 UpdateProjectGenealogy();190 UpdateDisabledParentProjects();188 RefreshResourceGenealogy(); 189 RefreshProjectGenealogy(); 190 RefreshDisabledParentProjects(); 191 191 } catch { 192 192 projects = null; … … 214 214 } 215 215 216 private void UpdateResourceGenealogy() {216 private void RefreshResourceGenealogy() { 217 217 resourceAncestors.Clear(); 218 218 resourceDescendants.Clear(); … … 234 234 } 235 235 236 private void UpdateProjectGenealogy() {236 private void RefreshProjectGenealogy() { 237 237 projectAncestors.Clear(); 238 238 projectDescendants.Clear(); … … 254 254 } 255 255 256 private void UpdateDisabledParentProjects() {256 private void RefreshDisabledParentProjects() { 257 257 disabledParentProjects = new HashSet<Project>(); 258 258 … … 414 414 415 415 public static void UpdateJob(Action<Exception> exceptionCallback, RefreshableJob refreshableJob, CancellationToken cancellationToken) { 416 HiveServiceLocator.Instance.CallHiveService(service => { 417 HiveClient.StoreAsync( 418 new Action<Exception>((Exception ex) => { 419 //refreshableJob.ExecutionState = ExecutionState.Prepared; 420 exceptionCallback(ex); 421 }), refreshableJob.Job, cancellationToken); 422 }); 423 } 416 refreshableJob.IsProgressing = true; 417 refreshableJob.Progress.Status = "Saving Job..."; 418 HiveClient.StoreAsync( 419 new Action<Exception>((Exception ex) => { 420 exceptionCallback(ex); 421 }), refreshableJob.Job, cancellationToken); 422 refreshableJob.IsProgressing = false; 423 refreshableJob.Progress.Finish(); 424 } 425 426 public static void UpdateJob(RefreshableJob refreshableJob) { 427 refreshableJob.IsProgressing = true; 428 429 try { 430 refreshableJob.Progress.Start("Saving Job..."); 431 HiveClient.StoreAsync(new Action<Exception>((Exception ex) => { 432 throw new Exception("Update failed.", ex); 433 }), refreshableJob.Job, new CancellationToken()); 434 } finally { 435 refreshableJob.IsProgressing = false; 436 refreshableJob.Progress.Finish(); 437 } 438 } 439 440 424 441 425 442 #region Upload Job … … 687 704 }); 688 705 } 706 707 public string GetProjectAncestry(Guid projectId) { 708 if (projectId == null || projectId == Guid.Empty) return ""; 709 var projects = projectAncestors[projectId].Reverse().ToList(); 710 projects.Add(projectId); 711 return string.Join(" » ", projects.Select(x => ProjectNames[x]).ToArray()); 712 } 689 713 } 690 714 } -
branches/2839_HiveProjectManagement/HeuristicLab.Services.Access/3.3/Interfaces/IRoleVerifier.cs
r14185 r15992 23 23 public interface IRoleVerifier { 24 24 bool IsInRole(string role); 25 bool IsUserInRole(string username, string role); 25 26 bool IsInAnyRole(params string[] roles); 26 27 bool IsInAllRoles(params string[] roles); -
branches/2839_HiveProjectManagement/HeuristicLab.Services.Access/3.3/RoleVerifier.cs
r14185 r15992 29 29 return Roles.IsUserInRole(role); 30 30 } 31 public bool IsUserInRole(string username, string role) { 32 return Roles.IsUserInRole(username, role); 33 } 31 34 public bool IsInAnyRole(params string[] roles) { 32 35 return roles.Any(x => Roles.IsUserInRole(x)); -
branches/2839_HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs
r15978 r15992 43 43 private const string NOT_AUTHORIZED_PROJECTRESOURCE = "Selected project is not authorized to access the requested resource"; 44 44 private const string NOT_AUTHORIZED_USERPROJECT = "Current user is not authorized to access the requested project"; 45 private const string NOT_AUTHORIZED_PROJECTOWNER = "The set user is not authorized to own the project"; 45 46 private const string NO_JOB_UPDATE_POSSIBLE = "This job has already been flagged for deletion, thus, it can not be updated anymore."; 46 47 … … 768 769 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 769 770 // check if current (non-admin) user is owner of one of projectDto's-parents 771 // note: non-admin users are not allowed to administer root projects (i.e. projects without parental entry) 770 772 if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) { 771 if(projectDto .ParentProjectId.HasValue) {773 if(projectDto != null && projectDto.ParentProjectId.HasValue) { 772 774 AuthorizationManager.AuthorizeForProjectAdministration(projectDto.ParentProjectId.Value, false); 773 775 } else { … … 775 777 } 776 778 } 777 779 780 // check that non-admins can not be set as owner of root projects 781 if (projectDto != null && !projectDto.ParentProjectId.HasValue) { 782 var owner = UserManager.GetUserById(projectDto.OwnerUserId); 783 if (owner == null || !RoleVerifier.IsUserInRole(owner.UserName, HiveRoles.Administrator)) { 784 throw new SecurityException(NOT_AUTHORIZED_PROJECTOWNER); 785 } 786 } 787 778 788 var pm = PersistenceManager; 779 789 using (new PerformanceLogger("AddProject")) { … … 797 807 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 798 808 // check if current (non-admin) user is owner of the project or the projectDto's-parents 809 // note: non-admin users are not allowed to administer root projects (i.e. projects without parental entry) 799 810 if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) { 800 AuthorizationManager.AuthorizeForProjectAdministration(projectDto.Id, false); 801 } 802 811 if (projectDto != null && projectDto.ParentProjectId.HasValue) { 812 AuthorizationManager.AuthorizeForProjectAdministration(projectDto.Id, false); 813 } else { 814 throw new SecurityException(NOT_AUTHORIZED_USERPROJECT); 815 } 816 } 817 818 // check that non-admins can not be set as owner of root projects 819 if(projectDto != null && !projectDto.ParentProjectId.HasValue) { 820 var owner = UserManager.GetUserById(projectDto.OwnerUserId); 821 if(owner == null || !RoleVerifier.IsUserInRole(owner.UserName, HiveRoles.Administrator)) { 822 throw new SecurityException(NOT_AUTHORIZED_PROJECTOWNER); 823 } 824 } 825 803 826 var pm = PersistenceManager; 804 827 using (new PerformanceLogger("UpdateProject")) { … … 863 886 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 864 887 // check if current (non-admin) user is owner of one of the projectDto's-parents 865 if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) { 888 // note: non-admin users are not allowed to administer root projects (i.e. projects without parental entry) 889 if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) { 866 890 AuthorizationManager.AuthorizeForProjectAdministration(projectId, true); 867 891 } … … 922 946 .Select(x => x.ToDto()).ToList(); 923 947 var now = DateTime.Now; 924 return projects.Where(x => x.StartDate <= now && x.EndDate >= now).ToList();948 return projects.Where(x => x.StartDate <= now && (x.EndDate == null || x.EndDate >= now)).ToList(); 925 949 }); 926 950 } … … 999 1023 if (project == null) return; 1000 1024 var projectPermissions = project.ProjectPermissions.Select(x => x.GrantedUserId).ToArray(); 1025 1026 // guarantee that project owner is always permitted 1027 if(!grantedUserIds.Contains(project.OwnerUserId)) { 1028 grantedUserIds.Add(project.OwnerUserId); 1029 } 1030 1001 1031 //var addedPermissions = grantedUserIds.Except(projectPermissions); 1002 1032 var removedPermissions = projectPermissions.Except(grantedUserIds); … … 1030 1060 1031 1061 // (3) get all Guids which are in removedPermissions but not in grantedUserIds 1032 var defin atelyNotPermittedGuids = notpermittedGuids.Except(permittedGuids);1062 var definitelyNotPermittedGuids = notpermittedGuids.Except(permittedGuids); 1033 1063 1034 1064 // (4) delete jobs of those 1035 assignedJobResourceDao.DeleteByProjectIdAndUserIds(project.ProjectId, defin atelyNotPermittedGuids);1065 assignedJobResourceDao.DeleteByProjectIdAndUserIds(project.ProjectId, definitelyNotPermittedGuids); 1036 1066 1037 1067 … … 1068 1098 1069 1099 foreach(var p in childProjects) { 1100 var cpAssignedPermissions = p.ProjectPermissions.Select(x => x.GrantedUserId).ToList(); 1101 // guarantee that project owner is always permitted 1102 if (!cpAssignedPermissions.Contains(p.OwnerUserId)) { 1103 cpAssignedPermissions.Add(p.OwnerUserId); 1104 } 1105 var cpRemovedPermissions = cpAssignedPermissions.Where(x => x != p.OwnerUserId).Except(grantedUserIds); 1106 1107 // remove left-over job assignments (for non-reassignments) 1108 if(!reassignCascading) { 1109 assignedJobResourceDao.DeleteByProjectIdAndUserIds(p.ProjectId, cpRemovedPermissions); 1110 } 1111 1070 1112 // remove project permissions 1071 if (reassignCascading) {1113 if (reassignCascading) { 1072 1114 p.ProjectPermissions.Clear(); 1073 1115 } else { 1074 1116 foreach(var item in p.ProjectPermissions 1075 .Where(x => removedPermissions.Contains(x.GrantedUserId)) 1117 .Where(x => x.GrantedUserId != p.OwnerUserId 1118 && (removedPermissions.Contains(x.GrantedUserId) || cpRemovedPermissions.Contains(x.GrantedUserId))) 1076 1119 .ToList()) { 1077 1120 p.ProjectPermissions.Remove(item); … … 1081 1124 1082 1125 // add project permissions 1083 foreach (var id in grantedUserIds) { 1126 var cpGrantedUserIds = new HashSet<Guid>(grantedUserIds); 1127 cpGrantedUserIds.Add(p.OwnerUserId); 1128 1129 foreach (var id in cpGrantedUserIds) { 1084 1130 if (p.ProjectPermissions.All(x => x.GrantedUserId != id)) { 1085 1131 p.ProjectPermissions.Add(new DA.ProjectPermission { … … 1181 1227 if (cascading) { 1182 1228 var childProjects = projectDao.GetChildProjectsById(projectId).ToList(); 1229 var childProjectIds = childProjects.Select(x => x.ProjectId).ToList(); 1183 1230 1184 1231 // remove job assignments 1185 1232 if (reassignCascading) { 1186 assignedJobResourceDao.DeleteByProjectIds(childProject s.Select(x => x.ProjectId).ToList());1233 assignedJobResourceDao.DeleteByProjectIds(childProjectIds); 1187 1234 } else { 1188 var childProjectIds = childProjects.Select(x => x.ProjectId).ToList();1189 1235 assignedJobResourceDao.DeleteByProjectIdsAndResourceIds(childProjectIds, removedAssignments); 1190 1236 } 1191 1237 foreach (var p in childProjects) { 1238 var cpAssignedResources = p.AssignedProjectResources.Select(x => x.ResourceId).ToArray(); 1239 var cpRemovedAssignments = cpAssignedResources.Except(resourceIds); 1240 1241 // remove left-over job assignments (for non-reassignments) 1242 if(!reassignCascading) { 1243 assignedJobResourceDao.DeleteByProjectIdAndResourceIds(p.ProjectId, cpRemovedAssignments); 1244 } 1245 1192 1246 // remove project assignments 1193 1247 if (reassignCascading) { … … 1195 1249 } else { 1196 1250 foreach (var item in p.AssignedProjectResources 1197 .Where(x => removedAssignments.Contains(x.ResourceId) )1251 .Where(x => removedAssignments.Contains(x.ResourceId) || cpRemovedAssignments.Contains(x.ResourceId)) 1198 1252 .ToList()) { 1199 1253 p.AssignedProjectResources.Remove(item); … … 1780 1834 if (project != null) { 1781 1835 if (project.StartDate > date) throw new ArgumentException("Cannot add job to specified project. The start date of the project is still in the future."); 1782 else if (project.EndDate < date) throw new ArgumentException("Cannot add job to specified project. The end date of the project is already in the past.");1836 else if (project.EndDate != null && project.EndDate < date) throw new ArgumentException("Cannot add job to specified project. The end date of the project is already reached."); 1783 1837 } else { 1784 1838 throw new ArgumentException("Cannot add job to specified project. The project seems not to be available anymore."); -
branches/2839_HiveProjectManagement/HeuristicLab.Services.Hive/3.3/Manager/AuthorizationManager.cs
r15813 r15992 39 39 private const string USER_NOT_IDENTIFIED = "User could not be identified"; 40 40 private const string TASK_NOT_EXISTENT = "Queried task could not be found"; 41 private const string PROJECT_NOT_EXISTENT = "Queried project could not be found"; 41 42 42 43 private IPersistenceManager PersistenceManager { … … 98 99 var projectDao = pm.ProjectDao; 99 100 pm.UseTransaction(() => { 101 var project = projectDao.GetById(projectId); 102 if (project == null) throw new ArgumentException(PROJECT_NOT_EXISTENT); 103 if(!RoleVerifier.IsInRole(HiveRoles.Administrator) 104 && !project.ParentProjectId.HasValue) { 105 throw new SecurityException(NOT_AUTHORIZED_USERPROJECT); 106 } 107 100 108 List<Project> projectBranch = null; 101 109 if(parentalOwnership) projectBranch = projectDao.GetParentProjectsById(projectId).ToList();
Note: See TracChangeset
for help on using the changeset viewer.