- Timestamp:
- 06/21/11 16:51:03 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 13 added
- 4 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/HeuristicLab.Clients.Hive.ExperimentManager-3.4.csproj
r6418 r6463 102 102 </PropertyGroup> 103 103 <ItemGroup> 104 <Reference Include="HeuristicLab.Clients.Hive.ExperimentManager-3.4, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 104 105 <Reference Include="HeuristicLab.Collections-3.3"> 105 106 <HintPath>C:\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath> … … 151 152 </ItemGroup> 152 153 <ItemGroup> 154 <Compile Include="Views\HiveExperimentManagerView.cs"> 155 <SubType>UserControl</SubType> 156 </Compile> 157 <Compile Include="Views\HiveExperimentManagerView.Designer.cs"> 158 <DependentUpon>HiveExperimentManagerView.cs</DependentUpon> 159 </Compile> 160 <Compile Include="MenuItems\ExperimentManagerMenuItem.cs" /> 161 <Compile Include="Views\HiveExperimentPermissionListView.cs"> 162 <SubType>UserControl</SubType> 163 </Compile> 164 <Compile Include="Views\HiveExperimentPermissionListView.Designer.cs"> 165 <DependentUpon>HiveExperimentPermissionListView.cs</DependentUpon> 166 </Compile> 167 <Compile Include="Views\HiveExperimentPermissionView.cs"> 168 <SubType>UserControl</SubType> 169 </Compile> 170 <Compile Include="Views\HiveExperimentPermissionView.Designer.cs"> 171 <DependentUpon>HiveExperimentPermissionView.cs</DependentUpon> 172 </Compile> 153 173 <Compile Include="Views\RefreshableHiveExperimentListView.cs"> 154 174 <SubType>UserControl</SubType> … … 157 177 <DependentUpon>RefreshableHiveExperimentListView.cs</DependentUpon> 158 178 </Compile> 159 <Compile Include="Views\HiveExperimentManagerView.cs">160 <SubType>UserControl</SubType>161 </Compile>162 <Compile Include="Views\HiveExperimentManagerView.Designer.cs">163 <DependentUpon>HiveExperimentManagerView.cs</DependentUpon>164 </Compile>165 <Compile Include="MenuItems\ExperimentManagerMenuItem.cs" />166 179 <Compile Include="Views\RefreshableHiveExperimentView.cs"> 167 180 <SubType>UserControl</SubType> … … 200 213 <DependentUpon>HiveExperimentManagerView.cs</DependentUpon> 201 214 <SubType>Designer</SubType> 215 </EmbeddedResource> 216 <EmbeddedResource Include="Views\HiveExperimentPermissionView.resx"> 217 <DependentUpon>HiveExperimentPermissionView.cs</DependentUpon> 202 218 </EmbeddedResource> 203 219 <EmbeddedResource Include="Views\RefreshableHiveExperimentView.resx"> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.Designer.cs
r6444 r6463 54 54 this.stateTabPage = new System.Windows.Forms.TabPage(); 55 55 this.stateLogViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 56 this.sharingTabPage = new System.Windows.Forms.TabPage(); 57 this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.ExperimentManager.Views.HiveExperimentPermissionListView(); 56 58 this.logTabPage = new System.Windows.Forms.TabPage(); 57 59 this.logView = new HeuristicLab.Core.Views.LogView(); … … 77 79 this.calculatingLabel = new System.Windows.Forms.Label(); 78 80 this.jobsLabel = new System.Windows.Forms.Label(); 81 this.refreshPermissionsButton = new System.Windows.Forms.Button(); 79 82 this.tabControl.SuspendLayout(); 80 83 this.jobsTabPage.SuspendLayout(); 81 84 this.stateTabPage.SuspendLayout(); 85 this.sharingTabPage.SuspendLayout(); 82 86 this.logTabPage.SuspendLayout(); 83 87 this.infoGroupBox.SuspendLayout(); … … 91 95 this.tabControl.Controls.Add(this.jobsTabPage); 92 96 this.tabControl.Controls.Add(this.stateTabPage); 97 this.tabControl.Controls.Add(this.sharingTabPage); 93 98 this.tabControl.Controls.Add(this.logTabPage); 94 99 this.tabControl.Location = new System.Drawing.Point(0, 78); … … 132 137 this.stateTabPage.Size = new System.Drawing.Size(709, 426); 133 138 this.stateTabPage.TabIndex = 6; 134 this.stateTabPage.Text = "State ";139 this.stateTabPage.Text = "States"; 135 140 this.stateTabPage.UseVisualStyleBackColor = true; 136 141 // … … 149 154 this.stateLogViewHost.ViewType = null; 150 155 // 156 // sharingTabPage 157 // 158 this.sharingTabPage.Controls.Add(this.refreshPermissionsButton); 159 this.sharingTabPage.Controls.Add(this.hiveExperimentPermissionListView); 160 this.sharingTabPage.Location = new System.Drawing.Point(4, 22); 161 this.sharingTabPage.Name = "sharingTabPage"; 162 this.sharingTabPage.Size = new System.Drawing.Size(709, 426); 163 this.sharingTabPage.TabIndex = 7; 164 this.sharingTabPage.Text = "Sharing"; 165 this.sharingTabPage.UseVisualStyleBackColor = true; 166 // 167 // hiveExperimentPermissionListView 168 // 169 this.hiveExperimentPermissionListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 170 | System.Windows.Forms.AnchorStyles.Left) 171 | System.Windows.Forms.AnchorStyles.Right))); 172 this.hiveExperimentPermissionListView.Caption = "HiveExperimentPermissionList View"; 173 this.hiveExperimentPermissionListView.Content = null; 174 this.hiveExperimentPermissionListView.Location = new System.Drawing.Point(3, 33); 175 this.hiveExperimentPermissionListView.Name = "hiveExperimentPermissionListView"; 176 this.hiveExperimentPermissionListView.ReadOnly = false; 177 this.hiveExperimentPermissionListView.Size = new System.Drawing.Size(703, 390); 178 this.hiveExperimentPermissionListView.TabIndex = 0; 179 // 151 180 // logTabPage 152 181 // … … 167 196 this.logView.Name = "logView"; 168 197 this.logView.ReadOnly = false; 169 this.logView.Size = new System.Drawing.Size( 813, 494);198 this.logView.Size = new System.Drawing.Size(709, 426); 170 199 this.logView.TabIndex = 0; 171 200 // … … 381 410 this.jobsLabel.TabIndex = 0; 382 411 this.jobsLabel.Text = "Jobs:"; 412 // 413 // refreshPermissionsButton 414 // 415 this.refreshPermissionsButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshPermissionsButton.Image"))); 416 this.refreshPermissionsButton.Location = new System.Drawing.Point(3, 3); 417 this.refreshPermissionsButton.Name = "refreshPermissionsButton"; 418 this.refreshPermissionsButton.Size = new System.Drawing.Size(24, 24); 419 this.refreshPermissionsButton.TabIndex = 23; 420 this.toolTip.SetToolTip(this.refreshPermissionsButton, "Refresh Data"); 421 this.refreshPermissionsButton.UseVisualStyleBackColor = true; 422 this.refreshPermissionsButton.Click += new System.EventHandler(this.refreshPermissionsButton_Click); 383 423 // 384 424 // RefreshableHiveExperimentView … … 406 446 this.jobsTabPage.ResumeLayout(false); 407 447 this.stateTabPage.ResumeLayout(false); 448 this.sharingTabPage.ResumeLayout(false); 408 449 this.logTabPage.ResumeLayout(false); 409 450 this.infoGroupBox.ResumeLayout(false); … … 443 484 private System.Windows.Forms.TabPage stateTabPage; 444 485 private ViewHost stateLogViewHost; 486 private System.Windows.Forms.TabPage sharingTabPage; 487 private HiveExperimentPermissionListView hiveExperimentPermissionListView; 488 private System.Windows.Forms.Button refreshPermissionsButton; 445 489 446 490 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.cs
r6444 r6463 21 21 22 22 using System; 23 using System.ComponentModel; 23 24 using System.Linq; 24 25 using System.Threading; … … 79 80 Content.HiveExperiment.HiveJobsChanged += new EventHandler(Content_HiveJobChanged); 80 81 Content.HiveExperiment.IsProgressingChanged += new EventHandler(Content_IsProgressingChanged); 81 } 82 Content.HiveExperiment.PropertyChanged += new PropertyChangedEventHandler(HiveExperiment_PropertyChanged); 83 } 84 82 85 private void DeregisterHiveExperimentEvents() { 83 86 Content.HiveExperiment.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); … … 85 88 Content.HiveExperiment.HiveJobsChanged -= new EventHandler(Content_HiveJobChanged); 86 89 Content.HiveExperiment.IsProgressingChanged -= new EventHandler(Content_IsProgressingChanged); 90 Content.HiveExperiment.PropertyChanged -= new PropertyChangedEventHandler(HiveExperiment_PropertyChanged); 87 91 } 88 92 89 93 private void RegisterHiveJobEvents() { 90 Content.HiveExperiment.HiveJobs.ItemsAdded += new Collection s.CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);91 Content.HiveExperiment.HiveJobs.ItemsRemoved += new Collection s.CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);92 Content.HiveExperiment.HiveJobs.CollectionReset += new Collection s.CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);94 Content.HiveExperiment.HiveJobs.ItemsAdded += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 95 Content.HiveExperiment.HiveJobs.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 96 Content.HiveExperiment.HiveJobs.CollectionReset += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 93 97 } 94 98 private void DeregisterHiveJobEvents() { 95 Content.HiveExperiment.HiveJobs.ItemsAdded -= new Collection s.CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);96 Content.HiveExperiment.HiveJobs.ItemsRemoved -= new Collection s.CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);97 Content.HiveExperiment.HiveJobs.CollectionReset -= new Collection s.CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);99 Content.HiveExperiment.HiveJobs.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 100 Content.HiveExperiment.HiveJobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 101 Content.HiveExperiment.HiveJobs.CollectionReset -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 98 102 } 99 103 … … 116 120 logView.Content = Content.Log; 117 121 } 122 hiveExperimentPermissionListView.Content = null; // has to be filled by refresh button 118 123 Content_JobStatisticsChanged(this, EventArgs.Empty); 119 124 Content_HiveExperimentChanged(this, EventArgs.Empty); … … 121 126 Content_IsProgressingChanged(this, EventArgs.Empty); 122 127 Content_StateLogListChanged(this, EventArgs.Empty); 128 HiveExperiment_PropertyChanged(this, new PropertyChangedEventArgs("Id")); 123 129 SetEnabledStateOfControls(); 124 130 } … … 277 283 } 278 284 } 285 286 private void HiveExperiment_PropertyChanged(object sender, PropertyChangedEventArgs e) { 287 if(this.Content != null && e.PropertyName == "Id") this.hiveExperimentPermissionListView.HiveExperimentId = this.Content.HiveExperiment.Id; 288 } 279 289 #endregion 280 290 … … 320 330 }, null); 321 331 } 332 333 private void refreshPermissionsButton_Click(object sender, EventArgs e) { 334 hiveExperimentPermissionListView.Content = HiveClient.GetHiveExperimentPermissions(this.Content.HiveExperiment.Id); 335 } 336 337 322 338 #endregion 323 339 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.resx
r6373 r6463 119 119 </resheader> 120 120 <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 121 <data name="startButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 122 <value> 123 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 124 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 125 Cv8BNGKaggAAALBJREFUOE9j+P//PwMlGKvmsv3ZbsQaitWAhBkR/4k1BKcBlmX6RBmC1YCoKUH/N9xa 126 /J8YQ7AaEDzBG2Q7UYZgNcCnyxlsAAhHLQrA6xKsBjg2W/zP2BAL1mzbrP9fp1jhv0QaN4hWQ48drAaY 127 1+ihaOZPYMGqGWQYVgP0SpXhNuPTjNMAlXwpsLMJacZpgHSGIFGacRogksyJ089EBSK20MaVNyjKiTi9 128 QGxOBKkDACT9xOni1RbMAAAAAElFTkSuQmCC 129 </value> 130 </data> 131 <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 132 <value>17, 17</value> 133 </metadata> 134 <data name="stopButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 135 <value> 136 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 137 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 138 Cv8BNGKaggAAAWtJREFUOE/Nkz9IAmEYxl0KGqKtMVpaIiEoipYIgnByCSGhSQiCNBqCMiqwsr8clChF 139 YmYSSikeWEbZH2qwEhKhwhAXjQwKEbw0zyue7nO7hgtyqOEbf7/ne5+XVwJAUsorCSbB/0xAeT+xSBcw 140 685B52QwYU9jdOMFw+ZnDK0+YtCUyHzvSzACge/jH7hLcAg8FHB4w8IbZOEKsLD4s5AqdnheWLpAQJKj 141 TxyCUa4IOi/yWPPlsOJlMGePoU6+JS4g376NczgKsdg+y8PIg3pnBmPWV6ipMGq61sUFZOarCAf3JZ98 142 8I75XQKnoDEmoRg5RXW7QVxACvOHWdhO8lim36C1ptFvSEI5E4NsYA9VLUviAtK255qFcT+LSXsKahMP 143 66OQa0Po7HOholEvLiCr2jxmMG2LQEOFoBw/55M96FA50NpjRlmDTlxA9tym8qGpl0Z9twO1Mktx7srm 144 BZRLp34W/Oao/v4WvgBcI/R+TmAaZAAAAABJRU5ErkJggg== 145 </value> 146 </data> 147 <data name="resetButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 148 <value> 149 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 150 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 151 Cv8BNGKaggAAAX9JREFUOE9j+P//PwMlmCLNIIupa0Dv5r//Ybht7bf/jSs+/69d/P5/xbxX/0tmP/9f 152 MP3x/9JZj4EWI7yN4oKuDb/+bzr57f/KQ1/+L9jz6f/lBz//965997956RuwIXnTX/zXDV2F2wCQrSsO 153 fvk/b9en/7ee/AIp/N+w5M3/0rkv/+dMff4/qffZf1W/RbgNADl5zo5P/x++/AHWDAIls1/+z5ry/H9C 154 79P/Ya2P/8u5zcJtAMi/Nx99hmtGZhy7/Oa/V+3D/2J2k3AbAPJn87I3/09deQnXG9355H9g0yMw36H0 155 /n9+s27cBoBCuhxoSM605/93HrkL1hTQ8Oi/W9UDMNss7+5/ToNW3AaAoikb6N9EoH/D2x7/n7Puwn/X 156 ivv/bYrvgQ3Qy7j1n1WnEbcBoDiO63n6P7Tl0X+fuof/ncrv/7cuvPffJPsO2AD1JCIMsEza9h+EjWM2 157 /NcKXv5fwWMuOOB4TTr/s+k24XcB0BKSkzbJGtAtodgAAJMl+qgyDSjjAAAAAElFTkSuQmCC 158 </value> 159 </data> 160 <data name="pauseButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 161 <value> 162 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 163 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 164 Cv8BNGKaggAAAL5JREFUOE9j+P//PwMlmCLNIIsHoQG9m//+79rw63/e1EefQE5E56OHF4YXQJqvPvzz 165 Xzd0FVDtfwZ0PkED2tZ++3/r6e//qn6LwAag8wka0Lji8//LD3//l3ObBTYAnU/QgNrF7/+fuP77v5jd 166 JLAB6HyCBlTMe/V/94Wf//nNusEGoPMJGlAy+/n/9Sd//uc0aAUbgM4naEDB9Mf/F+z5/J9VpxFsADqf 167 oAGg+GfTbYIbgM4naACpGWvg8wIAkX3yJyVePz4AAAAASUVORK5CYII= 168 </value> 169 </data> 170 <data name="refreshButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 121 <data name="refreshPermissionsButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 171 122 <value> 172 123 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH … … 229 180 </value> 230 181 </data> 182 <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 183 <value>17, 17</value> 184 </metadata> 185 <data name="startButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 186 <value> 187 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 188 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 189 Cv8BNGKaggAAALBJREFUOE9j+P//PwMlGKvmsv3ZbsQaitWAhBkR/4k1BKcBlmX6RBmC1YCoKUH/N9xa 190 /J8YQ7AaEDzBG2Q7UYZgNcCnyxlsAAhHLQrA6xKsBjg2W/zP2BAL1mzbrP9fp1jhv0QaN4hWQ48drAaY 191 1+ihaOZPYMGqGWQYVgP0SpXhNuPTjNMAlXwpsLMJacZpgHSGIFGacRogksyJ089EBSK20MaVNyjKiTi9 192 QGxOBKkDACT9xOni1RbMAAAAAElFTkSuQmCC 193 </value> 194 </data> 195 <data name="stopButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 196 <value> 197 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 198 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 199 Cv8BNGKaggAAAWtJREFUOE/Nkz9IAmEYxl0KGqKtMVpaIiEoipYIgnByCSGhSQiCNBqCMiqwsr8clChF 200 YmYSSikeWEbZH2qwEhKhwhAXjQwKEbw0zyue7nO7hgtyqOEbf7/ne5+XVwJAUsorCSbB/0xAeT+xSBcw 201 685B52QwYU9jdOMFw+ZnDK0+YtCUyHzvSzACge/jH7hLcAg8FHB4w8IbZOEKsLD4s5AqdnheWLpAQJKj 202 TxyCUa4IOi/yWPPlsOJlMGePoU6+JS4g376NczgKsdg+y8PIg3pnBmPWV6ipMGq61sUFZOarCAf3JZ98 203 8I75XQKnoDEmoRg5RXW7QVxACvOHWdhO8lim36C1ptFvSEI5E4NsYA9VLUviAtK255qFcT+LSXsKahMP 204 66OQa0Po7HOholEvLiCr2jxmMG2LQEOFoBw/55M96FA50NpjRlmDTlxA9tym8qGpl0Z9twO1Mktx7srm 205 BZRLp34W/Oao/v4WvgBcI/R+TmAaZAAAAABJRU5ErkJggg== 206 </value> 207 </data> 208 <data name="resetButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 209 <value> 210 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 211 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 212 Cv8BNGKaggAAAX9JREFUOE9j+P//PwMlmCLNIIupa0Dv5r//Ybht7bf/jSs+/69d/P5/xbxX/0tmP/9f 213 MP3x/9JZj4EWI7yN4oKuDb/+bzr57f/KQ1/+L9jz6f/lBz//965997956RuwIXnTX/zXDV2F2wCQrSsO 214 fvk/b9en/7ee/AIp/N+w5M3/0rkv/+dMff4/qffZf1W/RbgNADl5zo5P/x++/AHWDAIls1/+z5ry/H9C 215 79P/Ya2P/8u5zcJtAMi/Nx99hmtGZhy7/Oa/V+3D/2J2k3AbAPJn87I3/09deQnXG9355H9g0yMw36H0 216 /n9+s27cBoBCuhxoSM605/93HrkL1hTQ8Oi/W9UDMNss7+5/ToNW3AaAoikb6N9EoH/D2x7/n7Puwn/X 217 ivv/bYrvgQ3Qy7j1n1WnEbcBoDiO63n6P7Tl0X+fuof/ncrv/7cuvPffJPsO2AD1JCIMsEza9h+EjWM2 218 /NcKXv5fwWMuOOB4TTr/s+k24XcB0BKSkzbJGtAtodgAAJMl+qgyDSjjAAAAAElFTkSuQmCC 219 </value> 220 </data> 221 <data name="pauseButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 222 <value> 223 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 224 YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAK/wAA 225 Cv8BNGKaggAAAL5JREFUOE9j+P//PwMlmCLNIIsHoQG9m//+79rw63/e1EefQE5E56OHF4YXQJqvPvzz 226 Xzd0FVDtfwZ0PkED2tZ++3/r6e//qn6LwAag8wka0Lji8//LD3//l3ObBTYAnU/QgNrF7/+fuP77v5jd 227 JLAB6HyCBlTMe/V/94Wf//nNusEGoPMJGlAy+/n/9Sd//uc0aAUbgM4naEDB9Mf/F+z5/J9VpxFsADqf 228 oAGg+GfTbYIbgM4naACpGWvg8wIAkX3yJyVePz4AAAAASUVORK5CYII= 229 </value> 230 </data> 231 <data name="refreshButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> 232 <value> 233 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 290 </value> 291 </data> 231 292 <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 232 293 <value>25</value> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HeuristicLab.Clients.Hive-3.4.csproj
r6452 r6463 115 115 <Compile Include="Jobs\ItemJob.cs" /> 116 116 <Compile Include="RefreshableHiveExperiment.cs" /> 117 <Compile Include="ServiceClients\HiveExperimentPermission.cs" /> 117 118 <Compile Include="StateLogList.cs" /> 118 119 <Compile Include="StateLogListList.cs" /> … … 156 157 <Compile Include="ServiceClients\NamedHiveItem.cs" /> 157 158 <Compile Include="ServiceClients\Heartbeat.cs" /> 158 <Compile Include="ServiceClients\HiveExperimentPermission.cs" />159 159 <Compile Include="ServiceClients\HiveItem.cs" /> 160 160 <Compile Include="ServiceClients\JobData.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/HiveClient.cs
r6452 r6463 110 110 HiveClient.Instance.UploadExperiment((RefreshableHiveExperiment)item, cancellationToken); 111 111 } 112 if (item is HiveExperimentPermission) { 113 var hep = (HiveExperimentPermission)item; 114 hep.GrantedUserId = ServiceLocator.Instance.CallHiveService((s) => s.GetUserIdByUsername(hep.GrantedUserName)); 115 if (hep.GrantedUserId == Guid.Empty) { 116 throw new ArgumentException(string.Format("The user {0} was not found.", hep.GrantedUserName)); 117 } 118 ServiceLocator.Instance.CallHiveService((s) => s.GrantPermission(hep.HiveExperimentId, hep.GrantedUserId, hep.Permission)); 119 } 112 120 } else { 113 121 if (item is HiveExperiment) … … 138 146 if (item is RefreshableHiveExperiment) 139 147 ServiceLocator.Instance.CallHiveService(s => s.DeleteHiveExperiment(item.Id)); 148 if (item is HiveExperimentPermission) { 149 var hep = (HiveExperimentPermission)item; 150 ServiceLocator.Instance.CallHiveService(s => s.RevokePermission(hep.HiveExperimentId, hep.GrantedUserId)); 151 } 140 152 item.Id = Guid.Empty; 141 153 } … … 241 253 .ContinueWith((x) => refreshableHiveExperiment.Log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted)); 242 254 } 243 Task.WaitAll(tasks.ToArray()); 255 try { 256 Task.WaitAll(tasks.ToArray()); 257 } 258 catch (AggregateException ae) { 259 if (!ae.InnerExceptions.All(e => e is TaskCanceledException)) throw ae; // for some reason the WaitAll throws a AggregateException containg a TaskCanceledException. i don't know where it comes from, however the tasks all finish properly, so for now just ignore it 260 } 244 261 } 245 262 finally { … … 281 298 private void UploadJobWithChildren(IProgress progress, HiveJob hiveJob, HiveJob parentHiveJob, IEnumerable<Guid> groups, int[] jobCount, int totalJobCount, Guid configPluginId, Guid hiveExperimentId, ILog log, bool isPrivileged, CancellationToken cancellationToken) { 282 299 jobUploadSemaphore.WaitOne(); 300 bool semaphoreReleased = false; 283 301 try { 284 302 cancellationToken.ThrowIfCancellationRequested(); … … 337 355 .ContinueWith((x) => log.LogException(x.Exception), TaskContinuationOptions.OnlyOnFaulted)); 338 356 } 339 Task.WaitAll(tasks.ToArray()); 357 jobUploadSemaphore.Release(); semaphoreReleased = true; // the semaphore has to be release before waitall! 358 try { 359 Task.WaitAll(tasks.ToArray()); 360 } 361 catch (AggregateException ae) { 362 if (!ae.InnerExceptions.All(e => e is TaskCanceledException)) throw ae; // for some reason the WaitAll throws a AggregateException containg a TaskCanceledException. i don't know where it comes from, however the tasks all finish properly, so for now just ignore it 363 } 340 364 } 341 365 finally { 342 jobUploadSemaphore.Release();366 if(!semaphoreReleased) jobUploadSemaphore.Release(); 343 367 } 344 368 } … … 441 465 } 442 466 } 467 468 public static HiveItemCollection<HiveExperimentPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) { 469 return ServiceLocator.Instance.CallHiveService((service) => { 470 IEnumerable<HiveExperimentPermission> heps = service.GetHiveExperimentPermissions(hiveExperimentId); 471 foreach (var hep in heps) { 472 hep.GrantedUserName = service.GetUsernameByUserId(hep.GrantedUserId); 473 } 474 return new HiveItemCollection<HiveExperimentPermission>(heps); 475 }); 476 } 443 477 } 444 478 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveExperimentPermission.cs
r6372 r6463 20 20 #endregion 21 21 22 using System.ComponentModel; 22 23 using HeuristicLab.Common; 23 24 24 25 namespace HeuristicLab.Clients.Hive { 25 26 26 public partial class HiveExperimentPermission : IDeepCloneable, IContent { 27 27 28 p ublic HiveExperimentPermission() { }29 30 protected HiveExperimentPermission(HiveExperimentPermission original, Cloner cloner) {31 cloner.RegisterClonedObject(original, this);28 private string grantedUserName; 29 public string GrantedUserName { 30 get { return grantedUserName; } 31 set { grantedUserName = value; OnPropertyChanged(new PropertyChangedEventArgs("GrantedUserName")); } 32 32 } 33 33 34 public object Clone() { 35 return Clone(new Cloner()); 34 #region Constructors and Cloning 35 public HiveExperimentPermission() { 36 this.Permission = Hive.Permission.ReadOnly; 37 this.PropertyChanged += new PropertyChangedEventHandler(HiveExperimentPermission_PropertyChanged); 36 38 } 37 39 38 public IDeepCloneable Clone(Cloner cloner) { 40 protected HiveExperimentPermission(HiveExperimentPermission original, Cloner cloner) 41 : base(original, cloner) { 42 this.GrantedByUserId = original.GrantedByUserId; 43 this.GrantedUserId = original.GrantedUserId; 44 this.HiveExperimentId = original.HiveExperimentId; 45 this.Permission = original.Permission; 46 } 47 public override IDeepCloneable Clone(Cloner cloner) { 39 48 return new HiveExperimentPermission(this, cloner); 49 } 50 #endregion 51 52 private void HiveExperimentPermission_PropertyChanged(object sender, PropertyChangedEventArgs e) { 53 OnToStringChanged(); 54 } 55 56 public override string ToString() { 57 return string.Format("{0}: {1}", GrantedUserName, Permission.ToString()); 40 58 } 41 59 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveServiceClient.cs
r6454 r6463 214 214 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.SlaveGroup))] 215 215 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.Plugin))] 216 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.HiveExperimentPermission))] 216 217 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.PluginData))] 217 218 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.Hive.LightweightJob))] … … 606 607 607 608 [System.Runtime.Serialization.OptionalFieldAttribute()] 609 private HeuristicLab.Clients.Hive.Permission PermissionField; 610 611 [System.Runtime.Serialization.OptionalFieldAttribute()] 608 612 private string ResourceNamesField; 609 613 … … 706 710 this.OwnerUserIdField = value; 707 711 this.RaisePropertyChanged("OwnerUserId"); 712 } 713 } 714 } 715 716 [System.Runtime.Serialization.DataMemberAttribute()] 717 public HeuristicLab.Clients.Hive.Permission Permission 718 { 719 get 720 { 721 return this.PermissionField; 722 } 723 set 724 { 725 if ((this.PermissionField.Equals(value) != true)) 726 { 727 this.PermissionField = value; 728 this.RaisePropertyChanged("Permission"); 708 729 } 709 730 } … … 1088 1109 [System.Diagnostics.DebuggerStepThroughAttribute()] 1089 1110 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 1111 [System.Runtime.Serialization.DataContractAttribute(Name="HiveExperimentPermission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.Common.DataTra" + 1112 "nsfer")] 1113 [System.SerializableAttribute()] 1114 public partial class HiveExperimentPermission : HeuristicLab.Clients.Hive.HiveItem 1115 { 1116 1117 [System.Runtime.Serialization.OptionalFieldAttribute()] 1118 private System.Guid GrantedByUserIdField; 1119 1120 [System.Runtime.Serialization.OptionalFieldAttribute()] 1121 private System.Guid GrantedUserIdField; 1122 1123 [System.Runtime.Serialization.OptionalFieldAttribute()] 1124 private System.Guid HiveExperimentIdField; 1125 1126 [System.Runtime.Serialization.OptionalFieldAttribute()] 1127 private HeuristicLab.Clients.Hive.Permission PermissionField; 1128 1129 [System.Runtime.Serialization.DataMemberAttribute()] 1130 public System.Guid GrantedByUserId 1131 { 1132 get 1133 { 1134 return this.GrantedByUserIdField; 1135 } 1136 set 1137 { 1138 if ((this.GrantedByUserIdField.Equals(value) != true)) 1139 { 1140 this.GrantedByUserIdField = value; 1141 this.RaisePropertyChanged("GrantedByUserId"); 1142 } 1143 } 1144 } 1145 1146 [System.Runtime.Serialization.DataMemberAttribute()] 1147 public System.Guid GrantedUserId 1148 { 1149 get 1150 { 1151 return this.GrantedUserIdField; 1152 } 1153 set 1154 { 1155 if ((this.GrantedUserIdField.Equals(value) != true)) 1156 { 1157 this.GrantedUserIdField = value; 1158 this.RaisePropertyChanged("GrantedUserId"); 1159 } 1160 } 1161 } 1162 1163 [System.Runtime.Serialization.DataMemberAttribute()] 1164 public System.Guid HiveExperimentId 1165 { 1166 get 1167 { 1168 return this.HiveExperimentIdField; 1169 } 1170 set 1171 { 1172 if ((this.HiveExperimentIdField.Equals(value) != true)) 1173 { 1174 this.HiveExperimentIdField = value; 1175 this.RaisePropertyChanged("HiveExperimentId"); 1176 } 1177 } 1178 } 1179 1180 [System.Runtime.Serialization.DataMemberAttribute()] 1181 public HeuristicLab.Clients.Hive.Permission Permission 1182 { 1183 get 1184 { 1185 return this.PermissionField; 1186 } 1187 set 1188 { 1189 if ((this.PermissionField.Equals(value) != true)) 1190 { 1191 this.PermissionField = value; 1192 this.RaisePropertyChanged("Permission"); 1193 } 1194 } 1195 } 1196 } 1197 1198 [System.Diagnostics.DebuggerStepThroughAttribute()] 1199 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 1090 1200 [System.Runtime.Serialization.DataContractAttribute(Name="PluginData", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.Common.DataTra" + 1091 1201 "nsfer")] … … 1330 1440 [System.Runtime.Serialization.EnumMemberAttribute()] 1331 1441 Failed = 7, 1442 } 1443 1444 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 1445 [System.Runtime.Serialization.DataContractAttribute(Name="Permission", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Hive.Common.DataTra" + 1446 "nsfer")] 1447 public enum Permission : int 1448 { 1449 1450 [System.Runtime.Serialization.EnumMemberAttribute()] 1451 NotAllowed = 0, 1452 1453 [System.Runtime.Serialization.EnumMemberAttribute()] 1454 ReadOnly = 1, 1455 1456 [System.Runtime.Serialization.EnumMemberAttribute()] 1457 Full = 2, 1332 1458 } 1333 1459 … … 1783 1909 { 1784 1910 1911 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteSlave", ReplyAction="http://tempuri.org/IHiveService/DeleteSlaveResponse")] 1912 void DeleteSlave(System.Guid slaveId); 1913 1914 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteSlaveGroup", ReplyAction="http://tempuri.org/IHiveService/DeleteSlaveGroupResponse")] 1915 void DeleteSlaveGroup(System.Guid slaveGroupId); 1916 1917 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddResourceToGroup", ReplyAction="http://tempuri.org/IHiveService/AddResourceToGroupResponse")] 1918 void AddResourceToGroup(System.Guid slaveGroupId, System.Guid resourceId); 1919 1785 1920 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/RemoveResourceFromGroup", ReplyAction="http://tempuri.org/IHiveService/RemoveResourceFromGroupResponse")] 1786 1921 void RemoveResourceFromGroup(System.Guid slaveGroupId, System.Guid resourceId); … … 1807 1942 System.Collections.Generic.List<HeuristicLab.Clients.Hive.Downtime> GetDowntimesForResource(System.Guid resourceId); 1808 1943 1944 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetUsernameByUserId", ReplyAction="http://tempuri.org/IHiveService/GetUsernameByUserIdResponse")] 1945 string GetUsernameByUserId(System.Guid userId); 1946 1947 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetUserIdByUsername", ReplyAction="http://tempuri.org/IHiveService/GetUserIdByUsernameResponse")] 1948 System.Guid GetUserIdByUsername(string username); 1949 1809 1950 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddJob", ReplyAction="http://tempuri.org/IHiveService/AddJobResponse")] 1810 1951 System.Guid AddJob(HeuristicLab.Clients.Hive.Job job, HeuristicLab.Clients.Hive.JobData jobData, System.Collections.Generic.List<System.Guid> resourceIds); … … 1872 2013 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteHiveExperiment", ReplyAction="http://tempuri.org/IHiveService/DeleteHiveExperimentResponse")] 1873 2014 void DeleteHiveExperiment(System.Guid hiveExperimentId); 2015 2016 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GrantPermission", ReplyAction="http://tempuri.org/IHiveService/GrantPermissionResponse")] 2017 void GrantPermission(System.Guid hiveExperimentId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission); 2018 2019 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/RevokePermission", ReplyAction="http://tempuri.org/IHiveService/RevokePermissionResponse")] 2020 void RevokePermission(System.Guid hiveExperimentId, System.Guid grantedUserId); 2021 2022 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/GetHiveExperimentPermissions", ReplyAction="http://tempuri.org/IHiveService/GetHiveExperimentPermissionsResponse")] 2023 System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperimentPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId); 1874 2024 1875 2025 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/Hello", ReplyAction="http://tempuri.org/IHiveService/HelloResponse")] … … 1924 2074 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/UpdateSlaveGroup", ReplyAction="http://tempuri.org/IHiveService/UpdateSlaveGroupResponse")] 1925 2075 void UpdateSlaveGroup(HeuristicLab.Clients.Hive.SlaveGroup slaveGroup); 1926 1927 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteSlave", ReplyAction="http://tempuri.org/IHiveService/DeleteSlaveResponse")]1928 void DeleteSlave(System.Guid slaveId);1929 1930 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/DeleteSlaveGroup", ReplyAction="http://tempuri.org/IHiveService/DeleteSlaveGroupResponse")]1931 void DeleteSlaveGroup(System.Guid slaveGroupId);1932 1933 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IHiveService/AddResourceToGroup", ReplyAction="http://tempuri.org/IHiveService/AddResourceToGroupResponse")]1934 void AddResourceToGroup(System.Guid slaveGroupId, System.Guid resourceId);1935 2076 } 1936 2077 … … 1969 2110 } 1970 2111 2112 public void DeleteSlave(System.Guid slaveId) 2113 { 2114 base.Channel.DeleteSlave(slaveId); 2115 } 2116 2117 public void DeleteSlaveGroup(System.Guid slaveGroupId) 2118 { 2119 base.Channel.DeleteSlaveGroup(slaveGroupId); 2120 } 2121 2122 public void AddResourceToGroup(System.Guid slaveGroupId, System.Guid resourceId) 2123 { 2124 base.Channel.AddResourceToGroup(slaveGroupId, resourceId); 2125 } 2126 1971 2127 public void RemoveResourceFromGroup(System.Guid slaveGroupId, System.Guid resourceId) 1972 2128 { … … 2009 2165 } 2010 2166 2167 public string GetUsernameByUserId(System.Guid userId) 2168 { 2169 return base.Channel.GetUsernameByUserId(userId); 2170 } 2171 2172 public System.Guid GetUserIdByUsername(string username) 2173 { 2174 return base.Channel.GetUserIdByUsername(username); 2175 } 2176 2011 2177 public System.Guid AddJob(HeuristicLab.Clients.Hive.Job job, HeuristicLab.Clients.Hive.JobData jobData, System.Collections.Generic.List<System.Guid> resourceIds) 2012 2178 { … … 2119 2285 } 2120 2286 2287 public void GrantPermission(System.Guid hiveExperimentId, System.Guid grantedUserId, HeuristicLab.Clients.Hive.Permission permission) 2288 { 2289 base.Channel.GrantPermission(hiveExperimentId, grantedUserId, permission); 2290 } 2291 2292 public void RevokePermission(System.Guid hiveExperimentId, System.Guid grantedUserId) 2293 { 2294 base.Channel.RevokePermission(hiveExperimentId, grantedUserId); 2295 } 2296 2297 public System.Collections.Generic.List<HeuristicLab.Clients.Hive.HiveExperimentPermission> GetHiveExperimentPermissions(System.Guid hiveExperimentId) 2298 { 2299 return base.Channel.GetHiveExperimentPermissions(hiveExperimentId); 2300 } 2301 2121 2302 public void Hello(HeuristicLab.Clients.Hive.Slave slave) 2122 2303 { … … 2203 2384 base.Channel.UpdateSlaveGroup(slaveGroup); 2204 2385 } 2205 2206 public void DeleteSlave(System.Guid slaveId)2207 {2208 base.Channel.DeleteSlave(slaveId);2209 }2210 2211 public void DeleteSlaveGroup(System.Guid slaveGroupId)2212 {2213 base.Channel.DeleteSlaveGroup(slaveGroupId);2214 }2215 2216 public void AddResourceToGroup(System.Guid slaveGroupId, System.Guid resourceId)2217 {2218 base.Channel.AddResourceToGroup(slaveGroupId, resourceId);2219 }2220 2386 } 2221 2387 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/HiveExperimentPermission.cs
r6372 r6463 26 26 [DataContract] 27 27 [Serializable] 28 public class HiveExperimentPermission { 28 public class HiveExperimentPermission : HiveItem { 29 // info: this class is derived from HiveItem to simplify handling on the client side, altough it does not have a Id. 29 30 [DataMember] 30 31 public Guid HiveExperimentId { get; set; } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/DataTransfer/Permission.cs
r6457 r6463 30 30 /// User can only download and view experiments 31 31 /// </summary> 32 ReadOnly, 33 34 /// <summary> 35 /// User can also experiments 36 /// </summary> 37 Write, 32 Read, 38 33 39 34 /// <summary> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Common/3.4/ServiceContracts/IHiveService.cs
r6457 r6463 111 111 112 112 #region HiveExperimentPermission Methods 113 [OperationContract] 113 114 void GrantPermission(Guid hiveExperimentId, Guid grantedUserId, Permission permission); 115 116 [OperationContract] 114 117 void RevokePermission(Guid hiveExperimentId, Guid grantedUserId); 118 119 [OperationContract] 120 IEnumerable<HiveExperimentPermission> GetHiveExperimentPermissions(Guid hiveExperimentId); 115 121 #endregion 116 122 … … 205 211 #endregion 206 212 213 #region User Methods 214 [OperationContract] 215 string GetUsernameByUserId(Guid userId); 216 217 [OperationContract] 218 Guid GetUserIdByUsername(string username); 219 #endregion 207 220 } 208 221 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/DaoTests.cs
r6452 r6463 235 235 perm.GrantedByUserId = he.OwnerUserId; 236 236 perm.GrantedUserId = Guid.NewGuid(); 237 perm.Permission = Permission. Write;237 perm.Permission = Permission.Full; 238 238 dao.AddHiveExperimentPermission(perm); 239 239 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/HeuristicLab.Services.Hive-3.4.Tests.csproj
r6369 r6463 72 72 <ItemGroup> 73 73 <Compile Include="Mocks\MockAuthenticationManager.cs" /> 74 <Compile Include="Mocks\MockUserManager.cs" /> 74 75 <Compile Include="ServiceTests.cs" /> 75 76 <Compile Include="Mocks\MockAuthorizationManager.cs" /> … … 108 109 <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> 109 110 <Reference Include="System" /> 111 <Reference Include="System.Configuration" /> 110 112 <Reference Include="System.Data" /> 111 113 <Reference Include="System.Data.DataSetExtensions" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockAuthorizationManager.cs
r6457 r6463 24 24 namespace HeuristicLab.Services.Hive.Tests.Mocks { 25 25 public class MockAuthorizationManager : IAuthorizationManager { 26 public static Guid MockUserId1 = new Guid("6C7911A1-46EA-4E51-97DF-5582653AAFCE"); 27 public static Guid MockUserId2 = new Guid("897660EB-C90F-4054-988C-D39D530A0A02"); 28 public static Guid MockUserId3 = new Guid("9F7B4EA8-A38D-4BC2-802F-E148AC7A6A87"); 29 30 private Guid userId = MockUserId1; 31 32 public Guid UserId { 33 get { return userId; } 26 public void Authorize(Guid userId) { 27 // ok. 34 28 } 35 29 36 public void Authorize Jobs(params Guid[] jobId) {37 // o .k.30 public void AuthorizeForJob(Guid jobId, Common.DataTransfer.Permission requiredPermission) { 31 // ok. 38 32 } 39 33 40 public void Authorize(Guid userId) { 41 // o.k. 42 } 43 44 internal void SetUserId(Guid id) { 45 this.userId = id; 34 public void AuthorizeForExperiment(Guid experimentId, Common.DataTransfer.Permission requiredPermission) { 35 // ok. 46 36 } 47 37 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs
r6457 r6463 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Services.Hive.DataAccess; 23 24 using HeuristicLab.Services.Hive.Tests.Mocks; 24 using System;25 25 26 26 namespace HeuristicLab.Services.Hive.Tests { … … 36 36 } 37 37 38 private MockAuthorizationManager mockAuthorizationManager = new MockAuthorizationManager();38 //private MockAuthorizationManager mockAuthorizationManager = new MockAuthorizationManager(); 39 39 public IAuthorizationManager AuthorizationManager { 40 get { return mockAuthorizationManager; }40 get { return defaultServiceLocator.AuthorizationManager; } 41 41 } 42 42 … … 51 51 get { return defaultServiceLocator.TransactionManager; } 52 52 } 53 53 private MockUserManager mockUserManager = new MockUserManager(); 54 public IUserManager UserManager { 55 get { return mockUserManager; } 56 } 54 57 public HeartbeatManager HeartbeatManager { 55 58 get { return defaultServiceLocator.HeartbeatManager; } … … 57 60 58 61 #region Special mocking methods 59 public void SetCurrentUser (Guid id) {60 mock AuthorizationManager.SetUserId(id);62 public void SetCurrentUserId(Guid userId) { 63 mockUserManager.SetUserId(userId); 61 64 } 62 63 65 #endregion 64 66 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/ServiceTests.cs
r6457 r6463 303 303 public void TestHiveExperimentPermissions() { 304 304 var service = GetLocalService(); 305 mockServiceLocator.SetCurrentUser (MockAuthorizationManager.MockUserId1);305 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId1); 306 306 307 307 // create hive experiment … … 311 311 var e1loaded = service.GetHiveExperiment(e1.Id); 312 312 Assert.AreEqual(Permission.Full, e1loaded.Permission); 313 313 var allExp = service.GetHiveExperiments(); 314 Assert.AreEqual(1, allExp.Count(x => x.Id == e1.Id)); 315 314 316 // change to user2 315 mockServiceLocator.SetCurrentUser(MockAuthorizationManager.MockUserId2); 316 e1loaded = service.GetHiveExperiment(e1.Id); 317 Assert.AreEqual(null, e1loaded); // no access 317 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 318 try { 319 e1loaded = service.GetHiveExperiment(e1.Id); 320 Assert.Fail("Access should not be possible"); 321 } catch { /* ok, cool */ } 322 allExp = service.GetHiveExperiments(); 323 Assert.AreEqual(0, allExp.Count(x => x.Id == e1.Id)); 318 324 319 325 // user2 should not be able to grant permissions 320 326 try { 321 service.GrantPermission(e1.Id, Mock AuthorizationManager.MockUserId2, Permission.ReadOnly);327 service.GrantPermission(e1.Id, MockUserManager.MockUserId2, Permission.Read); 322 328 Assert.Fail("Should not be possible to grant permission due to missing permission for User2"); 323 329 } … … 325 331 326 332 // switch back to user1 (owner) and grant user2 permissions 327 mockServiceLocator.SetCurrentUser (MockAuthorizationManager.MockUserId1);328 service.GrantPermission(e1.Id, Mock AuthorizationManager.MockUserId2, Permission.ReadOnly);333 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId1); 334 service.GrantPermission(e1.Id, MockUserManager.MockUserId2, Permission.Read); 329 335 330 336 // back to user2 331 mockServiceLocator.SetCurrentUser (MockAuthorizationManager.MockUserId2);337 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 332 338 e1loaded = service.GetHiveExperiment(e1.Id); 333 Assert.AreEqual(Permission.ReadOnly, e1loaded.Permission); 339 Assert.AreEqual(Permission.Read, e1loaded.Permission); 340 allExp = service.GetHiveExperiments(); 341 Assert.AreEqual(1, allExp.Count(x => x.Id == e1.Id)); 334 342 335 343 // user2 should still not be able to grant permissions 336 344 try { 337 service.GrantPermission(e1.Id, Mock AuthorizationManager.MockUserId2, Permission.ReadOnly);345 service.GrantPermission(e1.Id, MockUserManager.MockUserId2, Permission.Read); 338 346 Assert.Fail("Should not be possible to grant permission due to missing permission for User2"); 339 347 } … … 341 349 342 350 // back to user1 343 mockServiceLocator.SetCurrentUser (MockAuthorizationManager.MockUserId1);344 service.GrantPermission(e1.Id, Mock AuthorizationManager.MockUserId2, Permission.Full);351 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId1); 352 service.GrantPermission(e1.Id, MockUserManager.MockUserId2, Permission.Full); 345 353 346 354 // back to user2 347 mockServiceLocator.SetCurrentUser (MockAuthorizationManager.MockUserId2);355 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 348 356 e1loaded = service.GetHiveExperiment(e1.Id); 349 357 Assert.AreEqual(Permission.Full, e1loaded.Permission); 350 358 allExp = service.GetHiveExperiments(); 359 Assert.AreEqual(1, allExp.Count(x => x.Id == e1.Id)); 360 351 361 // grant rights to user3, now this should be possible due to full permissions 352 service.GrantPermission(e1.Id, Mock AuthorizationManager.MockUserId3, Permission.ReadOnly);362 service.GrantPermission(e1.Id, MockUserManager.MockUserId3, Permission.Read); 353 363 354 364 // back to user1 and revoke rights for user2 355 mockServiceLocator.SetCurrentUser (MockAuthorizationManager.MockUserId1);356 service.RevokePermission(e1.Id, Mock AuthorizationManager.MockUserId2);365 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId1); 366 service.RevokePermission(e1.Id, MockUserManager.MockUserId2); 357 367 358 368 // back to user2 359 mockServiceLocator.SetCurrentUser(MockAuthorizationManager.MockUserId2); 360 e1loaded = service.GetHiveExperiment(e1.Id); 361 Assert.AreEqual(null, e1loaded); // no access 362 369 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId2); 370 try { 371 e1loaded = service.GetHiveExperiment(e1.Id); 372 Assert.Fail("Access should not be possible"); 373 } 374 catch { /* ok, cool */ } 375 allExp = service.GetHiveExperiments(); 376 Assert.AreEqual(0, allExp.Count(x => x.Id == e1.Id)); 377 378 // back to user1 379 mockServiceLocator.SetCurrentUserId(MockUserManager.MockUserId1); 363 380 service.DeleteHiveExperiment(e1.Id); 364 381 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Web/Hive-3.4/Web.config
r6458 r6463 1 1 <?xml version="1.0"?> 2 2 <configuration> 3 <configSections> 4 <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 5 <section name="HeuristicLab.Services.Hive.DataAccess.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 6 <section name="HeuristicLab.Services.Hive.Common.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 7 </sectionGroup> 8 </configSections> 9 <appSettings> 10 <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" /> 11 </appSettings> 12 <applicationSettings> 13 <HeuristicLab.Services.Hive.DataAccess.Settings> 14 <!-- Timeout for long running database command (storing or loading jobData) --> 15 <setting name="LongRunningDatabaseCommandTimeout" serializeAs="String"> 16 <value>00:05:33</value> 17 </setting> 18 </HeuristicLab.Services.Hive.DataAccess.Settings> 19 <HeuristicLab.Services.Hive.Common.Settings> 20 <!-- If a slave does not send a heartbeat for this time, it is set offline which means all of its jobs are rescheduled --> 21 <setting name="SlaveHeartbeatTimeout" serializeAs="String"> 22 <value>00:01:00</value> 23 </setting> 24 <!-- When a job is in state `Calculating` this is the maximum time it does not have to send heartbeats, otherwise its rescheduled --> 25 <setting name="CalculatingJobHeartbeatTimeout" serializeAs="String"> 26 <value>00:05:30</value> 27 </setting> 28 <!-- When a job is in state `Transferring` this is the maximum time it does not have to send heartbeats, otherwise its rescheduled --> 29 <setting name="TransferringJobHeartbeatTimeout" serializeAs="String"> 30 <value>00:05:30</value> 31 </setting> 32 </HeuristicLab.Services.Hive.Common.Settings> 33 </applicationSettings> 34 <connectionStrings> 35 <add name="HeuristicLab.Authentication" connectionString="data source=localhost;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication"/> 36 </connectionStrings> 37 <system.web> 38 <httpHandlers> 39 <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 40 validate="false" /> 41 </httpHandlers> 42 <compilation debug="true" targetFramework="4.0"> 43 <assemblies> 44 <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></assemblies></compilation> 45 <membership> 46 <providers> 47 <clear/> 48 <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="HeuristicLab.Authentication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="HeuristicLab.Authentication"/> 49 </providers> 50 </membership> 51 <roleManager enabled="true"> 52 <providers> 53 <clear/> 54 <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication"/> 55 </providers> 56 </roleManager> 57 <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"> 58 <controls> 59 <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" 60 assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 61 </controls> 62 </pages> 63 <httpRuntime maxRequestLength="1048576"/> 64 </system.web> 65 <system.serviceModel> 66 <diagnostics> 67 <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000"/> 68 </diagnostics> 69 <bindings> 70 <wsHttpBinding> 71 <binding name="WSHttpBinding_IHiveService" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 72 <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"/> 73 <security mode="Message"> 74 <transport clientCredentialType="Certificate"/> 75 <message clientCredentialType="UserName"/> 76 </security> 77 </binding> 78 </wsHttpBinding> 79 </bindings> 80 <behaviors> 81 <serviceBehaviors> 82 <behavior name="ServiceBehaviour_IHiveService"> 83 <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 84 <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/> 85 <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 86 <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/> 87 <serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="AspNetSqlRoleProvider"/> 88 <serviceCredentials> 89 <serviceCertificate findValue="localhost" x509FindType="FindBySubjectName"/> 90 <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="AspNetSqlMembershipProvider"/> 91 </serviceCredentials> 92 <serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="false" messageAuthenticationAuditLevel="SuccessOrFailure"/> 93 <serviceThrottling maxConcurrentCalls="100"/> 94 <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 95 </behavior> 96 </serviceBehaviors> 97 </behaviors> 98 <services> 99 <service behaviorConfiguration="ServiceBehaviour_IHiveService" name="HeuristicLab.Services.Hive.HiveService"> 100 <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" name="MexEndpoint" contract="IMetadataExchange"/> 101 <endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService" name="WSHttpBinding_IHiveService" contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService"/> 102 </service> 103 </services> 104 <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> 105 </system.serviceModel> 106 <system.webServer> 107 <directoryBrowse enabled="true" /> 108 <handlers> 109 <remove name="ChartImageHandler" /> 110 <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" 111 path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 112 </handlers> 113 </system.webServer> 3 <configSections> 4 <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 5 <section name="HeuristicLab.Services.Hive.DataAccess.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 6 <section name="HeuristicLab.Services.Hive.Common.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/> 7 </sectionGroup> 8 </configSections> 9 <appSettings> 10 <add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" /> 11 </appSettings> 12 <applicationSettings> 13 <HeuristicLab.Services.Hive.DataAccess.Settings> 14 <!-- Timeout for long running database command (storing or loading jobData) --> 15 <setting name="LongRunningDatabaseCommandTimeout" serializeAs="String"> 16 <value>00:05:33</value> 17 </setting> 18 </HeuristicLab.Services.Hive.DataAccess.Settings> 19 <HeuristicLab.Services.Hive.Common.Settings> 20 <!-- If a slave does not send a heartbeat for this time, it is set offline which means all of its jobs are rescheduled --> 21 <setting name="SlaveHeartbeatTimeout" serializeAs="String"> 22 <value>00:01:00</value> 23 </setting> 24 <!-- When a job is in state `Calculating` this is the maximum time it does not have to send heartbeats, otherwise its rescheduled --> 25 <setting name="CalculatingJobHeartbeatTimeout" serializeAs="String"> 26 <value>00:05:30</value> 27 </setting> 28 <!-- When a job is in state `Transferring` this is the maximum time it does not have to send heartbeats, otherwise its rescheduled --> 29 <setting name="TransferringJobHeartbeatTimeout" serializeAs="String"> 30 <value>00:05:30</value> 31 </setting> 32 </HeuristicLab.Services.Hive.Common.Settings> 33 </applicationSettings> 34 <connectionStrings> 35 <add name="HeuristicLab.Authentication" connectionString="data source=localhost;Integrated Security=SSPI;Initial Catalog=HeuristicLab.Authentication"/> 36 </connectionStrings> 37 <system.web> 38 <compilation debug="true" targetFramework="4.0"> 39 <assemblies> 40 <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 41 </assemblies> 42 </compilation> 43 <membership> 44 <providers> 45 <clear/> 46 <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="HeuristicLab.Authentication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="HeuristicLab.Authentication"/> 47 </providers> 48 </membership> 49 <roleManager enabled="true"> 50 <providers> 51 <clear/> 52 <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="HeuristicLab.Authentication" applicationName="HeuristicLab.Authentication"/> 53 </providers> 54 </roleManager> 55 <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"> 56 <controls> 57 <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" 58 assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 59 </controls> 60 </pages> 61 <httpRuntime maxRequestLength="1048576"/> 62 </system.web> 63 <system.serviceModel> 64 <diagnostics> 65 <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="3000"/> 66 </diagnostics> 67 <bindings> 68 <wsHttpBinding> 69 <binding name="WSHttpBinding_IHiveService" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> 70 <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"/> 71 <security mode="Message"> 72 <transport clientCredentialType="Certificate"/> 73 <message clientCredentialType="UserName"/> 74 </security> 75 </binding> 76 </wsHttpBinding> 77 </bindings> 78 <behaviors> 79 <serviceBehaviors> 80 <behavior name="ServiceBehaviour_IHiveService"> 81 <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 82 <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/> 83 <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 84 <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/> 85 <serviceAuthorization principalPermissionMode="UseAspNetRoles" roleProviderName="AspNetSqlRoleProvider"/> 86 <serviceCredentials> 87 <serviceCertificate findValue="localhost" x509FindType="FindBySubjectName"/> 88 <userNameAuthentication userNamePasswordValidationMode="MembershipProvider" membershipProviderName="AspNetSqlMembershipProvider"/> 89 </serviceCredentials> 90 <serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="false" messageAuthenticationAuditLevel="SuccessOrFailure"/> 91 <serviceThrottling maxConcurrentCalls="100"/> 92 <dataContractSerializer maxItemsInObjectGraph="2147483647"/> 93 </behavior> 94 </serviceBehaviors> 95 </behaviors> 96 <services> 97 <service behaviorConfiguration="ServiceBehaviour_IHiveService" name="HeuristicLab.Services.Hive.HiveService"> 98 <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" name="MexEndpoint" contract="IMetadataExchange"/> 99 <endpoint binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IHiveService" name="WSHttpBinding_IHiveService" contract="HeuristicLab.Services.Hive.Common.ServiceContracts.IHiveService"/> 100 </service> 101 </services> 102 <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> 103 </system.serviceModel> 104 <system.webServer> 105 <directoryBrowse enabled="true" /> 106 <handlers> 107 <remove name="ChartImageHandler" /> 108 <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" 109 path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 110 </handlers> 111 </system.webServer> 114 112 </configuration> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLab.Services.Hive-3.4.csproj
r6369 r6463 103 103 </ItemGroup> 104 104 <ItemGroup> 105 <Compile Include="Interfaces\IUserManager.cs" /> 106 <Compile Include="Manager\UserManager.cs" /> 105 107 <None Include="HeuristicLabServicesHivePlugin.cs.frame" /> 106 108 <None Include="Properties\AssemblyInfo.cs.frame" /> 107 <Compile Include=" AuthenticationManager.cs" />108 <Compile Include=" HeartbeatManager.cs" />109 <Compile Include="Manager\AuthenticationManager.cs" /> 110 <Compile Include="Manager\HeartbeatManager.cs" /> 109 111 <Compile Include="Interfaces\IAuthenticationManager.cs" /> 110 112 <Compile Include="Interfaces\ILifecycleManager.cs" /> 111 113 <Compile Include="Interfaces\IServiceLocator.cs" /> 112 <Compile Include=" AuthorizationManager.cs" />114 <Compile Include="Manager\AuthorizationManager.cs" /> 113 115 <Compile Include="HeuristicLabServicesHivePlugin.cs" /> 114 <Compile Include=" LifecycleManager.cs" />116 <Compile Include="Manager\LifecycleManager.cs" /> 115 117 <Compile Include="HiveRoles.cs" /> 116 118 <Compile Include="HiveService.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r6457 r6463 51 51 get { return ServiceLocator.Instance.LifecycleManager; } 52 52 } 53 private IUserManager userManager { 54 get { return ServiceLocator.Instance.UserManager; } 55 } 53 56 private HeartbeatManager heartbeatManager { 54 57 get { return ServiceLocator.Instance.HeartbeatManager; } … … 66 69 } 67 70 dao.AddJobData(jobData); 68 dao.UpdateJobState(job.Id, JobState.Waiting, null, author.UserId, null);71 dao.UpdateJobState(job.Id, JobState.Waiting, null, userManager.CurrentUserId, null); 69 72 return jobData.JobId; 70 73 }, false, true); … … 81 84 public Job GetJob(Guid jobId) { 82 85 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 86 author.AuthorizeForJob(jobId, Permission.Read); 83 87 return dao.GetJob(jobId); 84 88 } … … 86 90 public IEnumerable<Job> GetJobs() { 87 91 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 88 return dao.GetJobs(x => true); 92 var jobs = dao.GetJobs(x => true); 93 foreach (var job in jobs) 94 author.AuthorizeForJob(job.Id, Permission.Read); 95 return jobs; 89 96 } 90 97 91 98 public IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds) { 92 99 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 93 return dao.GetJobs(x => jobIds.Contains(x.JobId)).Select(x => new LightweightJob(x)).ToArray(); 100 var jobs = dao.GetJobs(x => jobIds.Contains(x.JobId)).Select(x => new LightweightJob(x)).ToArray(); 101 foreach (var job in jobs) 102 author.AuthorizeForJob(job.Id, Permission.Read); 103 return jobs; 94 104 } 95 105 96 106 public IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { 97 107 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 98 return GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightJob(x)).ToArray(); 108 var jobs = GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightJob(x)).ToArray(); 109 foreach (var job in jobs) 110 author.AuthorizeForJob(job.Id, Permission.Read); 111 return jobs; 99 112 } 100 113 101 114 public IEnumerable<LightweightJob> GetLightweightExperimentJobs(Guid experimentId) { 102 115 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 116 author.AuthorizeForExperiment(experimentId, Permission.Read); 103 117 return dao.GetJobs(x => x.HiveExperimentId == experimentId).Select(x => new LightweightJob(x)).ToArray(); 104 118 } … … 106 120 public JobData GetJobData(Guid jobId) { 107 121 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 122 author.AuthorizeForJob(jobId, Permission.Read); 108 123 return dao.GetJobData(jobId); 109 124 } … … 111 126 public void UpdateJob(Job job) { 112 127 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 128 author.AuthorizeForJob(job.Id, Permission.Full); 113 129 trans.UseTransaction(() => { 114 130 dao.UpdateJob(job); … … 118 134 public void UpdateJobData(Job job, JobData jobData) { 119 135 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 136 author.AuthorizeForJob(job.Id, Permission.Full); 137 author.AuthorizeForJob(jobData.JobId, Permission.Full); 120 138 //trans.UseTransaction(() => { // cneumuel: try without transaction 121 139 jobData.LastUpdate = DateTime.Now; … … 127 145 public void DeleteJob(Guid jobId) { 128 146 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 147 author.AuthorizeForJob(jobId, Permission.Full); 129 148 trans.UseTransaction(() => { 130 149 dao.DeleteJob(jobId); … … 134 153 public void DeleteChildJobs(Guid parentJobId) { 135 154 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 155 author.AuthorizeForJob(parentJobId, Permission.Full); 136 156 trans.UseTransaction(() => { 137 157 var jobs = GetChildJobs(parentJobId, true, false); … … 145 165 public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) { 146 166 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 167 author.AuthorizeForJob(jobId, Permission.Full); 147 168 return trans.UseTransaction(() => { 148 169 Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception); … … 166 187 public IEnumerable<Job> GetJobsByResourceId(Guid resourceId) { 167 188 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 168 return trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId)); 189 var jobs = trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId)); 190 foreach(var job in jobs) 191 author.AuthorizeForJob(job.Id, Permission.Read); 192 return jobs; 169 193 } 170 194 #endregion … … 173 197 public void StopJob(Guid jobId) { 174 198 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 199 author.AuthorizeForJob(jobId, Permission.Full); 175 200 trans.UseTransaction(() => { 176 201 var job = dao.GetJob(jobId); … … 188 213 public void PauseJob(Guid jobId) { 189 214 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 215 author.AuthorizeForJob(jobId, Permission.Full); 190 216 trans.UseTransaction(() => { 191 217 var job = dao.GetJob(jobId); … … 201 227 public void RestartJob(Guid jobId) { 202 228 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 203 trans.UseTransaction(() => { 204 Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, author.UserId, string.Empty); 229 author.AuthorizeForJob(jobId, Permission.Full); 230 trans.UseTransaction(() => { 231 Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, userManager.CurrentUserId, string.Empty); 205 232 job.Command = null; 206 233 dao.UpdateJob(job); … … 212 239 public HiveExperiment GetHiveExperiment(Guid id) { 213 240 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 241 author.AuthorizeForExperiment(id, Permission.Read); 214 242 var hiveExperiment = dao.GetHiveExperiments(x => 215 243 x.HiveExperimentId == id 216 && (x.OwnerUserId == author.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == author.UserId) > 0)244 && (x.OwnerUserId == userManager.CurrentUserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0) 217 245 ).FirstOrDefault(); 218 if (hiveExperiment != null) hiveExperiment.Permission = dao.GetPermissionForExperiment(hiveExperiment.Id, author.UserId);246 if (hiveExperiment != null) hiveExperiment.Permission = dao.GetPermissionForExperiment(hiveExperiment.Id, userManager.CurrentUserId); 219 247 return hiveExperiment; 220 248 } … … 222 250 public IEnumerable<HiveExperiment> GetHiveExperiments() { 223 251 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 224 var hiveExperiments = dao.GetHiveExperiments(x => x.OwnerUserId == author.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == author.UserId) > 0); 225 foreach (var he in hiveExperiments) 226 he.Permission = dao.GetPermissionForExperiment(he.Id, author.UserId); 252 var hiveExperiments = dao.GetHiveExperiments(x => x.OwnerUserId == userManager.CurrentUserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == userManager.CurrentUserId) > 0); 253 foreach (var he in hiveExperiments) { 254 author.AuthorizeForExperiment(he.Id, Permission.Read); 255 he.Permission = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId); 256 } 227 257 return hiveExperiments; 228 258 } … … 231 261 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 232 262 var hiveExperiments = dao.GetHiveExperiments(x => true); 233 foreach (var he in hiveExperiments) 234 he.Permission = dao.GetPermissionForExperiment(he.Id, author.UserId);263 foreach (var he in hiveExperiments) // no authorization here, since this method is admin-only! (admin is allowed to read all jobs) 264 he.Permission = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId); 235 265 return hiveExperiments; 236 266 } … … 239 269 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 240 270 return trans.UseTransaction(() => { 241 hiveExperimentDto.OwnerUserId = author.UserId;271 hiveExperimentDto.OwnerUserId = userManager.CurrentUserId; 242 272 hiveExperimentDto.DateCreated = DateTime.Now; 243 273 return dao.AddHiveExperiment(hiveExperimentDto); … … 247 277 public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) { 248 278 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 279 author.AuthorizeForExperiment(hiveExperimentDto.Id, Permission.Full); 249 280 trans.UseTransaction(() => { 250 281 dao.UpdateHiveExperiment(hiveExperimentDto); … … 254 285 public void DeleteHiveExperiment(Guid hiveExperimentId) { 255 286 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 287 author.AuthorizeForExperiment(hiveExperimentId, Permission.Full); 256 288 trans.UseTransaction(() => { 257 289 HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId); … … 267 299 HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId); 268 300 if (he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId)); 269 Permission perm = dao.GetPermissionForExperiment(he.Id, author.UserId);301 Permission perm = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId); 270 302 if (perm != Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to grant permissions for this experiment")); 271 dao.SetHiveExperimentPermission(hiveExperimentId, author.UserId, grantedUserId, permission);303 dao.SetHiveExperimentPermission(hiveExperimentId, userManager.CurrentUserId, grantedUserId, permission); 272 304 }); 273 305 } … … 278 310 HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId); 279 311 if (he == null) throw new FaultException<FaultReason>(new FaultReason("Could not find hiveExperiment with id " + hiveExperimentId)); 280 Permission perm = dao.GetPermissionForExperiment(he.Id, author.UserId);312 Permission perm = dao.GetPermissionForExperiment(he.Id, userManager.CurrentUserId); 281 313 if (perm != Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to grant permissions for this experiment")); 282 dao.SetHiveExperimentPermission(hiveExperimentId, author.UserId, grantedUserId, Permission.NotAllowed); 314 dao.SetHiveExperimentPermission(hiveExperimentId, userManager.CurrentUserId, grantedUserId, Permission.NotAllowed); 315 }); 316 } 317 public IEnumerable<HiveExperimentPermission> GetHiveExperimentPermissions(Guid hiveExperimentId) { 318 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 319 return trans.UseTransaction(() => { 320 Permission currentUserPermission = dao.GetPermissionForExperiment(hiveExperimentId, userManager.CurrentUserId); 321 if (currentUserPermission != Permission.Full) throw new FaultException<FaultReason>(new FaultReason("Not allowed to list permissions for this experiment")); 322 return dao.GetHiveExperimentPermissions(x => x.HiveExperimentId == hiveExperimentId); 283 323 }); 284 324 } … … 341 381 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 342 382 return trans.UseTransaction(() => { 343 plugin.UserId = author.UserId;383 plugin.UserId = userManager.CurrentUserId; 344 384 plugin.DateCreated = DateTime.Now; 345 385 … … 369 409 } 370 410 411 // note: this is a possible security problem, since a client is able to download all plugins, which may contain proprietary code (which can be disassembled) 412 // change so that only with GetPluginByHash it is possible to download plugins 371 413 public IEnumerable<Plugin> GetPlugins() { 372 414 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); … … 376 418 public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) { 377 419 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 378 List<PluginData> pluginDatas = new List<PluginData>(); 379 420 var pluginDatas = new List<PluginData>(); 380 421 return trans.UseTransaction(() => { 381 422 foreach (Guid guid in pluginIds) { … … 394 435 #region Slave Methods 395 436 public Guid AddSlave(Slave slave) { 396 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);437 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 397 438 return trans.UseTransaction(() => dao.AddSlave(slave)); 398 439 } 399 440 400 441 public Guid AddSlaveGroup(SlaveGroup slaveGroup) { 401 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);442 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 402 443 return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup)); 403 444 } 404 445 405 446 public Slave GetSlave(Guid slaveId) { 406 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);447 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 407 448 return dao.GetSlave(slaveId); 408 449 } 409 450 410 451 public SlaveGroup GetSlaveGroup(Guid slaveGroupId) { 411 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);452 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 412 453 return dao.GetSlaveGroup(slaveGroupId); 413 454 } 414 455 415 456 public IEnumerable<Slave> GetSlaves() { 416 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);457 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 417 458 return dao.GetSlaves(x => true); 418 459 } 419 460 420 461 public IEnumerable<SlaveGroup> GetSlaveGroups() { 421 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);462 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 422 463 return dao.GetSlaveGroups(x => true); 423 464 } 424 465 425 466 public void UpdateSlave(Slave slave) { 426 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);467 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 427 468 trans.UseTransaction(() => { 428 469 dao.UpdateSlave(slave); … … 431 472 432 473 public void UpdateSlaveGroup(SlaveGroup slaveGroup) { 433 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);474 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 434 475 trans.UseTransaction(() => { 435 476 dao.UpdateSlaveGroup(slaveGroup); … … 438 479 439 480 public void DeleteSlave(Guid slaveId) { 440 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);481 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 441 482 trans.UseTransaction(() => { 442 483 dao.DeleteSlave(slaveId); … … 445 486 446 487 public void DeleteSlaveGroup(Guid slaveGroupId) { 447 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);488 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 448 489 trans.UseTransaction(() => { 449 490 dao.DeleteSlaveGroup(slaveGroupId); … … 452 493 453 494 public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) { 454 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);495 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 455 496 trans.UseTransaction(() => { 456 497 var resource = dao.GetResource(resourceId); … … 461 502 462 503 public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) { 463 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);504 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 464 505 trans.UseTransaction(() => { 465 506 var resource = dao.GetResource(resourceId); … … 470 511 471 512 public Guid GetResourceId(string resourceName) { 472 authen.AuthenticateForAnyRole(HiveRoles.Administrator , HiveRoles.Client);513 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 473 514 return trans.UseTransaction(() => { 474 515 var resource = dao.GetResources(x => x.Name == resourceName).FirstOrDefault(); … … 482 523 483 524 public void TriggerLifecycle(bool force) { 525 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Slave); 484 526 // use a serializable transaction here to ensure not two threads execute this simultaniously (mutex-lock would not work since IIS may use multiple AppDomains) 485 527 trans.UseTransaction(() => { … … 519 561 #endregion 520 562 563 #region User Methods 564 public string GetUsernameByUserId(Guid userId) { 565 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 566 var user = ServiceLocator.Instance.UserManager.GetUserById(userId); 567 if (user != null) 568 return user.UserName; 569 else 570 return null; 571 } 572 573 public Guid GetUserIdByUsername(string username) { 574 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 575 var user = ServiceLocator.Instance.UserManager.GetUserByName(username); 576 return user != null ? (Guid)user.ProviderUserKey : Guid.Empty; 577 } 578 #endregion 579 521 580 #region Helper Methods 522 581 private IEnumerable<Job> GetChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IAuthorizationManager.cs
r6372 r6463 21 21 22 22 using System; 23 using HeuristicLab.Services.Hive.Common.DataTransfer; 23 24 namespace HeuristicLab.Services.Hive { 24 25 public interface IAuthorizationManager { 25 /// <summary>26 /// Returns the UserId of the currently authenticated user27 /// </summary>28 Guid UserId { get; }29 30 26 /// <summary> 31 27 /// Compares the current UserId with the given userId and takes appropriate actions if the mismatch 32 28 /// </summary> 33 29 void Authorize(Guid userId); 30 31 void AuthorizeForJob(Guid jobId, Permission requiredPermission); 32 33 void AuthorizeForExperiment(Guid experimentId, Permission requiredPermission); 34 34 } 35 35 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs
r6452 r6463 29 29 ILifecycleManager LifecycleManager { get; } 30 30 ITransactionManager TransactionManager { get; } 31 IUserManager UserManager { get; } 31 32 HeartbeatManager HeartbeatManager { get; } 32 33 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/ServiceLocator.cs
r6452 r6463 74 74 } 75 75 76 private IUserManager userManager; 77 public IUserManager UserManager { 78 get { 79 if (userManager == null) userManager = new UserManager(); 80 return userManager; 81 } 82 } 83 76 84 private HeartbeatManager heartbeatManager; 77 85 public HeartbeatManager HeartbeatManager {
Note: See TracChangeset
for help on using the changeset viewer.