Changeset 13690 for trunk/sources/HeuristicLab.Services.OKB/3.3/RunCreation
- Timestamp:
- 03/11/16 15:26:56 (9 years ago)
- Location:
- trunk/sources/HeuristicLab.Services.OKB/3.3/RunCreation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.OKB/3.3/RunCreation/IRunCreationService.cs
r13684 r13690 48 48 49 49 [OperationContract] 50 Solution GetSolution(long solutionId); 51 52 [OperationContract] 50 53 [FaultContract(typeof(MissingSolution))] 51 54 byte[] GetSolutionData(long solutionId); -
trunk/sources/HeuristicLab.Services.OKB/3.3/RunCreation/RunCreationService.cs
r13684 r13690 148 148 } 149 149 150 public DataTransfer.Solution GetSolution(long solutionId) { 151 roleVerifier.AuthenticateForAnyRole(OKBRoles.OKBAdministrator, OKBRoles.OKBUser); 152 153 using (OKBDataContext okb = new OKBDataContext()) { 154 // TODO: In case of multi-objective problems one has to check whether it contains single- or multi-objective problems 155 var result = Convert.ToDto(okb.SingleObjectiveSolutions.SingleOrDefault(x => x.Id == solutionId)); 156 if (roleVerifier.IsInRole(OKBRoles.OKBAdministrator)) { 157 return result; 158 } else { 159 var problemUsers = okb.ProblemUsers.Where(x => x.ProblemId == result.ProblemId).ToList(); 160 if (problemUsers.Count == 0 || userManager.VerifyUser(userManager.CurrentUserId, problemUsers.Select(y => y.UserGroupId).ToList())) { 161 return result; 162 } else { 163 return null; 164 } 165 } 166 } 167 } 168 150 169 public byte[] GetSolutionData(long solutionId) { 151 170 roleVerifier.AuthenticateForAnyRole(OKBRoles.OKBAdministrator, OKBRoles.OKBUser);
Note: See TracChangeset
for help on using the changeset viewer.