Changeset 4289 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades
- Timestamp:
- 08/23/10 14:40:19 (14 years ago)
- Location:
- branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/ExecutionEngineFacade.cs
r4263 r4289 77 77 } 78 78 79 80 79 public ResponseObject<JobResultList> GetJobResults(IEnumerable<Guid> jobIds) { 81 80 using (contextFactory.GetContext(false)) { … … 83 82 } 84 83 } 84 85 85 #endregion 86 87 88 86 } 89 87 } -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/ServerConsoleFacade.cs
r4267 r4289 32 32 using HeuristicLab.Hive.Server.DataAccess; 33 33 using HeuristicLab.Hive.Contracts.ResponseObjects; 34 34 using System.Security.Permissions; 35 36 //IIdentity id = ServiceSecurityContext.Current.PrimaryIdentity; 37 //if (!Thread.CurrentPrincipal.IsInRole("Administrator")) { 38 39 //} else { 40 // // access denied 41 // throw new SecurityException(); 42 //} 35 43 36 44 namespace HeuristicLab.Hive.Server.Core { … … 49 57 } 50 58 51 public Response Login(string username, string password) { 59 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 60 public Response Login() { 52 61 Response resp = new Response(); 53 54 sessionID = secMan.Login(username, password);55 if (sessionID == Guid.Empty) {56 resp.StatusMessage = ResponseStatus.Login_LoginFaild;57 }58 62 return resp; 59 63 } 60 64 61 65 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 62 66 public ResponseList<SlaveDto> GetAllSlaves() { 63 67 using (contextFactory.GetContext(false)) { 64 secMan.Authorize("AccessSlaves", sessionID, Guid.Empty);65 68 return slaveManager.GetAllSlaves(); 66 69 } 67 70 } 68 71 72 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 69 73 public ResponseList<SlaveGroupDto> GetAllSlaveGroups() { 70 74 using (contextFactory.GetContext(false)) { 71 //secMan.Authorize("AccessSlaveGroup", sessionID, Guid.Empty);72 75 return slaveManager.GetAllSlaveGroups(); 73 76 } 74 77 } 75 78 79 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 76 80 public ResponseList<UpTimeStatisticsDto> GetAllUpTimeStatistics() { 77 81 using (contextFactory.GetContext(false)) { 78 secMan.Authorize("AccessStatistics", sessionID, Guid.Empty);79 82 return slaveManager.GetAllUpTimeStatistics(); 80 83 } 81 84 } 82 85 86 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 83 87 public ResponseObject<SlaveGroupDto> AddSlaveGroup(SlaveGroupDto slaveGroup) { 84 88 using (contextFactory.GetContext()) { 85 secMan.Authorize("AddSlaveGroup", sessionID, Guid.Empty);86 89 return slaveManager.AddSlaveGroup(slaveGroup); 87 90 } 88 91 } 89 92 93 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 90 94 public Response AddResourceToGroup(Guid slaveGroupId, ResourceDto resource) { 91 95 using (contextFactory.GetContext()) { 92 secMan.Authorize("AddResource", sessionID, Guid.Empty);93 96 return slaveManager.AddResourceToGroup(slaveGroupId, resource); 94 97 } 95 98 } 96 99 100 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 97 101 public Response DeleteResourceFromGroup(Guid slaveGroupId, Guid resourceId) { 98 102 using (contextFactory.GetContext()) { … … 101 105 } 102 106 107 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 103 108 public ResponseList<JobDto> GetAllJobs() { 104 109 using (contextFactory.GetContext(false)) { 105 secMan.Authorize("AccessJobs", sessionID, Guid.Empty);106 110 return jobManager.GetAllJobs(); 107 111 } 108 112 } 109 113 114 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 110 115 public ResponseList<JobDto> GetAllJobsWithFilter(JobState jobState, int offset, int count) { 111 116 using (contextFactory.GetContext(false)) { 112 secMan.Authorize("AccessJobs", sessionID, Guid.Empty);113 117 return jobManager.GetAllJobsWithFilter(jobState, offset, count); 114 118 } 115 119 } 116 120 121 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 117 122 public ResponseObject<JobDto> GetJobById(Guid jobId) { 118 123 using (contextFactory.GetContext(false)) { 119 secMan.Authorize("AccessJobs", sessionID, jobId);120 124 return jobManager.GetJobById(jobId); 121 125 } 122 126 } 123 127 128 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 124 129 public ResponseObject<JobDto> GetJobByIdWithDetails(Guid jobId) { 125 130 using (contextFactory.GetContext(false)) { 126 secMan.Authorize("AccessJobs", sessionID, jobId);127 131 return jobManager.GetJobByIdWithDetails(jobId); 128 132 } 129 133 } 130 134 135 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 131 136 public ResponseObject<JobDto> AddNewJob(SerializedJob job) { 132 137 using (contextFactory.GetContext()) { 133 secMan.Authorize("AddJob", sessionID, job.JobInfo.Id);134 138 return jobManager.AddNewJob(job); 135 139 } 136 140 } 137 141 138 //public ResponseObject<JobDto> GetLastJobResultOf(Guid jobId) { 139 // using (contextFactory.GetContext(false)) { 140 // secMan.Authorize("AccessJobResults", sessionID, jobId); 141 // return jobManager.GetLastJobResultOf(jobId); 142 // } 143 //} 144 142 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 145 143 public ResponseObject<SerializedJob> GetLastSerializedResult(Guid jobId, bool requested, bool snapshot) { 146 144 using (contextFactory.GetContext(false)) { 147 secMan.Authorize("AccessJobResults", sessionID, jobId);148 145 return jobManager.GetLastSerializedResult(jobId, requested, snapshot); 149 146 } 150 147 } 151 148 149 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 152 150 public ResponseObject<JobResultList> GetJobResults(IEnumerable<Guid> jobIds) { 153 151 using (contextFactory.GetContext(false)) { 154 //secMan.Authorize("AccessJobResults", sessionID, jobId); skip authorization155 152 return jobManager.GetJobResults(jobIds); 156 153 } 157 154 } 158 155 159 //public Response RemoveJob(Guid jobId) { 160 // using (contextFactory.GetContext()) { 161 // secMan.Authorize("RemoveJob", sessionID, jobId); 162 // return jobManager.RemoveJob(jobId); 163 // } 164 //} 165 156 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 166 157 public Response RequestSnapshot(Guid jobId) { 167 158 using (contextFactory.GetContext()) { 168 secMan.Authorize("AccessJobResults", sessionID, jobId);169 159 return jobManager.RequestSnapshot(jobId); 170 160 } 171 161 } 172 162 163 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 173 164 public Response AbortJob(Guid jobId) { 174 165 using (contextFactory.GetContext()) { 175 secMan.Authorize("AbortJob", sessionID, Guid.Empty);176 166 return jobManager.AbortJob(jobId); 177 167 } 178 168 } 179 169 170 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 180 171 public ResponseObject<SlaveGroupDtoList> GetAllGroupsOfResource(Guid resourceId) { 181 172 using (contextFactory.GetContext(false)) { 182 secMan.Authorize("AccessUserGroup", sessionID, Guid.Empty);183 173 return slaveManager.GetAllGroupsOfResource(resourceId); 184 174 } 185 175 } 186 176 177 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 187 178 public Response DeleteSlaveGroup(Guid slaveGroupId) { 188 179 using (contextFactory.GetContext()) { 189 secMan.Authorize("DeleteSlaveGroup", sessionID, Guid.Empty);190 180 return slaveManager.DeleteSlaveGroup(slaveGroupId); 191 181 } 192 182 } 193 183 184 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 194 185 public ResponseList<ProjectDto> GetAllProjects() { 195 186 using (contextFactory.GetContext(false)) { 196 secMan.Authorize("AccessProjects", sessionID, Guid.Empty);197 187 return jobManager.GetAllProjects(); 198 188 } 199 189 } 200 190 191 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 201 192 public Response CreateProject(ProjectDto project) { 202 193 using (contextFactory.GetContext()) { 203 secMan.Authorize("CreateProjects", sessionID, Guid.Empty);204 194 return jobManager.CreateProject(project); 205 195 } 206 196 } 207 197 198 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 208 199 public Response ChangeProject(ProjectDto project) { 209 200 using (contextFactory.GetContext()) { 210 secMan.Authorize("ChangeProjects", sessionID, Guid.Empty);211 201 return jobManager.ChangeProject(project); 212 202 } 213 203 } 214 204 205 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 215 206 public Response DeleteProject(Guid projectId) { 216 207 using (contextFactory.GetContext()) { 217 secMan.Authorize("DeleteProjects", sessionID, projectId);218 208 return jobManager.DeleteProject(projectId); 219 209 } 220 210 } 221 211 212 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 222 213 public ResponseList<JobDto> GetJobsByProject(Guid projectId) { 223 214 using (contextFactory.GetContext(false)) { 224 secMan.Authorize("AccessJobs", sessionID, Guid.Empty);225 215 return jobManager.GetJobsByProject(projectId); 226 216 } 227 217 } 228 218 219 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 229 220 public ResponseList<AppointmentDto> GetUptimeCalendarForResource(Guid guid) { 230 221 using (contextFactory.GetContext(false)) { … … 233 224 } 234 225 226 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 235 227 public Response SetUptimeCalendarForResource(Guid guid, IEnumerable<AppointmentDto> appointments, bool isForced) { 236 228 using (contextFactory.GetContext()) { … … 239 231 } 240 232 233 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Administrator)] 241 234 public ResponseObject<JobDto> AddJobWithGroupStrings(SerializedJob job, IEnumerable<string> resources) { 242 235 using (contextFactory.GetContext()) { -
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server.Core/3.3/Facades/SlaveFacade.cs
r4267 r4289 36 36 using HeuristicLab.Hive.Server.DataAccess; 37 37 using HeuristicLab.Hive.Contracts.ResponseObjects; 38 using System.Security.Permissions; 38 39 39 40 namespace HeuristicLab.Hive.Server.Core { … … 50 51 #region ISlaveCommunicator Members 51 52 52 public Response Login(SlaveDto clientInfo) { 53 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 54 public Response Login(Guid slaveId) { 53 55 using (contextFactory.GetContext()) { 54 return slaveCommunicator.Login( clientInfo);56 return slaveCommunicator.Login(slaveId); 55 57 } 56 58 } 57 59 60 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 58 61 public ResponseHeartBeat ProcessHeartBeat(HeartBeatData hbData) { 59 62 using (contextFactory.GetContext()) { … … 62 65 } 63 66 67 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 64 68 public ResponseObject<JobDto> GetJob(Guid clientId) { 65 69 using (contextFactory.GetContext()) { … … 68 72 } 69 73 74 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 70 75 public ResponseResultReceived StoreFinishedJobResult(Guid clientId, Guid jobId, byte[] result, double percentage, string exception) { 71 76 using (contextFactory.GetContext()) { … … 74 79 } 75 80 81 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 76 82 public Response Logout(Guid clientId) { 77 83 using (contextFactory.GetContext()) { … … 80 86 } 81 87 88 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 82 89 public Response IsJobStillNeeded(Guid jobId) { 83 90 using (contextFactory.GetContext()) { … … 86 93 } 87 94 95 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 88 96 public ResponseList<CachedHivePluginInfoDto> GetPlugins(List<HivePluginInfoDto> pluginList) { 89 97 return slaveCommunicator.GetPlugins(pluginList); 90 98 } 91 99 100 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 92 101 public ResponseResultReceived ProcessSnapshot(Guid clientId, Guid jobId, byte[] result, double percentage, string exception) { 93 102 using (contextFactory.GetContext()) { … … 96 105 } 97 106 107 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 98 108 public ResponseCalendar GetCalendar(Guid clientId) { 99 109 using (contextFactory.GetContext()) { … … 102 112 } 103 113 114 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 104 115 public Response SetCalendarStatus(Guid clientId, CalendarState state) { 105 116 using (contextFactory.GetContext()) { … … 114 125 /// Do not use automatic transactions here 115 126 /// </summary> 127 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 116 128 public Stream GetStreamedJob(Guid clientId) { 117 129 using (contextFactory.GetContext(false)) { … … 144 156 } 145 157 158 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 146 159 public Stream GetStreamedPlugins(List<HivePluginInfoDto> pluginList) { 147 160 return new StreamedObject<ResponseList<CachedHivePluginInfoDto>>(this.GetPlugins(pluginList)); 148 161 } 149 162 163 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 150 164 public ResponseResultReceived StoreFinishedJobResultStreamed(Stream stream) { 151 165 using (contextFactory.GetContext()) { … … 154 168 } 155 169 170 [PrincipalPermission(SecurityAction.Demand, Role = HiveRoles.Slave)] 156 171 public ResponseResultReceived ProcessSnapshotStreamed(Stream stream) { 157 172 using (contextFactory.GetContext()) {
Note: See TracChangeset
for help on using the changeset viewer.