Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/12 12:06:18 (12 years ago)
Author:
jkarder
Message:

#1859: manually merged branch "HiveResourcePermissionManagement (trunk integration)" into trunk

Location:
trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/HeuristicLab.Clients.Hive.Administrator-3.3.csproj

    r7257 r8051  
    9797  </ItemGroup>
    9898  <ItemGroup>
     99    <Compile Include="HiveRoles.cs" />
    99100    <Compile Include="Views\HiveAdministratorView.cs">
    100101      <SubType>UserControl</SubType>
     
    141142  </ItemGroup>
    142143  <ItemGroup>
     144    <ProjectReference Include="..\..\HeuristicLab.Clients.Access.Administration\3.3\HeuristicLab.Clients.Access.Administration-3.3.csproj">
     145      <Project>{C9CF6AE8-4637-4A75-9141-042F479B5D50}</Project>
     146      <Name>HeuristicLab.Clients.Access.Administration-3.3</Name>
     147    </ProjectReference>
     148    <ProjectReference Include="..\..\HeuristicLab.Clients.Access.Views\3.3\HeuristicLab.Clients.Access.Views-3.3.csproj">
     149      <Project>{FE856595-64CD-46DA-9CD2-FFF3E6B0D4F2}</Project>
     150      <Name>HeuristicLab.Clients.Access.Views-3.3</Name>
     151    </ProjectReference>
     152    <ProjectReference Include="..\..\HeuristicLab.Clients.Access\3.3\HeuristicLab.Clients.Access-3.3.csproj">
     153      <Project>{494F87F4-0F25-4D33-A382-10CDB2174D48}</Project>
     154      <Name>HeuristicLab.Clients.Access-3.3</Name>
     155    </ProjectReference>
    143156    <ProjectReference Include="..\..\HeuristicLab.Clients.Common\3.3\HeuristicLab.Clients.Common-3.3.csproj">
    144157      <Project>{730A9104-D4D1-4360-966B-E49B7571DDA3}</Project>
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Plugin.cs.frame

    r7949 r8051  
    2525  [Plugin("HeuristicLab.Clients.Hive.Administrator", "3.3.6.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Clients.Hive.Administrator-3.3.dll", PluginFileType.Assembly)]
     27  [PluginDependency("HeuristicLab.Clients.Access", "3.3")]
     28  [PluginDependency("HeuristicLab.Clients.Access.Administration", "3.3")]
     29  [PluginDependency("HeuristicLab.Clients.Access.Views", "3.3")]
    2730  [PluginDependency("HeuristicLab.Collections", "3.3")]
    2831  [PluginDependency("HeuristicLab.Common", "3.3")]
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.Designer.cs

    r7967 r8051  
    5454      this.btnRemoveGroup = new System.Windows.Forms.Button();
    5555      this.btnAddGroup = new System.Windows.Forms.Button();
     56      this.btnPermissionsSave = new System.Windows.Forms.Button();
    5657      this.treeSlaveGroup = new System.Windows.Forms.TreeView();
    5758      this.tabSlaveGroup = new System.Windows.Forms.TabControl();
     
    6162      this.scheduleView = new HeuristicLab.Clients.Hive.Administrator.Views.ScheduleView();
    6263      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     64      this.tabPermissions = new System.Windows.Forms.TabPage();
     65      this.permissionView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserView();
    6366      ((System.ComponentModel.ISupportInitialize)(this.splitSlaves)).BeginInit();
    6467      this.splitSlaves.Panel1.SuspendLayout();
     
    6871      this.tabDetails.SuspendLayout();
    6972      this.tabSchedule.SuspendLayout();
     73      this.tabPermissions.SuspendLayout();
    7074      this.SuspendLayout();
    7175      //
     
    7579      this.imageListSlaveGroups.ImageSize = new System.Drawing.Size(16, 16);
    7680      this.imageListSlaveGroups.TransparentColor = System.Drawing.Color.Transparent;
    77       //
    78       // splitSlaves
    79       //
    80       this.splitSlaves.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    81                   | System.Windows.Forms.AnchorStyles.Left)
    82                   | System.Windows.Forms.AnchorStyles.Right)));
    83       this.splitSlaves.Location = new System.Drawing.Point(3, 3);
    84       this.splitSlaves.Name = "splitSlaves";
    85       //
    86       // splitSlaves.Panel1
    87       //
    88       this.splitSlaves.Panel1.Controls.Add(this.btnRefresh);
    89       this.splitSlaves.Panel1.Controls.Add(this.progressBar);
    90       this.splitSlaves.Panel1.Controls.Add(this.btnSave);
    91       this.splitSlaves.Panel1.Controls.Add(this.btnRemoveGroup);
    92       this.splitSlaves.Panel1.Controls.Add(this.btnAddGroup);
    93       this.splitSlaves.Panel1.Controls.Add(this.treeSlaveGroup);
    94       //
    95       // splitSlaves.Panel2
    96       //
    97       this.splitSlaves.Panel2.Controls.Add(this.tabSlaveGroup);
    98       this.splitSlaves.Size = new System.Drawing.Size(847, 547);
    99       this.splitSlaves.SplitterDistance = 249;
    100       this.splitSlaves.TabIndex = 3;
    10181      //
    10282      // btnRefresh
     
    11191      this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
    11292      //
    113       // progressBar
    114       //
    115       this.progressBar.Location = new System.Drawing.Point(123, 4);
    116       this.progressBar.Name = "progressBar";
    117       this.progressBar.Size = new System.Drawing.Size(123, 23);
    118       this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
    119       this.progressBar.TabIndex = 7;
    120       //
    12193      // btnSave
    12294      //
     
    152124      this.btnAddGroup.Click += new System.EventHandler(this.btnAddGroup_Click);
    153125      //
     126      // btnPermissionsSave
     127      //
     128      this.btnPermissionsSave.Enabled = false;
     129      this.btnPermissionsSave.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb;
     130      this.btnPermissionsSave.Location = new System.Drawing.Point(36, 6);
     131      this.btnPermissionsSave.Name = "btnPermissionsSave";
     132      this.btnPermissionsSave.Size = new System.Drawing.Size(24, 24);
     133      this.btnPermissionsSave.TabIndex = 1;
     134      this.toolTip.SetToolTip(this.btnPermissionsSave, "Store slave and group sharing permissions on the server");
     135      this.btnPermissionsSave.UseVisualStyleBackColor = true;
     136      this.btnPermissionsSave.Click += new System.EventHandler(this.btnPermissionsSave_Click);
     137      //
     138      // splitSlaves
     139      //
     140      this.splitSlaves.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     141            | System.Windows.Forms.AnchorStyles.Left)
     142            | System.Windows.Forms.AnchorStyles.Right)));
     143      this.splitSlaves.Location = new System.Drawing.Point(3, 3);
     144      this.splitSlaves.Name = "splitSlaves";
     145      //
     146      // splitSlaves.Panel1
     147      //
     148      this.splitSlaves.Panel1.Controls.Add(this.btnRefresh);
     149      this.splitSlaves.Panel1.Controls.Add(this.progressBar);
     150      this.splitSlaves.Panel1.Controls.Add(this.btnSave);
     151      this.splitSlaves.Panel1.Controls.Add(this.btnRemoveGroup);
     152      this.splitSlaves.Panel1.Controls.Add(this.btnAddGroup);
     153      this.splitSlaves.Panel1.Controls.Add(this.treeSlaveGroup);
     154      //
     155      // splitSlaves.Panel2
     156      //
     157      this.splitSlaves.Panel2.Controls.Add(this.tabSlaveGroup);
     158      this.splitSlaves.Size = new System.Drawing.Size(847, 547);
     159      this.splitSlaves.SplitterDistance = 249;
     160      this.splitSlaves.TabIndex = 3;
     161      //
     162      // progressBar
     163      //
     164      this.progressBar.Location = new System.Drawing.Point(123, 4);
     165      this.progressBar.Name = "progressBar";
     166      this.progressBar.Size = new System.Drawing.Size(123, 23);
     167      this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
     168      this.progressBar.TabIndex = 7;
     169      //
    154170      // treeSlaveGroup
    155171      //
    156172      this.treeSlaveGroup.AllowDrop = true;
    157173      this.treeSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    158                   | System.Windows.Forms.AnchorStyles.Left)
    159                   | System.Windows.Forms.AnchorStyles.Right)));
     174            | System.Windows.Forms.AnchorStyles.Left)
     175            | System.Windows.Forms.AnchorStyles.Right)));
    160176      this.treeSlaveGroup.ImageIndex = 0;
    161177      this.treeSlaveGroup.ImageList = this.imageListSlaveGroups;
     
    166182      this.treeSlaveGroup.TabIndex = 0;
    167183      this.treeSlaveGroup.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeSlaveGroup_ItemDrag);
    168       this.treeSlaveGroup.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeSlaveGroup_NodeMouseClick);
     184      this.treeSlaveGroup.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeSlaveGroup_AfterSelect);
    169185      this.treeSlaveGroup.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragDrop);
    170186      this.treeSlaveGroup.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeSlaveGroup_DragEnter);
     
    175191      //
    176192      this.tabSlaveGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    177                   | System.Windows.Forms.AnchorStyles.Left)
    178                   | System.Windows.Forms.AnchorStyles.Right)));
     193            | System.Windows.Forms.AnchorStyles.Left)
     194            | System.Windows.Forms.AnchorStyles.Right)));
    179195      this.tabSlaveGroup.Controls.Add(this.tabDetails);
    180196      this.tabSlaveGroup.Controls.Add(this.tabSchedule);
     197      this.tabSlaveGroup.Controls.Add(this.tabPermissions);
    181198      this.tabSlaveGroup.Location = new System.Drawing.Point(3, 3);
    182199      this.tabSlaveGroup.Name = "tabSlaveGroup";
     
    200217      //
    201218      this.slaveView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    202                   | System.Windows.Forms.AnchorStyles.Left)
    203                   | System.Windows.Forms.AnchorStyles.Right)));
     219            | System.Windows.Forms.AnchorStyles.Left)
     220            | System.Windows.Forms.AnchorStyles.Right)));
    204221      this.slaveView.Caption = "SlaveView";
    205222      this.slaveView.Content = null;
    206       this.slaveView.Location = new System.Drawing.Point(7, 7);
     223      this.slaveView.Location = new System.Drawing.Point(6, 6);
    207224      this.slaveView.Name = "slaveView";
    208225      this.slaveView.ReadOnly = false;
    209       this.slaveView.Size = new System.Drawing.Size(564, 502);
     226      this.slaveView.Size = new System.Drawing.Size(565, 503);
    210227      this.slaveView.TabIndex = 0;
    211228      //
     
    224241      //
    225242      this.scheduleView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    226                   | System.Windows.Forms.AnchorStyles.Left)
    227                   | System.Windows.Forms.AnchorStyles.Right)));
     243            | System.Windows.Forms.AnchorStyles.Left)
     244            | System.Windows.Forms.AnchorStyles.Right)));
    228245      this.scheduleView.Caption = "ScheduleView";
    229246      this.scheduleView.Content = null;
    230       this.scheduleView.Location = new System.Drawing.Point(3, 8);
     247      this.scheduleView.Location = new System.Drawing.Point(6, 6);
    231248      this.scheduleView.Name = "scheduleView";
    232249      this.scheduleView.ReadOnly = false;
    233       this.scheduleView.Size = new System.Drawing.Size(568, 501);
     250      this.scheduleView.Size = new System.Drawing.Size(565, 503);
    234251      this.scheduleView.TabIndex = 0;
     252      //
     253      // tabPermissions
     254      //
     255      this.tabPermissions.Controls.Add(this.btnPermissionsSave);
     256      this.tabPermissions.Controls.Add(this.permissionView);
     257      this.tabPermissions.Location = new System.Drawing.Point(4, 22);
     258      this.tabPermissions.Name = "tabPermissions";
     259      this.tabPermissions.Padding = new System.Windows.Forms.Padding(3);
     260      this.tabPermissions.Size = new System.Drawing.Size(577, 515);
     261      this.tabPermissions.TabIndex = 2;
     262      this.tabPermissions.Text = "Permissions";
     263      this.tabPermissions.UseVisualStyleBackColor = true;
     264      //
     265      // permissionView
     266      //
     267      this.permissionView.Caption = "RefreshableLightweightUser View";
     268      this.permissionView.Content = null;
     269      this.permissionView.FetchSelectedUsers = null;
     270      this.permissionView.Location = new System.Drawing.Point(6, 6);
     271      this.permissionView.Name = "permissionView";
     272      this.permissionView.ReadOnly = false;
     273      this.permissionView.Size = new System.Drawing.Size(565, 503);
     274      this.permissionView.TabIndex = 0;
    235275      //
    236276      // ResourcesView
     
    249289      this.tabDetails.ResumeLayout(false);
    250290      this.tabSchedule.ResumeLayout(false);
     291      this.tabPermissions.ResumeLayout(false);
    251292      this.ResumeLayout(false);
    252293
     
    269310    private System.Windows.Forms.Button btnRefresh;
    270311    private System.Windows.Forms.ToolTip toolTip;
     312    private System.Windows.Forms.TabPage tabPermissions;
     313    private Access.Views.RefreshableLightweightUserView permissionView;
     314    private System.Windows.Forms.Button btnPermissionsSave;
    271315  }
    272316}
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r7928 r8051  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Drawing;
    2425using System.Linq;
     
    2728using System.Threading.Tasks;
    2829using System.Windows.Forms;
     30using HeuristicLab.Clients.Access;
    2931using HeuristicLab.Clients.Hive.Views;
    3032using HeuristicLab.Core;
     
    4547    private const int slaveImageIndex = 0;
    4648    private const int slaveGroupImageIndex = 1;
     49    private readonly Color ownedResourceColor = Color.LightGreen;
    4750    private TS.Task progressTask;
    4851    private bool stopProgressTask;
     52    private bool currentlyAuthorized;
    4953
    5054
     
    5660      HiveAdminClient.Instance.Refreshing += new EventHandler(Instance_Refreshing);
    5761      HiveAdminClient.Instance.Refreshed += new EventHandler(Instance_Refreshed);
     62
     63      Access.AccessClient.Instance.Refreshing += new EventHandler(Content_Refreshing);
     64      Access.AccessClient.Instance.Refreshed += new EventHandler(Content_Refreshed);
    5865    }
    5966
     
    6168      HiveAdminClient.Instance.Refreshing -= new EventHandler(Instance_Refreshing);
    6269      HiveAdminClient.Instance.Refreshed -= new EventHandler(Instance_Refreshed);
     70
     71      Access.AccessClient.Instance.Refreshing -= new EventHandler(Content_Refreshing);
     72      Access.AccessClient.Instance.Refreshed -= new EventHandler(Content_Refreshed);
    6373    }
    6474
     
    8797      progressTask = new TS.Task(UpdateProgress);
    8898      progressTask.Start();
     99      SetEnabledStateOfControls(false);
    89100    }
    90101
    91102    void Instance_Refreshed(object sender, EventArgs e) {
    92103      stopProgressTask = true;
     104      SetEnabledStateOfControls(true);
     105    }
     106
     107    void Content_Refreshing(object sender, EventArgs e) {
     108      stopProgressTask = false;
     109      progressTask = new TS.Task(UpdateProgress);
     110      progressTask.Start();
     111      SetEnabledStateOfControls(false);
     112    }
     113
     114    void Content_Refreshed(object sender, EventArgs e) {
     115      stopProgressTask = true;
     116      SetEnabledStateOfControls(true);
    93117    }
    94118
     
    110134      if (Content == null) {
    111135        slaveView.Content = null;
     136        scheduleView.Content = null;
     137        permissionView.Content = null;
     138        permissionView.FetchSelectedUsers = null;
    112139        treeSlaveGroup.Nodes.Clear();
    113140      } else {
     141        permissionView.Content = Access.AccessClient.Instance;
    114142        treeSlaveGroup.Nodes.Clear();
    115143
     
    134162              tn.Tag = g;
    135163              tn.Text = g.Name;
     164              if (g.OwnerUserId == Access.UserInformation.Instance.User.Id) tn.BackColor = ownedResourceColor;
    136165
    137166              BuildSlaveGroupTree(g, tn);
     
    144173              stn.SelectedImageIndex = stn.ImageIndex;
    145174              stn.Tag = g;
     175              if (g.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor;
    146176              ungrp.Nodes.Add(stn);
    147177            }
     
    162192        stn.SelectedImageIndex = stn.ImageIndex;
    163193        stn.Tag = r;
     194        if (r.OwnerUserId == Access.UserInformation.Instance.User.Id) stn.BackColor = ownedResourceColor;
    164195        tn.Nodes.Add(stn);
    165196
     
    174205        btnRemoveGroup.Enabled = false;
    175206        btnSave.Enabled = false;
     207        btnPermissionsSave.Enabled = false;
     208        permissionView.Enabled = false;
    176209      } else {
    177210        btnAddGroup.Enabled = true;
     
    181214    }
    182215
    183     private void treeSlaveGroup_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) {
    184       if (slaveView.Content != null && slaveView.Content is SlaveGroup) {
    185         slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
    186       }
    187 
    188       slaveView.Content = (Resource)e.Node.Tag;
    189       HiveAdminClient.Instance.DowntimeForResourceId = ((Resource)e.Node.Tag).Id;
    190 
    191       if (e.Node.Tag is SlaveGroup) {
    192         slaveView.Content.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
    193       }
    194 
    195       if (tabSlaveGroup.SelectedIndex == 1) {
    196         UpdateScheduleAsync();
     216    public virtual void SetEnabledStateOfControls(bool state) {
     217      if (InvokeRequired) {
     218        Invoke(new Action(() => SetEnabledStateOfControls(state)));
     219      } else {
     220        if (Content == null) state = false;
     221        btnAddGroup.Enabled = state;
     222        btnRemoveGroup.Enabled = state;
     223        btnSave.Enabled = state;
     224        scheduleView.SetEnabledStateOfControls(state && IsAuthorized(slaveView.Content));
     225        btnPermissionsSave.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null;
     226        permissionView.Enabled = state && permissionView.FetchSelectedUsers != null && Content != null;
     227      }
     228    }
     229
     230    private bool IsAuthorized(Resource resource) {
     231      return resource != null
     232          && resource.Name != UngroupedGroupName
     233          && resource.Id != Guid.Empty
     234          && HiveServiceLocator.Instance.CallHiveService<bool>(service => { return service.AuthorizesForResourceAdministration(resource.Id); });
     235    }
     236
     237    private void treeSlaveGroup_AfterSelect(object sender, TreeViewEventArgs e) {
     238      if (e.Action != TreeViewAction.Unknown) {
     239        Resource selectedResource = ((Resource)e.Node.Tag);
     240        currentlyAuthorized = IsAuthorized(selectedResource);
     241        if (currentlyAuthorized) {
     242          permissionView.FetchSelectedUsers = new Func<List<Guid>>(() => {
     243            return HiveServiceLocator.Instance.CallHiveService<List<ResourcePermission>>(service => {
     244              return service.GetResourcePermissions(selectedResource.Id);
     245            }).Select(x => x.GrantedUserId).ToList();
     246          });
     247          if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions);
     248        } else {
     249          permissionView.FetchSelectedUsers = null;
     250          btnPermissionsSave.Enabled = false;
     251          if (selectedResource.Id == Guid.Empty) {
     252            if (!tabSlaveGroup.TabPages.Contains(tabPermissions)) tabSlaveGroup.TabPages.Add(tabPermissions);
     253          } else tabSlaveGroup.TabPages.Remove(tabPermissions);
     254        }
     255
     256        if (slaveView.Content != null && slaveView.Content is SlaveGroup) {
     257          slaveView.Content.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
     258        }
     259
     260        slaveView.Content = selectedResource;
     261        HiveAdminClient.Instance.DowntimeForResourceId = selectedResource.Id;
     262
     263        if (selectedResource is SlaveGroup) {
     264          slaveView.Content.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(SlaveViewContent_PropertyChanged);
     265        }
     266
     267        if (tabSlaveGroup.SelectedIndex == 1) {
     268          UpdateScheduleAsync();
     269        } else if (tabSlaveGroup.SelectedIndex == 2) {
     270          UpdatePermissionsAsync();
     271        }
    197272      }
    198273    }
     
    217292      SlaveGroup newGroup = new SlaveGroup();
    218293      newGroup.Name = "New Group";
     294      newGroup.OwnerUserId = UserInformation.Instance.User.Id;
    219295      Content.Add(newGroup);
    220296    }
     
    269345        if (destNode.TreeView == newNode.TreeView) {
    270346          if (destNode.Text == UngroupedGroupName || (destNode.Parent != null && destNode.Parent.Text == UngroupedGroupName)) {
    271             MessageBox.Show(String.Format("You can't drag items to the {0} group.{1}This group only contains slaves which haven't yet been assigned to a real group.",
     347            MessageBox.Show(string.Format("You can't drag items to the group \"{0}\".{1}This group only contains slaves which haven't yet been assigned to a real group.",
    272348              UngroupedGroupName, Environment.NewLine), "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Information);
    273349            return;
     
    285361
    286362          if (newNode.Tag is SlaveGroup && CheckParentsEqualsMovedNode(parentNode, newNode)) {
     363            return;
     364          }
     365
     366          SlaveGroup parent = (SlaveGroup)parentNode.Tag;
     367
     368          if (parent.OwnerUserId != null && !IsAuthorized(parent)) {
     369            MessageBox.Show(string.Format("You don't have the permissions to drag items to the group \"{0}\".", ((Resource)parentNode.Tag).Name),
     370              "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
    287371            return;
    288372          }
     
    330414    private void treeSlaveGroup_ItemDrag(object sender, ItemDragEventArgs e) {
    331415      TreeNode sourceNode = (TreeNode)e.Item;
    332       DoDragDrop(sourceNode, DragDropEffects.All);
     416      if (IsAuthorized((Resource)sourceNode.Tag))
     417        DoDragDrop(sourceNode, DragDropEffects.All);
    333418    }
    334419
     
    403488    private void UpdateSchedule() {
    404489      HiveAdminClient.Instance.RefreshCalendar();
    405       scheduleView.Invoke(new Action(() => scheduleView.Content = HiveAdminClient.Instance.Downtimes));
     490      scheduleView.Invoke(new Action(() => {
     491        scheduleView.Content = HiveAdminClient.Instance.Downtimes;
     492        SetEnabledStateOfControls(currentlyAuthorized);
     493      }));
    406494    }
    407495
     
    412500    }
    413501
     502    private void UpdatePermissions() {
     503      if (permissionView.Content != null && permissionView.FetchSelectedUsers != null)
     504        permissionView.Invoke(new Action(() => permissionView.ManualRefresh()));
     505    }
     506
     507    private void UpdatePermissionsAsync() {
     508      TS.Task.Factory.StartNew(UpdatePermissions).ContinueWith((t) => {
     509        DisplayError(t.Exception);
     510      }, TaskContinuationOptions.OnlyOnFaulted);
     511    }
     512
     513
    414514    private void DisplayError(Exception ex) {
    415515      MessageBox.Show(string.Format("An error occured while updating: {0} {1}", Environment.NewLine, ex.Message), "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
    419519      if (tabSlaveGroup.SelectedIndex == 1) {
    420520        UpdateScheduleAsync();
     521      } else if (tabSlaveGroup.SelectedIndex == 2) {
     522        UpdatePermissionsAsync();
    421523      }
    422524    }
     
    429531      UpdateResourcesAsync();
    430532    }
     533
     534    private void btnPermissionsSave_Click(object sender, EventArgs e) {
     535      SetEnabledStateOfControls(false);
     536      HiveServiceLocator.Instance.CallHiveService(service => {
     537        service.GrantResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetAddedUsers().Select(x => x.Id).ToList());
     538        service.RevokeResourcePermissions(((Resource)treeSlaveGroup.SelectedNode.Tag).Id, permissionView.GetDeletedUsers().Select(x => x.Id).ToList());
     539      });
     540      SetEnabledStateOfControls(true);
     541    }
    431542  }
    432543}
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.Designer.cs

    r7967 r8051  
    7171      this.dvOnline.ActiveTool = drawTool1;
    7272      this.dvOnline.AmPmDisplay = false;
    73       this.dvOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    74                   | System.Windows.Forms.AnchorStyles.Left)));
     73      this.dvOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     74            | System.Windows.Forms.AnchorStyles.Right)));
    7575      this.dvOnline.AppointmentDuration = Calendar.AppointmentSlotDuration.SixtyMinutes;
    7676      this.dvOnline.AppointmentHeightMode = Calendar.AppHeightDrawMode.TrueHeightAll;
     
    8383      this.dvOnline.EnableTimeIndicator = false;
    8484      this.dvOnline.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F);
    85       this.dvOnline.Location = new System.Drawing.Point(9, 176);
     85      this.dvOnline.Location = new System.Drawing.Point(3, 183);
    8686      this.dvOnline.MinHalfHourApp = false;
    8787      this.dvOnline.Name = "dvOnline";
    8888      this.dvOnline.SelectionEnd = new System.DateTime(((long)(0)));
    8989      this.dvOnline.SelectionStart = new System.DateTime(((long)(0)));
    90       this.dvOnline.Size = new System.Drawing.Size(823, 354);
     90      this.dvOnline.Size = new System.Drawing.Size(836, 354);
    9191      this.dvOnline.StartDate = new System.DateTime(((long)(0)));
    9292      this.dvOnline.TabIndex = 54;
     
    123123      // groupBox1
    124124      //
     125      this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    125126      this.groupBox1.Controls.Add(this.txttimeTo);
    126127      this.groupBox1.Controls.Add(this.txttimeFrom);
     
    133134      this.groupBox1.Controls.Add(this.label1);
    134135      this.groupBox1.Controls.Add(this.btCreate);
    135       this.groupBox1.Location = new System.Drawing.Point(373, 4);
     136      this.groupBox1.Location = new System.Drawing.Point(375, 3);
    136137      this.groupBox1.Name = "groupBox1";
    137       this.groupBox1.Size = new System.Drawing.Size(254, 161);
     138      this.groupBox1.Size = new System.Drawing.Size(259, 168);
    138139      this.groupBox1.TabIndex = 56;
    139140      this.groupBox1.TabStop = false;
     
    217218      // btnSaveCal
    218219      //
     220      this.btnSaveCal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    219221      this.btnSaveCal.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb;
    220222      this.btnSaveCal.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    221       this.btnSaveCal.Location = new System.Drawing.Point(633, 41);
     223      this.btnSaveCal.Location = new System.Drawing.Point(640, 41);
    222224      this.btnSaveCal.Name = "btnSaveCal";
    223225      this.btnSaveCal.Size = new System.Drawing.Size(199, 26);
     
    230232      // btnClearCal
    231233      //
     234      this.btnClearCal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    232235      this.btnClearCal.Image = HeuristicLab.Common.Resources.VSImageLibrary.Document;
    233236      this.btnClearCal.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    234       this.btnClearCal.Location = new System.Drawing.Point(633, 9);
     237      this.btnClearCal.Location = new System.Drawing.Point(640, 9);
    235238      this.btnClearCal.Name = "btnClearCal";
    236239      this.btnClearCal.Size = new System.Drawing.Size(199, 26);
     
    243246      // mcOnline
    244247      //
     248      this.mcOnline.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     249            | System.Windows.Forms.AnchorStyles.Right)));
    245250      this.mcOnline.CalendarDimensions = new System.Drawing.Size(2, 1);
    246       this.mcOnline.Location = new System.Drawing.Point(4, 9);
     251      this.mcOnline.Location = new System.Drawing.Point(3, 9);
    247252      this.mcOnline.Name = "mcOnline";
    248253      this.mcOnline.TabIndex = 55;
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs

    r7259 r8051  
    228228    protected override void SetEnabledStateOfControls() {
    229229      base.SetEnabledStateOfControls();
    230       if (Content == null) {
    231         btnSaveCal.Enabled = false;
     230    }
     231
     232    public virtual void SetEnabledStateOfControls(bool state) {
     233      if (InvokeRequired) {
     234        Invoke(new Action(() => SetEnabledStateOfControls(state)));
    232235      } else {
    233         btnSaveCal.Enabled = true;
     236        if (Content == null) state = false;
     237        groupBox1.Enabled = state;
     238        btnClearCal.Enabled = state;
     239        btnSaveCal.Enabled = state;
    234240      }
    235241    }
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.Designer.cs

    r7967 r8051  
    6767      this.cbxDisposable = new System.Windows.Forms.CheckBox();
    6868      this.label4 = new System.Windows.Forms.Label();
     69      this.cbxPublic = new System.Windows.Forms.CheckBox();
     70      this.label5 = new System.Windows.Forms.Label();
    6971      this.SuspendLayout();
    7072      //
    7173      // txtSlaveState
    7274      //
    73       this.txtSlaveState.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     75      this.txtSlaveState.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    7476            | System.Windows.Forms.AnchorStyles.Right)));
    7577      this.txtSlaveState.Enabled = false;
    76       this.txtSlaveState.Location = new System.Drawing.Point(146, 216);
     78      this.txtSlaveState.Location = new System.Drawing.Point(146, 242);
    7779      this.txtSlaveState.Name = "txtSlaveState";
    7880      this.txtSlaveState.Size = new System.Drawing.Size(390, 20);
     
    8183      // txtOS
    8284      //
    83       this.txtOS.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     85      this.txtOS.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    8486            | System.Windows.Forms.AnchorStyles.Right)));
    8587      this.txtOS.Enabled = false;
    86       this.txtOS.Location = new System.Drawing.Point(146, 190);
     88      this.txtOS.Location = new System.Drawing.Point(146, 216);
    8789      this.txtOS.Name = "txtOS";
    8890      this.txtOS.Size = new System.Drawing.Size(390, 20);
     
    9294      //
    9395      this.label15.AutoSize = true;
    94       this.label15.Location = new System.Drawing.Point(3, 219);
     96      this.label15.Location = new System.Drawing.Point(3, 245);
    9597      this.label15.Name = "label15";
    9698      this.label15.Size = new System.Drawing.Size(35, 13);
     
    101103      //
    102104      this.label14.AutoSize = true;
    103       this.label14.Location = new System.Drawing.Point(3, 193);
     105      this.label14.Location = new System.Drawing.Point(3, 219);
    104106      this.label14.Name = "label14";
    105107      this.label14.Size = new System.Drawing.Size(93, 13);
     
    109111      // txtDetailsDescription
    110112      //
    111       this.txtDetailsDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     113      this.txtDetailsDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    112114            | System.Windows.Forms.AnchorStyles.Right)));
    113115      this.txtDetailsDescription.Enabled = false;
    114       this.txtDetailsDescription.Location = new System.Drawing.Point(146, 86);
     116      this.txtDetailsDescription.Location = new System.Drawing.Point(146, 112);
    115117      this.txtDetailsDescription.Name = "txtDetailsDescription";
    116118      this.txtDetailsDescription.Size = new System.Drawing.Size(390, 20);
     
    120122      //
    121123      this.label13.AutoSize = true;
    122       this.label13.Location = new System.Drawing.Point(3, 89);
     124      this.label13.Location = new System.Drawing.Point(3, 115);
    123125      this.label13.Name = "label13";
    124126      this.label13.Size = new System.Drawing.Size(63, 13);
     
    128130      // txtName
    129131      //
    130       this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     132      this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    131133            | System.Windows.Forms.AnchorStyles.Right)));
    132134      this.txtName.Location = new System.Drawing.Point(146, 8);
     
    138140      // txtCPU
    139141      //
    140       this.txtCPU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     142      this.txtCPU.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    141143            | System.Windows.Forms.AnchorStyles.Right)));
    142144      this.txtCPU.Enabled = false;
    143       this.txtCPU.Location = new System.Drawing.Point(146, 112);
     145      this.txtCPU.Location = new System.Drawing.Point(146, 138);
    144146      this.txtCPU.Name = "txtCPU";
    145147      this.txtCPU.Size = new System.Drawing.Size(390, 20);
     
    148150      // txtMemory
    149151      //
    150       this.txtMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     152      this.txtMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    151153            | System.Windows.Forms.AnchorStyles.Right)));
    152154      this.txtMemory.Enabled = false;
    153       this.txtMemory.Location = new System.Drawing.Point(146, 138);
     155      this.txtMemory.Location = new System.Drawing.Point(146, 164);
    154156      this.txtMemory.Name = "txtMemory";
    155157      this.txtMemory.Size = new System.Drawing.Size(390, 20);
     
    158160      // txtLastHeartbeat
    159161      //
    160       this.txtLastHeartbeat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     162      this.txtLastHeartbeat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    161163            | System.Windows.Forms.AnchorStyles.Right)));
    162164      this.txtLastHeartbeat.Enabled = false;
    163       this.txtLastHeartbeat.Location = new System.Drawing.Point(146, 242);
     165      this.txtLastHeartbeat.Location = new System.Drawing.Point(146, 268);
    164166      this.txtLastHeartbeat.Name = "txtLastHeartbeat";
    165167      this.txtLastHeartbeat.Size = new System.Drawing.Size(390, 20);
     
    169171      //
    170172      this.label12.AutoSize = true;
    171       this.label12.Location = new System.Drawing.Point(3, 245);
     173      this.label12.Location = new System.Drawing.Point(3, 271);
    172174      this.label12.Name = "label12";
    173175      this.label12.Size = new System.Drawing.Size(80, 13);
     
    178180      //
    179181      this.label11.AutoSize = true;
    180       this.label11.Location = new System.Drawing.Point(3, 141);
     182      this.label11.Location = new System.Drawing.Point(3, 167);
    181183      this.label11.Name = "label11";
    182184      this.label11.Size = new System.Drawing.Size(47, 13);
     
    187189      //
    188190      this.label10.AutoSize = true;
    189       this.label10.Location = new System.Drawing.Point(3, 115);
     191      this.label10.Location = new System.Drawing.Point(3, 141);
    190192      this.label10.Name = "label10";
    191193      this.label10.Size = new System.Drawing.Size(32, 13);
     
    205207      //
    206208      this.label1.AutoSize = true;
    207       this.label1.Location = new System.Drawing.Point(3, 167);
     209      this.label1.Location = new System.Drawing.Point(3, 193);
    208210      this.label1.Name = "label1";
    209211      this.label1.Size = new System.Drawing.Size(70, 13);
     
    213215      // txtFreeMemory
    214216      //
    215       this.txtFreeMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     217      this.txtFreeMemory.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    216218            | System.Windows.Forms.AnchorStyles.Right)));
    217219      this.txtFreeMemory.Enabled = false;
    218       this.txtFreeMemory.Location = new System.Drawing.Point(146, 164);
     220      this.txtFreeMemory.Location = new System.Drawing.Point(146, 190);
    219221      this.txtFreeMemory.Name = "txtFreeMemory";
    220222      this.txtFreeMemory.Size = new System.Drawing.Size(390, 20);
     
    223225      // txtId
    224226      //
    225       this.txtId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     227      this.txtId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    226228            | System.Windows.Forms.AnchorStyles.Right)));
    227229      this.txtId.Enabled = false;
    228       this.txtId.Location = new System.Drawing.Point(146, 60);
     230      this.txtId.Location = new System.Drawing.Point(146, 86);
    229231      this.txtId.Name = "txtId";
    230232      this.txtId.Size = new System.Drawing.Size(390, 20);
     
    234236      //
    235237      this.label2.AutoSize = true;
    236       this.label2.Location = new System.Drawing.Point(3, 63);
     238      this.label2.Location = new System.Drawing.Point(3, 89);
    237239      this.label2.Name = "label2";
    238240      this.label2.Size = new System.Drawing.Size(19, 13);
     
    251253      // txtHbIntervall
    252254      //
    253       this.txtHbIntervall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     255      this.txtHbIntervall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    254256            | System.Windows.Forms.AnchorStyles.Right)));
    255257      this.txtHbIntervall.Location = new System.Drawing.Point(146, 34);
     
    262264      //
    263265      this.cbxDisposable.AutoSize = true;
    264       this.cbxDisposable.Location = new System.Drawing.Point(146, 268);
     266      this.cbxDisposable.Enabled = false;
     267      this.cbxDisposable.Location = new System.Drawing.Point(146, 297);
    265268      this.cbxDisposable.Name = "cbxDisposable";
    266269      this.cbxDisposable.Size = new System.Drawing.Size(15, 14);
    267270      this.cbxDisposable.TabIndex = 34;
    268271      this.cbxDisposable.UseVisualStyleBackColor = true;
    269       this.cbxDisposable.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
     272      this.cbxDisposable.CheckedChanged += new System.EventHandler(this.cbxDisposable_CheckedChanged);
    270273      //
    271274      // label4
    272275      //
    273276      this.label4.AutoSize = true;
    274       this.label4.Location = new System.Drawing.Point(3, 269);
     277      this.label4.Location = new System.Drawing.Point(3, 297);
    275278      this.label4.Name = "label4";
    276279      this.label4.Size = new System.Drawing.Size(62, 13);
     
    278281      this.label4.Text = "Disposable:";
    279282      //
     283      // cbxPublic
     284      //
     285      this.cbxPublic.AutoSize = true;
     286      this.cbxPublic.Enabled = false;
     287      this.cbxPublic.Location = new System.Drawing.Point(146, 63);
     288      this.cbxPublic.Name = "cbxPublic";
     289      this.cbxPublic.Size = new System.Drawing.Size(15, 14);
     290      this.cbxPublic.TabIndex = 36;
     291      this.cbxPublic.UseVisualStyleBackColor = true;
     292      this.cbxPublic.CheckedChanged += new System.EventHandler(this.cbxPublic_CheckedChanged);
     293      //
     294      // label5
     295      //
     296      this.label5.AutoSize = true;
     297      this.label5.Location = new System.Drawing.Point(3, 63);
     298      this.label5.Name = "label5";
     299      this.label5.Size = new System.Drawing.Size(39, 13);
     300      this.label5.TabIndex = 37;
     301      this.label5.Text = "Public:";
     302      //
    280303      // SlaveView
    281304      //
    282305      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    283306      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     307      this.Controls.Add(this.label5);
     308      this.Controls.Add(this.cbxPublic);
    284309      this.Controls.Add(this.label4);
    285310      this.Controls.Add(this.cbxDisposable);
     
    305330      this.Controls.Add(this.label9);
    306331      this.Name = "SlaveView";
    307       this.Size = new System.Drawing.Size(539, 285);
     332      this.Size = new System.Drawing.Size(539, 407);
    308333      this.ResumeLayout(false);
    309334      this.PerformLayout();
     
    335360    private System.Windows.Forms.CheckBox cbxDisposable;
    336361    private System.Windows.Forms.Label label4;
     362    private System.Windows.Forms.CheckBox cbxPublic;
     363    private System.Windows.Forms.Label label5;
    337364  }
    338365}
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/SlaveView.cs

    r7862 r8051  
    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.