Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/04/08 17:22:06 (16 years ago)
Author:
msteinbi
Message:

Implementation of UserRoleManager (#417)

Location:
trunk/sources/HeuristicLab.Hive.Server.Core
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r902 r907  
    4444          if (client.State != State.offline) {
    4545            response.Success = false;
    46             response.StatusMessage = rm.GetString(ApplicationConstants.RESPONSE_LOGIN_USER_ALLREADY_ONLINE);
     46            response.StatusMessage = ApplicationConstants.RESPONSE_LOGIN_USER_ALLREADY_ONLINE;
    4747            break;
    4848          } else
     
    5454        clientAdapter.UpdateClient(clientInfo);
    5555        response.Success = true;
    56         response.StatusMessage = rm.GetString(ApplicationConstants.RESPONSE_LOGIN_SUCCESS);
     56        response.StatusMessage = ApplicationConstants.RESPONSE_LOGIN_SUCCESS;
    5757      }
    5858
     
    102102      if (client == null) {
    103103        response.Success = false;
    104         response.StatusMessage = rm.GetString(ApplicationConstants.RESPONSE_LOGOUT_CLIENT_NOT_REGISTERED);
     104        response.StatusMessage = ApplicationConstants.RESPONSE_LOGOUT_CLIENT_NOT_REGISTERED;
    105105        return response;
    106106      }
     
    109109
    110110      response.Success = true;
    111       response.StatusMessage = rm.GetString(ApplicationConstants.RESPONSE_LOGOUT_SUCCESS);
     111      response.StatusMessage = ApplicationConstants.RESPONSE_LOGOUT_SUCCESS;
    112112     
    113113      return response;
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientManager.cs

    r902 r907  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 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;
    223using System.Collections.Generic;
    324using System.Linq;
     
    3758
    3859    public ResponseList<ClientInfo> GetAllClients() {
    39       return null;
     60      ResponseList<ClientInfo> response = new ResponseList<ClientInfo>();
     61      response.List = clients;
     62      response.Success = true;
     63      return response;
    4064    }
    4165
    4266    public ResponseList<ClientGroup> GetAllClientGroups() {
    43       return null;
     67      ResponseList<ClientGroup> response = new ResponseList<ClientGroup>();
     68      response.List = clientGroups;
     69      response.Success = true;
     70      return response;
    4471    }
    4572
    4673    public ResponseList<UpTimeStatistics> GetAllUpTimeStatistics() {
    47       return null;
     74      ResponseList<UpTimeStatistics> response = new ResponseList<UpTimeStatistics>();
     75      response.Success = true;
     76      return response;
    4877    }
    4978
  • trunk/sources/HeuristicLab.Hive.Server.Core/HiveServerMessages.resx

    r902 r907  
    130130    <value>A User with this GUID is allready logged in</value>
    131131  </data>
     132  <data name="UserRole.GetAllUsers" xml:space="preserve">
     133    <value>All Users returned</value>
     134  </data>
     135  <data name="UserRole.UserDoesntExist" xml:space="preserve">
     136    <value>Sorry, but this user doesn't exist</value>
     137  </data>
     138  <data name="UserRole.UserExistsAllready" xml:space="preserve">
     139    <value>Sorry, but a user with this name exists allready in database</value>
     140  </data>
     141  <data name="UserRole.UserRemoved" xml:space="preserve">
     142    <value>User sucessfully removed from database</value>
     143  </data>
     144  <data name="UserRole.UserSuccessfullyAdded" xml:space="preserve">
     145    <value>User successfully added to database</value>
     146  </data>
    132147</root>
  • trunk/sources/HeuristicLab.Hive.Server.Core/JobManager.cs

    r902 r907  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 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;
    223using System.Collections.Generic;
    324using System.Linq;
     
    2344
    2445    public ResponseList<Job> GetAllJobs() {
    25       return null;
     46      ResponseList<Job> response = new ResponseList<Job>();
     47      response.List = jobs;
     48      return response;
    2649    }
    2750
  • trunk/sources/HeuristicLab.Hive.Server.Core/ServerConsoleFacade.cs

    r902 r907  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2008 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;
    223using System.Collections.Generic;
    324using System.Linq;
     
    7394    #endregion
    7495
     96
     97    #region IServerConsoleFacade Members
     98
     99    public Response Login(string userName, string password) {
     100      Response response = new Response();
     101      response.Success = true;
     102      retrurn response;
     103    }
     104
     105    #endregion
    75106  }
    76107}
  • trunk/sources/HeuristicLab.Hive.Server.Core/UserRoleManager.cs

    r902 r907  
    3737
    3838    public ResponseList<User> GetAllUsers() {
    39       return null;     
     39      ResponseList<User> response = new ResponseList<User>();
     40
     41      List<User> allUsers = new List<User>(userAdapter.GetAllUsers());
     42      response.List = allUsers;
     43      response.Success = true;
     44      response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_GET_ALL_USERS;
     45
     46      return response;
    4047    }
    4148
    4249    public Response AddNewUser(User user) {
     50      Response response = new Response();
     51
    4352      User dbUser = userAdapter.GetUserByName(user.Name);
    44 
    45       return null;
     53      if (dbUser != null) {
     54        response.Success = false;
     55        response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_USER_EXISTS_ALLREADY;
     56        return response;
     57      }
     58      userAdapter.UpdateUser(user);
     59      response.Success = true;
     60      response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_USER_SUCCESSFULLY_ADDED;
     61     
     62      return response;
    4663    }
    4764
    4865    public ResponseList<UserGroup> GetAllUserGroups() {
    49       return null;
     66      ResponseList<UserGroup> response = new ResponseList<UserGroup>();
     67
     68      return response;
    5069    }
    5170
    5271    public Response RemoveUser(long userId) {
    53       return null;
     72      Response response = new Response();
     73      User user = userAdapter.GetUserById(userId);
     74      if (user == null) {
     75        response.Success = false;
     76        response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_USER_DOESNT_EXIST;
     77        return response;
     78      }
     79      response.Success = true;
     80      response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_USER_REMOVED;
     81
     82      return response;
    5483    }
    5584
Note: See TracChangeset for help on using the changeset viewer.