Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/02/18 16:58:48 (6 years ago)
Author:
jzenisek
Message:

#2839: fixed handling of project related updates for project owners, who are no admins and do not own parent projects

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  
    159159        || newIncludedResources.Contains(checkedResource)) {
    160160        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)) {
    163165            e.Cancel = true;
    164166          }
     
    367369          newNode.Checked = true;
    368370          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()
    370373              || projectExclusiveResources.Contains(newResource)) {
    371374              newNode.ForeColor = SystemColors.GrayText;
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectView.cs

    r15992 r16040  
    111111      endDateTimePicker.Enabled = enabled && Content.EndDate.HasValue;
    112112      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      }
    113120    }
    114121    #endregion
     
    198205    private void startDateTimePicker_ValueChanged(object sender, EventArgs e) {
    199206      if (Content == null) return;
     207 
    200208      if (!Content.EndDate.HasValue || startDateTimePicker.Value > Content.EndDate)
    201209        endDateTimePicker.Value = startDateTimePicker.Value;
     
    206214    private void endDateTimePicker_ValueChanged(object sender, EventArgs e) {
    207215      if (Content == null) return;
     216
    208217      if (endDateTimePicker.Value < startDateTimePicker.Value)
    209218        endDateTimePicker.Value = startDateTimePicker.Value;
     
    214223    private void indefiniteCheckBox_CheckedChanged(object sender, EventArgs e) {
    215224      if (Content == null) return;
     225
    216226      var newEndDate = indefiniteCheckBox.Checked ? (DateTime?)null : endDateTimePicker.Value;
    217227      endDateTimePicker.Enabled = !indefiniteCheckBox.Checked;
     
    233243    }
    234244
     245    private bool IsAdmin() {
     246      return HiveRoles.CheckAdminUserPermissions();
     247    }
     248
    235249    private void ShowHiveInformationDialog() {
    236250      if (InvokeRequired) Invoke((Action)ShowHiveInformationDialog);
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ProjectsView.cs

    r15995 r16040  
    233233
    234234      lock (locker) {
     235        // for details go to ChangeSelectedProject(..)
    235236        if (!removeButton.Enabled) return;
    236237        removeButton.Enabled = false;
    237238      }
    238239
    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()) {
    240254        MessageBox.Show(
    241255          "Only empty projects can be deleted.",
Note: See TracChangeset for help on using the changeset viewer.