- Timestamp:
- 12/10/08 14:27:43 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Contracts/ApplicationConstants.cs
r940 r942 23 23 public static string RESPONSE_CLIENT_GET_ALL_CLIENTS = "Client.GetAllClients"; 24 24 public static string RESPONSE_CLIENT_GET_ALL_CLIENTGROUPS = "Client.GetAllClientGroups"; 25 public static string RESPONSE_CLIENT_ID_MUST_NOT_BE_SET = "Client.IdMustNotBeSet"; 26 public static string RESPONSE_CLIENT_CLIENTGROUP_ADDED = "Client.ClientGroupAdded"; 27 public static string RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST = "Client.ClientGroupDoesntExist"; 28 public static string RESPONSE_CLIENT_RESOURCE_ADDED_TO_GROUP = "Client.ResourceAddedToGroup"; 29 public static string RESPONSE_CLIENT_RESOURCE_REMOVED = "Client.ResourceRemoved"; 30 public static string RESPONSE_CLIENT_RESOURCE_NOT_FOUND = "Client.ResourceNotFound"; 25 31 26 32 public static string RESPONSE_COMMUNICATOR_HARDBEAT_RECEIVED = "Communicator.HeardbeatReceived"; -
trunk/sources/HeuristicLab.Hive.Contracts/HiveServerMessages.resx
r937 r942 178 178 <value>User successfully added to database</value> 179 179 </data> 180 <data name="Client.ClientGroupAdded" xml:space="preserve"> 181 <value>ClientGroup successfully added</value> 182 </data> 183 <data name="Client.ClientGroupDoesntExist" xml:space="preserve"> 184 <value>The specified ClientGroup doesn't exist</value> 185 </data> 186 <data name="Client.IdMustNotBeSet" xml:space="preserve"> 187 <value>In this context the id must not be set</value> 188 </data> 189 <data name="Client.ResourceAddedToGroup" xml:space="preserve"> 190 <value>Resource successfully added to ClientGroup</value> 191 </data> 192 <data name="Client.ResourceRemoved" xml:space="preserve"> 193 <value>Resource successfully removed from ClientGroup</value> 194 </data> 180 195 <data name="UserRole.IdMustNotBeSet" xml:space="preserve"> 181 196 <value>In this context the id must not be set</value> -
trunk/sources/HeuristicLab.Hive.Server.Core/ClientManager.cs
r937 r942 80 80 Response response = new Response(); 81 81 82 ClientGroup clientGroupFromDb = clientGroupAdapter.GetClientGroupById(clientGroup.ResourceId); 83 82 if (clientGroup.ResourceId != 0) { 83 response.Success = false; 84 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_ID_MUST_NOT_BE_SET; 85 return response; 86 } 87 clientGroupAdapter.UpdateClientGroup(clientGroup); 88 response.Success = true; 89 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_ADDED; 84 90 85 91 return response; … … 87 93 88 94 public Response AddResourceToGroup(long clientGroupId, Resource resource) { 89 throw new NotImplementedException(); 95 Response response = new Response(); 96 97 if (resource.ResourceId != 0) { 98 response.Success = false; 99 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_ID_MUST_NOT_BE_SET; 100 return response; 101 } 102 103 ClientGroup clientGroup = clientGroupAdapter.GetClientGroupById(clientGroupId); 104 if (clientGroup == null) { 105 response.Success = false; 106 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST; 107 return response; 108 } 109 clientGroup.Resources.Add(resource); 110 111 response.Success = true; 112 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_ADDED_TO_GROUP; 113 114 return response; 90 115 } 91 116 92 117 public Response DeleteResourceFromGroup(long clientGroupId, long resourceId) { 93 throw new NotImplementedException(); 118 Response response = new Response(); 119 120 ClientGroup clientGroup = clientGroupAdapter.GetClientGroupById(clientGroupId); 121 if (clientGroup == null) { 122 response.Success = false; 123 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_CLIENTGROUP_DOESNT_EXIST; 124 return response; 125 } 126 foreach (Resource resource in clientGroup.Resources) { 127 if (resource.ResourceId == resourceId) { 128 clientGroup.Resources.Remove(resource); 129 response.Success = true; 130 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_REMOVED; 131 return response; 132 } 133 } 134 response.Success = false; 135 response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_RESOURCE_NOT_FOUND; 136 137 return response; 94 138 } 95 139 #endregion -
trunk/sources/HeuristicLab.Hive.Server.Core/UserRoleManager.cs
r937 r942 37 37 Response response = new Response(); 38 38 39 if (user.PermissionOwnerId != null) {39 if (user.PermissionOwnerId != 0) { 40 40 response.Success = false; 41 41 response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_ID_MUST_NOT_BE_SET; … … 77 77 Response response = new Response(); 78 78 79 if (userGroup.PermissionOwnerId != null) {79 if (userGroup.PermissionOwnerId != 0) { 80 80 response.Success = false; 81 81 response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_ID_MUST_NOT_BE_SET; … … 108 108 Response response = new Response(); 109 109 110 if (permissionOwner.PermissionOwnerId != null) {110 if (permissionOwner.PermissionOwnerId != 0) { 111 111 response.Success = false; 112 112 response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_ID_MUST_NOT_BE_SET;
Note: See TracChangeset
for help on using the changeset viewer.