Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/04/12 14:48:55 (12 years ago)
Author:
jkarder
Message:

#1859:

  • added permission management support
  • extended administartion user interface
  • minor code improvements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveResourcePermissionManagement (trunk integration)/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.cs

    r7862 r7951  
    2222using System;
    2323using System.Windows.Forms;
     24using HeuristicLab.Clients.Access;
    2425using HeuristicLab.Core.Views;
    2526using HeuristicLab.MainForm;
     
    6364        txtHbIntervall.Clear();
    6465        cbxDisposable.Checked = false;
     66        cbxPublic.Checked = false;
    6567      } else {
    6668        if (Content.GetType() == typeof(Slave)) {
    6769          ShowSlaveUI(true);
    6870          Slave ct = (Slave)Content;
     71          bool authorized = HiveServiceLocator.Instance.CallHiveService<bool>(service => service.AuthorizesForResourceAdministration(ct.Id));
    6972          txtName.Text = ct.Name;
    7073          txtHbIntervall.Text = ct.HbInterval.ToString();
    71           cbxDisposable.Checked = ct.IsDisposable.GetValueOrDefault();
     74          cbxPublic.Enabled = authorized;
     75          cbxPublic.CheckedChanged -= new EventHandler(cbxPublic_CheckedChanged);
     76          cbxPublic.Checked = ct.OwnerUserId == null;
     77          cbxPublic.CheckedChanged += new EventHandler(cbxPublic_CheckedChanged);
    7278          txtCPU.Text = string.Format("{0} Cores @ {1} Mhz, Arch.: {2}", ct.Cores.ToString(), ct.CpuSpeed.ToString(), ct.CpuArchitecture.ToString());
    7379          txtDetailsDescription.Text = ct.Description;
     
    7884          txtFreeMemory.Text = ct.FreeMemory.ToString();
    7985          txtId.Text = ct.Id.ToString();
     86          cbxDisposable.Enabled = authorized;
     87          cbxDisposable.Checked = ct.IsDisposable.GetValueOrDefault();
    8088        } else if (Content.GetType() == typeof(SlaveGroup)) {
    8189          SlaveGroup ct = (SlaveGroup)Content;
    8290          txtName.Text = ct.Name;
    8391          txtHbIntervall.Text = ct.HbInterval.ToString();
     92          cbxPublic.Enabled = ct.Name != "UNGROUPED" && HiveRoles.CheckAdminUserPermissions();
     93          cbxPublic.CheckedChanged -= new EventHandler(cbxPublic_CheckedChanged);
     94          cbxPublic.Checked = ct.OwnerUserId == null;
     95          cbxPublic.CheckedChanged += new EventHandler(cbxPublic_CheckedChanged);
    8496          ShowSlaveUI(false);
    8597        } else {
     
    136148    }
    137149
    138     private void checkBox1_CheckedChanged(object sender, EventArgs e) {
     150    private void cbxDisposable_CheckedChanged(object sender, EventArgs e) {
    139151      if (Content != null) {
    140152        ((Slave)Content).IsDisposable = cbxDisposable.Checked;
    141153      }
    142154    }
     155
     156    private void cbxPublic_CheckedChanged(object sender, EventArgs e) {
     157      if (Content != null) {
     158        Content.OwnerUserId = cbxPublic.Checked ? null : new Guid?(UserInformation.Instance.User.Id);
     159      }
     160    }
    143161  }
    144162}
Note: See TracChangeset for help on using the changeset viewer.