- Timestamp:
- 06/06/11 10:31:53 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave/3.4/Tests/HeuristicLab.Clients.Hive.Slave-3.4.Tests.csproj
r6361 r6362 361 361 </ItemGroup> 362 362 <ItemGroup> 363 <ProjectReference Include="..\ HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4\HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4.csproj">363 <ProjectReference Include="..\..\..\HeuristicLab.Clients.Hive.Slave.ConsoleClient\HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4.csproj"> 364 364 <Project>{464D70B8-2D91-485C-B622-22E4A4891C68}</Project> 365 365 <Name>HeuristicLab.Clients.Hive.Slave.ConsoleClient-3.4</Name> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Tests/HeuristicLab.HiveEngine-3.4.Tests.csproj
r6361 r6362 138 138 <None Include="app_services.config" /> 139 139 <None Include="app.config" /> 140 <None Include="Meta-GA - Meta Optimization Problem %28Genetic Programming - Symbolic Regression 3.4 scaled%29_small.hl">141 <CopyToOutputDirectory>Always</CopyToOutputDirectory>142 </None>143 140 </ItemGroup> 144 141 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/HeuristicLab.Services.Hive-3.4.Tests.csproj
r6357 r6362 71 71 </ItemGroup> 72 72 <ItemGroup> 73 <Compile Include="Mocks\MockAuthenticationManager.cs" /> 73 74 <Compile Include="ServiceTests.cs" /> 74 75 <Compile Include="Mocks\MockAuthorizationManager.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive.Tests/Mocks/MockServiceLocator.cs
r5405 r6362 30 30 this.defaultServiceLocator = defaultServiceLocator; 31 31 } 32 33 public IAuthenticationManager AuthenticationManager { 34 get { return new MockAuthenticationManager(); } 35 } 32 36 33 37 public IAuthorizationManager AuthorizationManager { … … 54 58 } 55 59 } 60 56 61 } 57 62 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HeuristicLab.Services.Hive-3.4.csproj
r5852 r6362 108 108 <None Include="HeuristicLabServicesHivePlugin.cs.frame" /> 109 109 <None Include="Properties\AssemblyInfo.cs.frame" /> 110 <Compile Include="AuthenticationManager.cs" /> 110 111 <Compile Include="HeartbeatManager.cs" /> 112 <Compile Include="Interfaces\IAuthenticationManager.cs" /> 111 113 <Compile Include="Interfaces\ILifecycleManager.cs" /> 112 114 <Compile Include="Interfaces\IServiceLocator.cs" /> -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/HiveService.cs
r6267 r6362 21 21 get { return ServiceLocator.Instance.TransactionManager; } 22 22 } 23 private IAuthorizationManager auth { 23 private IAuthenticationManager authen { 24 get { return ServiceLocator.Instance.AuthenticationManager; } 25 } 26 private IAuthorizationManager author { 24 27 get { return ServiceLocator.Instance.AuthorizationManager; } 25 28 } … … 32 35 33 36 #region Job Methods 34 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]35 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]36 37 public Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds) { 38 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 37 39 return trans.UseTransaction(() => { 38 40 job.Id = dao.AddJob(job); … … 47 49 } 48 50 dao.AddJobData(jobData); 49 dao.UpdateJobState(job.Id, JobState.Waiting, null, auth .UserId, null);51 dao.UpdateJobState(job.Id, JobState.Waiting, null, author.UserId, null); 50 52 return jobData.JobId; 51 53 }); 52 54 } 53 55 54 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]55 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]56 56 public Guid AddChildJob(Guid parentJobId, Job job, JobData jobData) { 57 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 57 58 return trans.UseTransaction(() => { 58 59 job.ParentJobId = parentJobId; … … 61 62 } 62 63 63 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]64 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]65 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]66 64 public Job GetJob(Guid jobId) { 65 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 67 66 return dao.GetJob(jobId); 68 67 } 69 68 70 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]71 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]72 69 public IEnumerable<Job> GetJobs() { 70 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 73 71 return dao.GetJobs(x => true); 74 72 } 75 73 76 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]77 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]78 74 public IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds) { 75 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 79 76 return dao.GetJobs(x => jobIds.Contains(x.JobId)).Select(x => new LightweightJob(x)).ToArray(); 80 77 } 81 78 82 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]83 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]84 79 public IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent) { 80 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 85 81 return GetChildJobs(parentJobId, recursive, includeParent).Select(x => new LightweightJob(x)).ToArray(); 86 82 } 87 83 88 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]89 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]90 84 public IEnumerable<LightweightJob> GetLightweightExperimentJobs(Guid experimentId) { 85 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 91 86 return dao.GetJobs(x => x.HiveExperimentId == experimentId).Select(x => new LightweightJob(x)).ToArray(); 92 87 } 93 88 94 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]95 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]96 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]97 89 public JobData GetJobData(Guid jobId) { 90 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 98 91 return dao.GetJobData(jobId); 99 92 } 100 93 101 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]102 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]103 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]104 94 public void UpdateJob(Job job) { 95 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 105 96 trans.UseTransaction(() => { 106 97 dao.UpdateJob(job); … … 108 99 } 109 100 110 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]111 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]112 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]113 101 public void UpdateJobData(Job job, JobData jobData) { 102 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 114 103 trans.UseTransaction(() => { 115 104 jobData.LastUpdate = DateTime.Now; … … 119 108 } 120 109 121 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]122 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]123 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]124 110 public void DeleteJob(Guid jobId) { 111 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 125 112 trans.UseTransaction(() => { 126 113 dao.DeleteJob(jobId); … … 128 115 } 129 116 130 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]131 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]132 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]133 117 public void DeleteChildJobs(Guid parentJobId) { 118 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 134 119 trans.UseTransaction(() => { 135 120 var jobs = GetChildJobs(parentJobId, true, false); … … 141 126 } 142 127 143 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]144 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]145 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]146 128 public Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception) { 129 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 147 130 return trans.UseTransaction(() => { 148 131 Job job = dao.UpdateJobState(jobId, jobState, slaveId, userId, exception); … … 166 149 167 150 #region Job Control Methods 168 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]169 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]170 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]171 151 public void StopJob(Guid jobId) { 152 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 172 153 trans.UseTransaction(() => { 173 154 var job = dao.GetJob(jobId); … … 183 164 } 184 165 185 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]186 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]187 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]188 166 public void PauseJob(Guid jobId) { 167 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 189 168 trans.UseTransaction(() => { 190 169 var job = dao.GetJob(jobId); … … 198 177 } 199 178 200 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]201 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]202 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]203 179 public void RestartJob(Guid jobId) { 204 trans.UseTransaction(() => { 205 Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, auth.UserId, string.Empty); 180 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 181 trans.UseTransaction(() => { 182 Job job = dao.UpdateJobState(jobId, JobState.Waiting, null, author.UserId, string.Empty); 206 183 job.Command = null; 207 184 dao.UpdateJob(job); … … 211 188 212 189 #region HiveExperiment Methods 213 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]214 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]215 190 public HiveExperiment GetHiveExperiment(Guid id) { 191 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 216 192 return dao.GetHiveExperiments(x => 217 x.HiveExperimentId == id 218 && (x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0) 219 ).FirstOrDefault(); 220 } 221 222 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 223 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)] 193 x.HiveExperimentId == id 194 && (x.OwnerUserId == author.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == author.UserId) > 0) 195 ).FirstOrDefault(); 196 } 197 224 198 public IEnumerable<HiveExperiment> GetHiveExperiments() { 225 return dao.GetHiveExperiments(x => x.OwnerUserId == auth.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == auth.UserId) > 0);226 }227 228 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 199 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 200 return dao.GetHiveExperiments(x => x.OwnerUserId == author.UserId || x.HiveExperimentPermissions.Count(hep => hep.Permission != Permission.NotAllowed && hep.GrantedUserId == author.UserId) > 0); 201 } 202 229 203 public IEnumerable<HiveExperiment> GetAllHiveExperiments() { 204 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 230 205 return dao.GetHiveExperiments(x => true); 231 206 } 232 207 233 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]234 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]235 208 public Guid AddHiveExperiment(HiveExperiment hiveExperimentDto) { 236 return trans.UseTransaction(() => { 237 hiveExperimentDto.OwnerUserId = auth.UserId; 209 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 210 return trans.UseTransaction(() => { 211 hiveExperimentDto.OwnerUserId = author.UserId; 238 212 hiveExperimentDto.DateCreated = DateTime.Now; 239 213 return dao.AddHiveExperiment(hiveExperimentDto); … … 241 215 } 242 216 243 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]244 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]245 217 public void UpdateHiveExperiment(HiveExperiment hiveExperimentDto) { 218 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 246 219 trans.UseTransaction(() => { 247 220 dao.UpdateHiveExperiment(hiveExperimentDto); … … 249 222 } 250 223 251 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]252 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]253 224 public void DeleteHiveExperiment(Guid hiveExperimentId) { 225 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 254 226 trans.UseTransaction(() => { 255 227 HiveExperiment he = dao.GetHiveExperiment(hiveExperimentId); … … 260 232 261 233 #region Login Methods 262 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]263 234 public void Hello(Slave slaveInfo) { 235 authen.AuthenticateForAnyRole(HiveRoles.Slave); 264 236 trans.UseTransaction(() => { 265 237 var slave = dao.GetSlave(slaveInfo.Id); … … 293 265 } 294 266 295 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]296 267 public void GoodBye(Guid slaveId) { 268 authen.AuthenticateForAnyRole(HiveRoles.Slave); 297 269 trans.UseTransaction(() => { 298 270 var slave = dao.GetSlave(slaveId); … … 306 278 307 279 #region Heartbeat Methods 308 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]309 280 public List<MessageContainer> Heartbeat(Heartbeat heartbeat) { 281 authen.AuthenticateForAnyRole(HiveRoles.Slave); 310 282 TriggerLifecycle(false); 311 283 return trans.UseTransaction(() => heartbeatManager.ProcessHeartbeat(heartbeat)); … … 314 286 315 287 #region Plugin Methods 316 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]317 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]318 288 public Guid AddPlugin(Plugin plugin, List<PluginData> pluginDatas) { 319 return trans.UseTransaction(() => { 320 plugin.UserId = auth.UserId; 289 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 290 return trans.UseTransaction(() => { 291 plugin.UserId = author.UserId; 321 292 plugin.DateCreated = DateTime.Now; 322 293 if (!plugin.IsLocal) { … … 336 307 } 337 308 338 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]339 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]340 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]341 309 public Plugin GetPlugin(Guid pluginId) { 310 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 342 311 return dao.GetPlugin(pluginId); 343 312 } 344 313 345 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]346 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]347 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]348 314 public IEnumerable<Plugin> GetPlugins() { 315 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 349 316 return dao.GetPlugins(x => x.IsLocal == false); 350 317 } 351 318 352 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]353 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]354 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)]355 319 public IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds) { 320 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client, HiveRoles.Slave); 356 321 List<PluginData> pluginDatas = new List<PluginData>(); 357 322 … … 372 337 373 338 #region Slave Methods 374 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]375 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]376 339 public Guid AddSlave(Slave slave) { 340 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 377 341 return trans.UseTransaction(() => dao.AddSlave(slave)); 378 342 } 379 343 380 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]381 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]382 344 public Guid AddSlaveGroup(SlaveGroup slaveGroup) { 345 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 383 346 return trans.UseTransaction(() => dao.AddSlaveGroup(slaveGroup)); 384 347 } 385 348 386 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]387 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]388 349 public Slave GetSlave(Guid slaveId) { 350 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 389 351 return dao.GetSlave(slaveId); 390 352 } 391 353 392 354 public SlaveGroup GetSlaveGroup(Guid slaveGroupId) { 355 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 393 356 return dao.GetSlaveGroup(slaveGroupId); 394 357 } 395 358 396 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]397 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]398 359 public IEnumerable<Slave> GetSlaves() { 360 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 399 361 return dao.GetSlaves(x => true); 400 362 } 401 363 402 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]403 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]404 364 public IEnumerable<SlaveGroup> GetSlaveGroups() { 365 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 405 366 return dao.GetSlaveGroups(x => true); 406 367 } 407 368 408 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]409 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]410 369 public void UpdateSlave(Slave slave) { 370 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 411 371 trans.UseTransaction(() => { 412 372 dao.UpdateSlave(slave); … … 414 374 } 415 375 416 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]417 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]418 376 public void UpdateSlaveGroup(SlaveGroup slaveGroup) { 377 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 419 378 trans.UseTransaction(() => { 420 379 dao.UpdateSlaveGroup(slaveGroup); … … 422 381 } 423 382 424 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]425 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]426 383 public void DeleteSlave(Guid slaveId) { 384 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 427 385 trans.UseTransaction(() => { 428 386 dao.DeleteSlave(slaveId); … … 430 388 } 431 389 432 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]433 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]434 390 public void DeleteSlaveGroup(Guid slaveGroupId) { 391 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 435 392 trans.UseTransaction(() => { 436 393 dao.DeleteSlaveGroup(slaveGroupId); … … 438 395 } 439 396 440 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]441 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]442 397 public void AddResourceToGroup(Guid slaveGroupId, Guid resourceId) { 398 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 443 399 trans.UseTransaction(() => { 444 400 var resource = dao.GetResource(resourceId); … … 448 404 } 449 405 450 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]451 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]452 406 public void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId) { 407 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 453 408 trans.UseTransaction(() => { 454 409 var resource = dao.GetResource(resourceId); … … 458 413 } 459 414 460 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]461 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Client)]462 415 public Guid GetResourceId(string resourceName) { 416 authen.AuthenticateForAnyRole(HiveRoles.Administrator, HiveRoles.Client); 463 417 return trans.UseTransaction(() => { 464 418 var resource = dao.GetResources(x => x.Name == resourceName).FirstOrDefault(); … … 503 457 504 458 #region Appointment Methods 505 506 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]507 459 public Guid AddAppointment(Appointment appointment) { 460 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 508 461 return trans.UseTransaction(() => dao.AddAppointment(appointment)); 509 462 } 510 463 511 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]512 464 public void DeleteAppointment(Guid appointmentId) { 465 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 513 466 trans.UseTransaction(() => { 514 467 dao.DeleteAppointment(appointmentId); … … 516 469 } 517 470 518 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]519 471 public void UpdateAppointment(Appointment appointment) { 472 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 520 473 trans.UseTransaction(() => { 521 474 dao.UpdateAppointment(appointment); … … 523 476 } 524 477 525 // [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)]526 478 public IEnumerable<Appointment> GetScheduleForResource(Guid resourceId) { 479 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 527 480 return trans.UseTransaction(() => dao.GetAppointments(x => x.ResourceId == resourceId)); 528 481 } 529 482 530 483 public IEnumerable<Job> GetJobsByResourceId(Guid resourceId) { 484 authen.AuthenticateForAnyRole(HiveRoles.Administrator); 531 485 return trans.UseTransaction(() => dao.GetJobsByResourceId(resourceId)); 532 486 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/Interfaces/IServiceLocator.cs
r5405 r6362 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using HeuristicLab.Services.Hive.DataAccess; 1 using HeuristicLab.Services.Hive.DataAccess; 6 2 7 3 namespace HeuristicLab.Services.Hive { 8 4 public interface IServiceLocator { 9 5 IAuthenticationManager AuthenticationManager { get; } 10 6 IAuthorizationManager AuthorizationManager { get; } 11 7 IHiveDao HiveDao { get; } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Services.Hive/3.4/ServiceLocator.cs
r5405 r6362 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using HeuristicLab.Services.Hive.DataAccess; 1 using HeuristicLab.Services.Hive.DataAccess; 6 2 7 3 namespace HeuristicLab.Services.Hive { … … 33 29 } 34 30 31 private IAuthenticationManager authenticationManager; 32 public IAuthenticationManager AuthenticationManager { 33 get { 34 if (authenticationManager == null) authenticationManager = new AuthenticationManager(); 35 return authenticationManager; 36 } 37 } 38 35 39 private IAuthorizationManager authorizationManager; 36 40 public IAuthorizationManager AuthorizationManager {
Note: See TracChangeset
for help on using the changeset viewer.