source: branches/HiveProjectManagement/HeuristicLab.Services.Hive/3.3/ServiceContracts/IHiveService.cs @ 15715

Last change on this file since 15715 was 15715, checked in by jzenisek, 20 months ago

#2839 improved permission checking of HiveService methods

File size: 7.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Net.Security;
25using System.ServiceModel;
26using HeuristicLab.Services.Hive.DataTransfer;
27
28namespace HeuristicLab.Services.Hive.ServiceContracts {
29
30  [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
31  public interface IHiveService {
32    #region Task Methods
33
34    [OperationContract]
35    Guid AddTask(Task task, TaskData taskData);
36
37    [OperationContract]
38    Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData);
39
40    [OperationContract]
41    Task GetTask(Guid taskId);
42
43    [OperationContract]
44    IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId);
45
46    [OperationContract]
47    IEnumerable<LightweightTask> GetLightweightJobTasksWithoutStateLog(Guid jobId);
48
49    [OperationContract]
50    TaskData GetTaskData(Guid taskId);
51
52    [OperationContract]
53    void UpdateTask(Task taskDto);
54
55    [OperationContract]
56    void UpdateTaskData(Task taskDto, TaskData taskDataDto);
57
58    [OperationContract]
59    Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
60    #endregion
61
62    #region Task Control Methods
63    [OperationContract]
64    void StopTask(Guid taskId);
65
66    [OperationContract]
67    void PauseTask(Guid taskId);
68
69    [OperationContract]
70    void RestartTask(Guid taskId);
71    #endregion
72
73    #region Job Methods
74    [OperationContract]
75    Job GetJob(Guid id);
76
77    [OperationContract]
78    IEnumerable<Job> GetJobs();
79
80    [OperationContract]
81    Guid AddJob(Job jobDto, IEnumerable<Guid> resourceIds);
82
83    [OperationContract]
84    void UpdateJob(Job jobDto, IEnumerable<Guid> resourceIds);
85
86    [OperationContract]
87    void UpdateJobState(Guid JobId, JobState jobState);
88
89    [OperationContract]
90    IEnumerable<AssignedJobResource> GetAssignedResourcesForJob(Guid jobId);
91    #endregion
92
93    #region JobPermission Methods
94    [OperationContract]
95    void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission);
96
97    [OperationContract]
98    void RevokePermission(Guid hiveExperimentId, Guid grantedUserId);
99
100    [OperationContract]
101    IEnumerable<JobPermission> GetJobPermissions(Guid jobId);
102
103    // BackwardsCompatibility3.3
104    #region Backwards compatible code, remove with 3.4
105    [OperationContract]
106    bool IsAllowedPrivileged(); // current user may execute privileged task
107    #endregion
108    #endregion
109
110    #region Login Methods
111    [OperationContract]
112    void Hello(Slave slave);
113
114    [OperationContract]
115    void GoodBye(Guid slaveId);
116    #endregion
117
118    #region Heartbeat Methods
119    [OperationContract]
120    List<MessageContainer> Heartbeat(Heartbeat heartbeat);
121    #endregion
122
123    #region Plugin Methods
124    [OperationContract]
125    Plugin GetPlugin(Guid pluginId);
126
127    [OperationContract]
128    [FaultContract(typeof(PluginAlreadyExistsFault))]
129    Guid AddPlugin(Plugin plugin, List<PluginData> pluginData);
130
131    [OperationContract]
132    IEnumerable<Plugin> GetPlugins();
133
134    [OperationContract]
135    IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
136    #endregion
137
138    #region Project Methods
139    [OperationContract]
140    Guid AddProject(Project projectDto);
141
142    [OperationContract]
143    void UpdateProject(Project projectDto);
144
145    [OperationContract]
146    void DeleteProject(Guid projectId);
147
148    [OperationContract]
149    Project GetProject(Guid projectId);
150
151    [OperationContract]
152    IEnumerable<Project> GetProjects();
153
154    [OperationContract]
155    IEnumerable<Project> GetProjectsForAdministration();
156    #endregion
157
158    #region ProjectPermission Methods
159    [OperationContract]
160    void SaveProjectPermissions(Guid projectId, List<Guid> grantedUserIds, bool reassign, bool cascading, bool reassignCascading);
161
162    //[OperationContract]
163    //void GrantProjectPermissions(Guid projectId, List<Guid> grantedUserIds, bool cascading);
164
165    //[OperationContract]
166    //void RevokeProjectPermissions(Guid projectId, List<Guid> grantedUserIds, bool cascading);
167
168    [OperationContract]
169    IEnumerable<ProjectPermission> GetProjectPermissions(Guid projectId);
170    #endregion
171
172    #region AssignedProjectResource Methods
173    [OperationContract]
174    void SaveProjectResourceAssignments(Guid projectId, List<Guid> resourceIds, bool reassign, bool cascading, bool reassignCascading);
175
176    //[OperationContract]
177    //void AssignProjectResources(Guid projectId, List<Guid> resourceIds, bool cascading);
178
179    //[OperationContract]
180    //void UnassignProjectResources(Guid projectId, List<Guid> resourceIds, bool cascading);
181
182    [OperationContract]
183    IEnumerable<AssignedProjectResource> GetAssignedResourcesForProject(Guid projectId);
184
185    [OperationContract]
186    IEnumerable<AssignedProjectResource> GetAssignedResourcesForProjectAdministration(Guid projectId);
187    #endregion
188
189    #region Slave Methods
190    [OperationContract]
191    Guid AddSlave(Slave slave);
192
193    [OperationContract]
194    Guid AddSlaveGroup(SlaveGroup slaveGroup);
195
196    [OperationContract]
197    Slave GetSlave(Guid slaveId);
198
199    [OperationContract]
200    IEnumerable<Slave> GetSlaves();
201
202    [OperationContract]
203    IEnumerable<SlaveGroup> GetSlaveGroups();
204
205    [OperationContract]
206    IEnumerable<Slave> GetSlavesForAdministration();
207
208    [OperationContract]
209    IEnumerable<SlaveGroup> GetSlaveGroupsForAdministration();
210
211    [OperationContract]
212    void UpdateSlave(Slave slave);
213
214    [OperationContract]
215    void UpdateSlaveGroup(SlaveGroup slaveGroup);
216
217    [OperationContract]
218    void DeleteSlave(Guid slaveId);
219
220    [OperationContract]
221    void DeleteSlaveGroup(Guid slaveGroupId);
222
223    [OperationContract]
224    void AddResourceToGroup(Guid slaveGroupId, Guid resourceId);
225
226    [OperationContract]
227    void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
228
229    [OperationContract]
230    Guid GetResourceId(string resourceName);
231
232    [OperationContract]
233    void TriggerEventManager(bool force);
234
235    [OperationContract]
236    int GetNewHeartbeatInterval(Guid slaveId);
237    #endregion
238
239    #region Downtime Methods
240    [OperationContract]
241    Guid AddDowntime(Downtime downtime);
242
243    [OperationContract]
244    void DeleteDowntime(Guid downtimeId);
245
246    [OperationContract]
247    void UpdateDowntime(Downtime downtimeDto);
248
249    [OperationContract]
250    IEnumerable<Downtime> GetDowntimesForResource(Guid resourceId);
251    #endregion
252
253    #region User Methods
254    [OperationContract]
255    string GetUsernameByUserId(Guid userId);
256
257    [OperationContract]
258    Guid GetUserIdByUsername(string username);
259
260    [OperationContract]
261    Dictionary<Guid, HashSet<Guid>> GetUserGroupTree();
262
263    [OperationContract]
264    bool CheckAccessToAdminAreaGranted();
265    #endregion
266
267    #region UserPriorities Methods
268    [OperationContract]
269    IEnumerable<UserPriority> GetUserPriorities();
270    #endregion
271  }
272}
Note: See TracBrowser for help on using the repository browser.