Changeset 16060
- Timestamp:
- 08/07/18 15:34:23 (6 years ago)
- Location:
- branches/2839_HiveProjectManagement
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/HeuristicLab.Clients.Hive.Administrator-3.3.csproj
r15966 r16060 294 294 </ProjectReference> 295 295 </ItemGroup> 296 <ItemGroup>297 <EmbeddedResource Include="Views\ProjectJobsView.resx">298 <DependentUpon>ProjectJobsView.cs</DependentUpon>299 </EmbeddedResource>300 </ItemGroup>301 296 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 302 297 <PropertyGroup> -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectJobsView.Designer.cs
r15966 r16060 19 19 */ 20 20 #endregion 21 21 22 using HeuristicLab.Data.Views; 22 using System;23 23 24 24 namespace HeuristicLab.Clients.Hive.Administrator.Views { … … 48 48 private void InitializeComponent() { 49 49 this.components = new System.ComponentModel.Container(); 50 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProjectJobsView));51 50 this.refreshButton = new System.Windows.Forms.Button(); 52 51 this.removeButton = new System.Windows.Forms.Button(); … … 57 56 // refreshButton 58 57 // 59 this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image")));58 this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh; 60 59 this.refreshButton.Location = new System.Drawing.Point(3, 3); 61 60 this.refreshButton.Name = "refreshButton"; … … 68 67 // removeButton 69 68 // 70 this.removeButton.Image = ((System.Drawing.Image)(resources.GetObject("removeButton.Image")));69 this.removeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Remove; 71 70 this.removeButton.Location = new System.Drawing.Point(33, 3); 72 71 this.removeButton.Name = "removeButton"; … … 79 78 // matrixView 80 79 // 81 this.matrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 82 | System.Windows.Forms.AnchorStyles.Left) 80 this.matrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 81 | System.Windows.Forms.AnchorStyles.Left) 83 82 | System.Windows.Forms.AnchorStyles.Right))); 84 83 this.matrixView.Caption = "StringConvertibleMatrix View"; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs
r16043 r16060 28 28 using HeuristicLab.Core.Views; 29 29 using HeuristicLab.MainForm; 30 using System.Drawing;31 30 32 31 namespace HeuristicLab.Clients.Hive.Administrator.Views { … … 115 114 116 115 indefiniteCheckBox.Checked = !Content.EndDate.HasValue; 117 if (!indefiniteCheckBox.Checked) endDateTimePicker.Value = Content.EndDate.Value;116 if (!indefiniteCheckBox.Checked) endDateTimePicker.Value = Content.EndDate.Value; 118 117 else endDateTimePicker.Value = Content.StartDate; 119 118 endDateTimePicker.Enabled = !indefiniteCheckBox.Checked; … … 134 133 indefiniteCheckBox.Enabled = enabled; 135 134 136 if (Content != null) {135 if (Content != null) { 137 136 var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault(); 138 137 if (parentProject == null || parentProject.EndDate.HasValue) { … … 152 151 #region Event Handlers 153 152 private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) { 154 OnContentChanged(); 153 if (InvokeRequired) Invoke((Action<object, PropertyChangedEventArgs>)Content_PropertyChanged, sender, e); 154 else OnContentChanged(); 155 155 } 156 156 … … 220 220 Content.Name = nameTextBox.Text; 221 221 RegisterContentEvents(); 222 } 222 } 223 223 } 224 224 … … 228 228 Content.Description = descriptionTextBox.Text; 229 229 RegisterContentEvents(); 230 } 230 } 231 231 } 232 232 … … 238 238 Content.OwnerUserId = selectedOwnerUserId; 239 239 RegisterContentEvents(); 240 } 240 } 241 241 } 242 242 … … 248 248 var parentProject = HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).LastOrDefault(); 249 249 if (parentProject != null) { 250 if (startDateTimePicker.Value < parentProject.StartDate)250 if (startDateTimePicker.Value < parentProject.StartDate) 251 251 startDateTimePicker.Value = parentProject.StartDate; 252 252 } else { … … 261 261 Content.StartDate = startDateTimePicker.Value; 262 262 RegisterContentEvents(); 263 } 263 } 264 264 265 265 startDateTimePicker.ValueChanged += startDateTimePicker_ValueChanged; … … 276 276 endDateTimePicker.Value = parentProject.EndDate.Value; 277 277 } 278 } else if (Content.EndDate.HasValue) {278 } else if (Content.EndDate.HasValue) { 279 279 endDateTimePicker.Value = Content.EndDate.Value; 280 280 } … … 287 287 Content.EndDate = endDateTimePicker.Value; 288 288 RegisterContentEvents(); 289 } 289 } 290 290 291 291 endDateTimePicker.ValueChanged += endDateTimePicker_ValueChanged; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj
r15992 r16060 247 247 </ItemGroup> 248 248 <ItemGroup> 249 <EmbeddedResource Include="Views\RefreshableHiveJob View.resx">250 <DependentUpon>RefreshableHiveJob View.cs</DependentUpon>249 <EmbeddedResource Include="Views\RefreshableHiveJobListView.resx"> 250 <DependentUpon>RefreshableHiveJobListView.cs</DependentUpon> 251 251 </EmbeddedResource> 252 252 </ItemGroup> -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/MenuItems/RunInHiveMenuItem.cs
r16057 r16060 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Linq; 24 25 using System.Threading; 26 using System.Windows.Forms; 27 using HeuristicLab.Clients.Hive.JobManager.Views; 25 28 using HeuristicLab.Core; 26 29 using HeuristicLab.MainForm; … … 28 31 using HeuristicLab.Optimizer; 29 32 using HeuristicLab.PluginInfrastructure; 30 using HeuristicLab.Clients.Hive.JobManager.Views;31 using System.Windows.Forms;32 using System.Linq;33 33 34 34 namespace HeuristicLab.Clients.Hive.JobManager { … … 85 85 task.ItemTask.ComputeInParallel = content is Experiment || content is BatchRun; 86 86 87 if (HiveClient.Instance.Projects.Count == 1) { 88 var project = HiveClient.Instance.Projects.FirstOrDefault(); 89 if (project != null && project.Id != Guid.Empty) 90 rJob.Job.ProjectId = project.Id; 91 } 87 92 88 93 var hiveResourceSelectorDialog = new HiveResourceSelectorDialog(rJob.Job.Id, rJob.Job.ProjectId); -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobView.Designer.cs
r16057 r16060 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RefreshableHiveJobView));49 48 this.tabControl = new HeuristicLab.MainForm.WindowsForms.DragOverTabControl(); 50 49 this.tasksTabPage = new System.Windows.Forms.TabPage(); … … 150 149 // refreshPermissionsButton 151 150 // 152 this.refreshPermissionsButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshPermissionsButton.Image")));151 this.refreshPermissionsButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh; 153 152 this.refreshPermissionsButton.Location = new System.Drawing.Point(3, 3); 154 153 this.refreshPermissionsButton.Name = "refreshPermissionsButton"; … … 253 252 // 254 253 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 255 this.startButton.Image = ((System.Drawing.Image)(resources.GetObject("startButton.Image")));254 this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play; 256 255 this.startButton.Location = new System.Drawing.Point(0, 564); 257 256 this.startButton.Name = "startButton"; … … 265 264 // 266 265 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 267 this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image")));266 this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop; 268 267 this.stopButton.Location = new System.Drawing.Point(60, 564); 269 268 this.stopButton.Name = "stopButton"; … … 297 296 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 298 297 this.pauseButton.Enabled = false; 299 this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image")));298 this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause; 300 299 this.pauseButton.Location = new System.Drawing.Point(30, 564); 301 300 this.pauseButton.Name = "pauseButton"; … … 366 365 // refreshButton 367 366 // 368 this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image")));367 this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh; 369 368 this.refreshButton.Location = new System.Drawing.Point(3, 0); 370 369 this.refreshButton.Name = "refreshButton"; … … 377 376 // updateButton 378 377 // 379 this.updateButton.Image = ((System.Drawing.Image)(resources.GetObject("updateButton.Image")));378 this.updateButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Save; 380 379 this.updateButton.Location = new System.Drawing.Point(30, 0); 381 380 this.updateButton.Name = "updateButton"; … … 388 387 // UnloadButton 389 388 // 390 this.UnloadButton.Image = ((System.Drawing.Image)(resources.GetObject("UnloadButton.Image")));389 this.UnloadButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Disconnect; 391 390 this.UnloadButton.Location = new System.Drawing.Point(57, 0); 392 391 this.UnloadButton.Name = "UnloadButton"; … … 399 398 // searchButton 400 399 // 401 this.searchButton.Image = ((System.Drawing.Image)(resources.GetObject("searchButton.Image")));400 this.searchButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Zoom; 402 401 this.searchButton.Location = new System.Drawing.Point(71, 79); 403 402 this.searchButton.Name = "searchButton"; -
branches/2839_HiveProjectManagement/HeuristicLab.Services.Hive/3.3/HiveService.cs
r16057 r16060 333 333 .Where(x => x.State == DA.JobState.Online 334 334 && (x.OwnerUserId == currentUserId 335 || x.JobPermissions.Count(y => y.Permission != DA.Permission.NotAllowed 335 || x.JobPermissions.Count(y => y.Permission != DA.Permission.NotAllowed 336 336 && y.GrantedUserId == currentUserId) > 0) 337 337 ) … … 359 359 .ToList(); 360 360 361 if (administrationGrantedProjects.Select(x => x.ProjectId).Contains(projectId)) {361 if (administrationGrantedProjects.Select(x => x.ProjectId).Contains(projectId)) { 362 362 var jobs = jobDao.GetByProjectId(projectId) 363 363 .Select(x => x.ToDto()) … … 388 388 var requestedAndGrantedProjectIds = projectIds.Intersect(administrationGrantedProjectIds); 389 389 390 if (requestedAndGrantedProjectIds.Any()) {390 if (requestedAndGrantedProjectIds.Any()) { 391 391 var jobs = jobDao.GetByProjectIds(requestedAndGrantedProjectIds) 392 392 .Select(x => x.ToDto()) … … 415 415 // check project - resources 416 416 AuthorizationManager.AuthorizeProjectForResourcesUse(jobDto.ProjectId, resourceIds); 417 417 418 418 using (new PerformanceLogger("AddJob")) { 419 419 var jobDao = pm.JobDao; … … 426 426 427 427 // add resource assignments 428 if (resourceIds != null && resourceIds.Any()) { 428 if (resourceIds != null && resourceIds.Any()) { 429 429 newJob.AssignedJobResources.AddRange(resourceIds.Select( 430 430 x => new DA.AssignedJobResource { … … 467 467 exists = false; 468 468 job = new DA.Job(); 469 } else if (job.State != DA.JobState.Online) {469 } else if (job.State != DA.JobState.Online) { 470 470 throw new InvalidOperationException(NO_JOB_UPDATE_POSSIBLE); 471 471 } … … 480 480 x => new DA.AssignedJobResource { 481 481 ResourceId = x 482 }));482 })); 483 483 } 484 484 jobDao.Save(job); 485 } else if (resourceIds != null) {485 } else if (resourceIds != null) { 486 486 var addedJobResourceIds = resourceIds.Except(job.AssignedJobResources.Select(x => x.ResourceId)); 487 487 var removedJobResourceIds = job.AssignedJobResources … … 489 489 .Except(resourceIds) 490 490 .ToArray(); 491 491 492 492 // remove resource assignments 493 foreach (var rid in removedJobResourceIds) {493 foreach (var rid in removedJobResourceIds) { 494 494 var ajr = job.AssignedJobResources.Where(x => x.ResourceId == rid).SingleOrDefault(); 495 495 if (ajr != null) job.AssignedJobResources.Remove(ajr); … … 515 515 pm.UseTransaction(() => { 516 516 var job = jobDao.GetById(jobId); 517 if (job != null) {517 if (job != null) { 518 518 var jobStateEntity = jobState.ToEntity(); 519 519 // note: allow solely state changes from "Online" to "StatisticsPending" = deletion request by user for HiveStatisticGenerator … … 521 521 if (job.State == DA.JobState.Online && jobStateEntity == DA.JobState.StatisticsPending) { 522 522 job.State = jobStateEntity; 523 foreach (var task in job.Tasks524 .Where(x => x.State == DA.TaskState.Waiting 525 || x.State == DA.TaskState.Paused 523 foreach (var task in job.Tasks 524 .Where(x => x.State == DA.TaskState.Waiting 525 || x.State == DA.TaskState.Paused 526 526 || x.State == DA.TaskState.Offline)) { 527 527 task.State = DA.TaskState.Aborted; 528 528 } 529 529 pm.SubmitChanges(); 530 } else if (job.State == DA.JobState.StatisticsPending && jobStateEntity == DA.JobState.DeletionPending) {530 } else if (job.State == DA.JobState.StatisticsPending && jobStateEntity == DA.JobState.DeletionPending) { 531 531 job.State = jobStateEntity; 532 532 pm.SubmitChanges(); 533 } 533 } 534 534 } 535 535 }); … … 549 549 var projectDao = pm.ProjectDao; 550 550 pm.UseTransaction(() => { 551 foreach (var jobId in jobIds) {551 foreach (var jobId in jobIds) { 552 552 var job = jobDao.GetById(jobId); 553 553 if (job != null) { … … 560 560 if (isAdministrator || administrationGrantedProjects.Contains(job.Project)) { 561 561 // note: allow solely state changes from "Online" to "StatisticsPending" = deletion request by user for HiveStatisticGenerator 562 if (job.State == DA.JobState.Online) { 562 if (job.State == DA.JobState.Online) { 563 563 job.State = DA.JobState.StatisticsPending; 564 564 foreach (var task in job.Tasks … … 566 566 || x.State == DA.TaskState.Paused 567 567 || x.State == DA.TaskState.Offline)) { 568 568 task.State = DA.TaskState.Aborted; 569 569 } 570 570 pm.SubmitChanges(); … … 772 772 bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator); 773 773 if (!isAdmin) { 774 if (projectDto != null && projectDto.ParentProjectId.HasValue) {774 if (projectDto != null && projectDto.ParentProjectId.HasValue) { 775 775 AuthorizationManager.AuthorizeForProjectAdministration(projectDto.ParentProjectId.Value, false); 776 776 } else { … … 794 794 var project = projectDao.Save(projectDto.ToEntity()); 795 795 796 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId) ;796 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList(); 797 797 bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any(); 798 798 … … 826 826 // check if current (non-admin) user is owner of the project or the projectDto's-parents 827 827 // note: non-admin users are not allowed to administer root projects (i.e. projects without parental entry) 828 bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator); 828 bool isAdmin = RoleVerifier.IsInRole(HiveRoles.Administrator); 829 829 if (!isAdmin) { 830 830 if (projectDto != null && projectDto.ParentProjectId.HasValue) { 831 AuthorizationManager.AuthorizeForProjectAdministration(projectDto.Id, false); 831 AuthorizationManager.AuthorizeForProjectAdministration(projectDto.Id, false); 832 832 } else { 833 833 throw new SecurityException(NOT_AUTHORIZED_USERPROJECT); … … 836 836 837 837 // check that non-admins can not be set as owner of root projects 838 if (projectDto != null && !projectDto.ParentProjectId.HasValue) {838 if (projectDto != null && !projectDto.ParentProjectId.HasValue) { 839 839 var owner = UserManager.GetUserById(projectDto.OwnerUserId); 840 if (owner == null || !RoleVerifier.IsUserInRole(owner.UserName, HiveRoles.Administrator)) {840 if (owner == null || !RoleVerifier.IsUserInRole(owner.UserName, HiveRoles.Administrator)) { 841 841 throw new SecurityException(NOT_AUTHORIZED_PROJECTOWNER); 842 842 } 843 843 } 844 844 845 845 var pm = PersistenceManager; 846 846 using (new PerformanceLogger("UpdateProject")) { … … 850 850 var project = projectDao.GetById(projectDto.Id); 851 851 if (project != null) { // (1) update existent project 852 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId) ;852 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList(); 853 853 bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any(); 854 854 … … 893 893 var newProject = projectDao.Save(projectDto.ToEntity()); 894 894 895 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId) ;895 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList(); 896 896 bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any(); 897 897 … … 925 925 // check if current (non-admin) user is owner of one of the projectDto's-parents 926 926 // note: non-admin users are not allowed to administer root projects (i.e. projects without parental entry) 927 if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) { 927 if (!RoleVerifier.IsInRole(HiveRoles.Administrator)) { 928 928 AuthorizationManager.AuthorizeForProjectAdministration(projectId, true); 929 929 } … … 942 942 .ToList(); 943 943 944 if (jobs.Count > 0) {944 if (jobs.Count > 0) { 945 945 throw new InvalidOperationException("There are " + jobs.Count + " job(s) using this project and/or child-projects. It is necessary to delete them before the project."); 946 946 } else { … … 966 966 .Where(x => x.ProjectId == projectId) 967 967 .Select(x => x.ToDto()) 968 .SingleOrDefault(); 968 .SingleOrDefault(); 969 969 }); 970 970 } … … 995 995 using (new PerformanceLogger("GetProjectsForAdministration")) { 996 996 var projectDao = pm.ProjectDao; 997 998 return pm.UseTransaction(() => { 999 if (isAdministrator) {997 998 return pm.UseTransaction(() => { 999 if (isAdministrator) { 1000 1000 return projectDao.GetAll().Select(x => x.ToDto()).ToList(); 1001 1001 } else { … … 1012 1012 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 1013 1013 var pm = PersistenceManager; 1014 using (new PerformanceLogger("GetProjectGenealogy")) {1014 using (new PerformanceLogger("GetProjectGenealogy")) { 1015 1015 var projectDao = pm.ProjectDao; 1016 1016 var projectAncestors = new Dictionary<Guid, HashSet<Guid>>(); … … 1020 1020 foreach (var p in projects) { 1021 1021 var parentProject = p.ParentProject; 1022 while (parentProject != null) {1022 while (parentProject != null) { 1023 1023 projectAncestors[p.ProjectId].Add(parentProject.ProjectId); 1024 1024 parentProject = parentProject.ParentProject; … … 1039 1039 projectDao 1040 1040 .GetAll().ToList() 1041 .ForEach(p => projectNames.Add(p.ProjectId, p.Name));1041 .ForEach(p => projectNames.Add(p.ProjectId, p.Name)); 1042 1042 return projectNames; 1043 1043 }); … … 1063 1063 1064 1064 // guarantee that project owner is always permitted 1065 if (!grantedUserIds.Contains(project.OwnerUserId)) {1065 if (!grantedUserIds.Contains(project.OwnerUserId)) { 1066 1066 grantedUserIds.Add(project.OwnerUserId); 1067 1067 } … … 1115 1115 // add project permissions 1116 1116 foreach (var id in grantedUserIds) { 1117 if (project.ProjectPermissions.All(x => x.GrantedUserId != id)) {1117 if (project.ProjectPermissions.All(x => x.GrantedUserId != id)) { 1118 1118 project.ProjectPermissions.Add(new DA.ProjectPermission { 1119 1119 GrantedUserId = id, … … 1135 1135 } 1136 1136 1137 foreach (var p in childProjects) {1137 foreach (var p in childProjects) { 1138 1138 var cpAssignedPermissions = p.ProjectPermissions.Select(x => x.GrantedUserId).ToList(); 1139 1139 // guarantee that project owner is always permitted … … 1144 1144 1145 1145 // remove left-over job assignments (for non-reassignments) 1146 if (!reassignCascading) {1146 if (!reassignCascading) { 1147 1147 assignedJobResourceDao.DeleteByProjectIdAndUserIds(p.ProjectId, cpRemovedPermissions); 1148 1148 } … … 1152 1152 p.ProjectPermissions.Clear(); 1153 1153 } else { 1154 foreach (var item in p.ProjectPermissions1155 .Where(x => x.GrantedUserId != p.OwnerUserId 1154 foreach (var item in p.ProjectPermissions 1155 .Where(x => x.GrantedUserId != p.OwnerUserId 1156 1156 && (removedPermissions.Contains(x.GrantedUserId) || cpRemovedPermissions.Contains(x.GrantedUserId))) 1157 1157 .ToList()) { … … 1237 1237 pm.UseTransaction(() => { 1238 1238 var project = projectDao.GetById(projectId); 1239 1240 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId) ;1239 1240 var parentProjects = projectDao.GetParentProjectsById(project.ProjectId).ToList(); 1241 1241 bool isParent = parentProjects.Select(x => x.OwnerUserId == UserManager.CurrentUserId).Any(); 1242 1242 … … 1246 1246 1247 1247 // if user is admin or owner of parent project(s) 1248 if (isAdmin || isParent) {1248 if (isAdmin || isParent) { 1249 1249 // remove job and project assignments 1250 1250 if (reassign) { … … 1288 1288 1289 1289 // remove left-over job assignments (for non-reassignments) 1290 if (!reassignCascading) {1290 if (!reassignCascading) { 1291 1291 assignedJobResourceDao.DeleteByProjectIdAndResourceIds(p.ProjectId, cpRemovedAssignments); 1292 1292 } … … 1306 1306 // add project assignments 1307 1307 foreach (var id in resourceIds) { 1308 if (p.AssignedProjectResources.All(x => x.ResourceId != id)) {1308 if (p.AssignedProjectResources.All(x => x.ResourceId != id)) { 1309 1309 p.AssignedProjectResources.Add(new DA.AssignedProjectResource { 1310 1310 ResourceId = id … … 1373 1373 public IEnumerable<DT.AssignedProjectResource> GetAssignedResourcesForProjectsAdministration(IEnumerable<Guid> projectIds) { 1374 1374 RoleVerifier.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 1375 foreach (var id in projectIds)1375 foreach (var id in projectIds) 1376 1376 AuthorizationManager.AuthorizeForProjectAdministration(id, false); 1377 1377 … … 1572 1572 var resources = resourceDao.GetAll().ToList(); 1573 1573 resources.ForEach(r => resourceAncestors.Add(r.ResourceId, new HashSet<Guid>())); 1574 1575 foreach (var r in resources) {1574 1575 foreach (var r in resources) { 1576 1576 var parentResource = r.ParentResource; 1577 while (parentResource != null) {1577 while (parentResource != null) { 1578 1578 resourceAncestors[r.ResourceId].Add(parentResource.ResourceId); 1579 1579 parentResource = parentResource.ParentResource; … … 1815 1815 return user != null ? (Guid?)user.ProviderUserKey ?? Guid.Empty : Guid.Empty; 1816 1816 } 1817 1817 1818 1818 public Dictionary<Guid, HashSet<Guid>> GetUserGroupTree() { 1819 1819 var userGroupTree = new Dictionary<Guid, HashSet<Guid>>(); 1820 1820 var userGroupMapping = UserManager.GetUserGroupMapping(); 1821 1821 1822 foreach (var ugm in userGroupMapping) {1822 foreach (var ugm in userGroupMapping) { 1823 1823 if (ugm.Parent == null || ugm.Child == null) continue; 1824 1824 … … 1836 1836 bool isAdministrator = RoleVerifier.IsInRole(HiveRoles.Administrator); 1837 1837 var pm = PersistenceManager; 1838 using (new PerformanceLogger("CheckAccessToAdminAreaGranted")) {1838 using (new PerformanceLogger("CheckAccessToAdminAreaGranted")) { 1839 1839 if (isAdministrator) { 1840 1840 return true; … … 1907 1907 if (jobs == null || !jobs.Any()) return; 1908 1908 1909 var currentUserId = UserManager.CurrentUserId; 1909 var currentUserId = UserManager.CurrentUserId; 1910 1910 var taskDao = pm.TaskDao; 1911 1911 var jobPermissionDao = pm.JobPermissionDao;
Note: See TracChangeset
for help on using the changeset viewer.