Changeset 16040 for branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Timestamp:
- 08/02/18 16:58:48 (6 years ago)
- Location:
- branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectResourcesView.cs
r15995 r16040 159 159 || newIncludedResources.Contains(checkedResource)) { 160 160 e.Cancel = true; 161 } else if (!HiveRoles.CheckAdminUserPermissions()) { 162 if (!HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).Any() || projectExclusiveResources.Contains(checkedResource)) { 161 } else if (!IsAdmin()) { 162 if (!HiveAdminClient.Instance.CheckOwnershipOfParentProject(Content, UserInformation.Instance.User.Id) 163 || !HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).Any() 164 || projectExclusiveResources.Contains(checkedResource)) { 163 165 e.Cancel = true; 164 166 } … … 367 369 newNode.Checked = true; 368 370 if(!HiveRoles.CheckAdminUserPermissions()) { 369 if (!HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).Any() 371 if (!HiveAdminClient.Instance.CheckOwnershipOfParentProject(Content, UserInformation.Instance.User.Id) 372 || !HiveAdminClient.Instance.GetAvailableProjectAncestors(Content.Id).Any() 370 373 || projectExclusiveResources.Contains(newResource)) { 371 374 newNode.ForeColor = SystemColors.GrayText; -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs
r15992 r16040 111 111 endDateTimePicker.Enabled = enabled && Content.EndDate.HasValue; 112 112 indefiniteCheckBox.Enabled = enabled; 113 114 if (!IsAdmin() && !HiveAdminClient.Instance.CheckOwnershipOfParentProject(Content, UserInformation.Instance.User.Id)) { 115 ownerComboBox.Enabled = false; 116 startDateTimePicker.Enabled = false; 117 endDateTimePicker.Enabled = false; 118 indefiniteCheckBox.Enabled = false; 119 } 113 120 } 114 121 #endregion … … 198 205 private void startDateTimePicker_ValueChanged(object sender, EventArgs e) { 199 206 if (Content == null) return; 207 200 208 if (!Content.EndDate.HasValue || startDateTimePicker.Value > Content.EndDate) 201 209 endDateTimePicker.Value = startDateTimePicker.Value; … … 206 214 private void endDateTimePicker_ValueChanged(object sender, EventArgs e) { 207 215 if (Content == null) return; 216 208 217 if (endDateTimePicker.Value < startDateTimePicker.Value) 209 218 endDateTimePicker.Value = startDateTimePicker.Value; … … 214 223 private void indefiniteCheckBox_CheckedChanged(object sender, EventArgs e) { 215 224 if (Content == null) return; 225 216 226 var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : endDateTimePicker.Value; 217 227 endDateTimePicker.Enabled = !indefiniteCheckBox.Checked; … … 233 243 } 234 244 245 private bool IsAdmin() { 246 return HiveRoles.CheckAdminUserPermissions(); 247 } 248 235 249 private void ShowHiveInformationDialog() { 236 250 if (InvokeRequired) Invoke((Action)ShowHiveInformationDialog); -
branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs
r15995 r16040 233 233 234 234 lock (locker) { 235 // for details go to ChangeSelectedProject(..) 235 236 if (!removeButton.Enabled) return; 236 237 removeButton.Enabled = false; 237 238 } 238 239 239 if (Content.Any(x => x.ParentProjectId == selectedProject.Id)) { 240 // double check of ChangeSelectedProject(..): 241 // if the user is no admin nor owner of a parent project 242 if (!IsAdmin() && !HiveAdminClient.Instance.CheckOwnershipOfParentProject(selectedProject, UserInformation.Instance.User.Id)) { 243 MessageBox.Show( 244 "Only admins and owners of parent projects are allowed to delete this project.", 245 "HeuristicLab Hive Administrator", 246 MessageBoxButtons.OK, 247 MessageBoxIcon.Error); 248 return; 249 } 250 251 252 if (Content.Any(x => x.ParentProjectId == selectedProject.Id) 253 || HiveAdminClient.Instance.ProjectDescendants[selectedProject.Id].Any()) { 240 254 MessageBox.Show( 241 255 "Only empty projects can be deleted.",
Note: See TracChangeset
for help on using the changeset viewer.