Free cookie consent management tool by TermsFeed Policy Generator

Changeset 929 for trunk


Ignore:
Timestamp:
12/10/08 09:43:58 (16 years ago)
Author:
msteinbi
Message:

Implementation of UserRoleManager (#417)

Location:
trunk/sources
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Client.Communication/ServiceLocator.cs

    r882 r929  
    1313        proxy = new ClientCommunicatorClient(
    1414          new NetTcpBinding(),
    15           new EndpointAddress("net.tcp://192.168.132.1:9000/HiveServer/ClientCommunicator")
     15          new EndpointAddress("net.tcp://10.20.53.2:9000/HiveServer/ClientCommunicator")
    1616          );
    1717      }
  • trunk/sources/HeuristicLab.Hive.Contracts/ApplicationConstants.cs

    r907 r929  
    66namespace HeuristicLab.Hive.Contracts {
    77  public class ApplicationConstants {
    8     public static string RESPONSE_LOGIN_USER_ALLREADY_ONLINE = "Login.UserAllreadyOnline";
    9     public static string RESPONSE_LOGIN_SUCCESS = "Login.Success";
    10 
    11     public static string RESPONSE_LOGOUT_CLIENT_NOT_REGISTERED = "Logout.ClientNotRegistered";
    12     public static string RESPONSE_LOGOUT_SUCCESS = "Logout.Success";
    138
    149    public static string RESPONSE_USERROLE_GET_ALL_USERS = "UserRole.GetAllUsers";
     
    1813    public static string RESPONSE_USERROLE_USER_REMOVED = "UserRole.UserRemoved";
    1914
     15    public static string RESPONSE_CLIENT_GET_ALL_CLIENTS = "Client.GetAllClients";
     16
     17    public static string RESPONSE_COMMUNICATOR_HARDBEAT_RECEIVED = "Communicator.HeardbeatReceived";
     18    public static string RESPONSE_COMMUNICATOR_JOB_PULLED = "Communicator.JobPulled";
     19    public static string RESPONSE_COMMUNICATOR_JOBRESULT_RECEIVED = "Communicator.JobResultReceived";
     20    public static string RESPONSE_COMMUNICATOR_LOGIN_USER_ALLREADY_ONLINE = "Communicator.LoginUserAllreadyOnline";
     21    public static string RESPONSE_COMMUNICATOR_LOGIN_SUCCESS = "Communicator.LoginSuccess";
     22    public static string RESPONSE_COMMUNICATOR_LOGOUT_CLIENT_NOT_REGISTERED = "Communicator.LogoutClientNotRegistered";
     23    public static string RESPONSE_COMMUNICATOR_LOGOUT_SUCCESS = "Logout.Success";
     24
    2025  }
    2126}
  • trunk/sources/HeuristicLab.Hive.Contracts/BusinessObjects/UserGroup.cs

    r902 r929  
    3030  [DataContract]
    3131  public class UserGroup : PermissionOwner {
    32     [DataMember]
    33     public long UserGroupId { get; set; }
    3432  }
    3533}
  • trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerManagementConsole.cs

    r904 r929  
    7979      }
    8080      foreach (UserGroup ug in userGroups.List) {
    81         tvUserControl.Nodes.Add(ug.UserGroupId.ToString());
     81        tvUserControl.Nodes.Add(ug.PermissionOwnerId.ToString());
    8282      }
    8383    }
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientCommunicator.cs

    r907 r929  
    2121
    2222    IClientAdapter clientAdapter;
    23     ResourceManager rm;
    2423
    2524    public ClientCommunicator() {
    26       clientAdapter = ServiceLocator.GetClientAdapter();
    27       rm = new ResourceManager("HiveServerMessages.resx", Assembly.GetExecutingAssembly());
     25      clientAdapter = ServiceLocator.GetClientAdapter();
    2826
    2927      jobs = new LinkedList<long>();
     
    4038
    4139      ICollection<ClientInfo> allClients = clientAdapter.GetAllClients();
    42       foreach (ClientInfo client in allClients) {
    43         if (client.ClientId.Equals(clientInfo.ClientId)) {
    44           if (client.State != State.offline) {
    45             response.Success = false;
    46             response.StatusMessage = ApplicationConstants.RESPONSE_LOGIN_USER_ALLREADY_ONLINE;
    47             break;
    48           } else
    49             break; // searching for clients can be stopped, because it was found and it's state is offline
    50         }
    51       }
     40      ClientInfo client = clientAdapter.GetClientById(clientInfo.ClientId);
     41      if (client != null) {
     42        if (client.State != State.offline) {
     43          response.Success = false;
     44          response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGIN_USER_ALLREADY_ONLINE;
     45        }
     46      }
    5247
    5348      if (response.Success) {
    5449        clientAdapter.UpdateClient(clientInfo);
    55         response.Success = true;
    56         response.StatusMessage = ApplicationConstants.RESPONSE_LOGIN_SUCCESS;
     50        response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGIN_SUCCESS;
    5751      }
    5852
     
    6458
    6559      response.Success = true;
    66       response.StatusMessage = "HeartBeat received";
     60      response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_HARDBEAT_RECEIVED;
    6761      response.ActionRequest = new List<MessageContainer>();
    6862      if (jobs.Count > 0)
     
    8377     
    8478      response.Success = true;
    85       response.StatusMessage = "Job with id " + jobs.Count + " sent";     
     79      response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOB_PULLED;
    8680      return response;
    8781    }
     
    9084      ResponseResultReceived response = new ResponseResultReceived();
    9185      response.Success = true;
    92       response.StatusMessage = "Thanks for calculating";
     86      response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_JOBRESULT_RECEIVED;
    9387      response.JobId = Result.JobId;
    9488
     
    10296      if (client == null) {
    10397        response.Success = false;
    104         response.StatusMessage = ApplicationConstants.RESPONSE_LOGOUT_CLIENT_NOT_REGISTERED;
     98        response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGOUT_CLIENT_NOT_REGISTERED;
    10599        return response;
    106100      }
     
    109103
    110104      response.Success = true;
    111       response.StatusMessage = ApplicationConstants.RESPONSE_LOGOUT_SUCCESS;
     105      response.StatusMessage = ApplicationConstants.RESPONSE_COMMUNICATOR_LOGOUT_SUCCESS;
    112106     
    113107      return response;
  • trunk/sources/HeuristicLab.Hive.Server.Core/ClientManager.cs

    r907 r929  
    2727using HeuristicLab.Hive.Contracts.BusinessObjects;
    2828using HeuristicLab.Hive.Contracts;
     29using HeuristicLab.Hive.Server.Core.InternalInterfaces.DataAccess;
    2930
    3031namespace HeuristicLab.Hive.Server.Core {
    3132  class ClientManager: IClientManager {
     33
     34    IClientAdapter clientAdapter;
    3235
    3336    List<ClientInfo> clients;
     
    3538
    3639    public ClientManager() {
     40      clientAdapter = ServiceLocator.GetClientAdapter();
     41
    3742      clients = new List<ClientInfo>();
    3843      clientGroups = new List<ClientGroup>();
     
    5964    public ResponseList<ClientInfo> GetAllClients() {
    6065      ResponseList<ClientInfo> response = new ResponseList<ClientInfo>();
    61       response.List = clients;
     66
     67      response.List = new List<ClientInfo>(clientAdapter.GetAllClients());
     68      response.StatusMessage = ApplicationConstants.RESPONSE_CLIENT_GET_ALL_CLIENTS;
    6269      response.Success = true;
     70
    6371      return response;
    6472    }
  • trunk/sources/HeuristicLab.Hive.Server.Core/HiveServerMessages.resx

    r907 r929  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <data name="Login.ClientNotRegistered" xml:space="preserve">
     120  <data name="Client.GetAllClients" xml:space="preserve">
     121    <value>All Clients returned</value>
     122  </data>
     123  <data name="Communicator.HeardbeatReceived" xml:space="preserve">
     124    <value>Heartbeat received</value>
     125  </data>
     126  <data name="Communicator.JobPulled" xml:space="preserve">
     127    <value>Job sent</value>
     128  </data>
     129  <data name="Communicator.JobResultReceived" xml:space="preserve">
     130    <value>JobResult received, thanks for calculating</value>
     131  </data>
     132  <data name="Communicator.LoginClientNotRegistered" xml:space="preserve">
    121133    <value>Sorry this client was not registered yet</value>
    122134  </data>
    123   <data name="Login.Success" xml:space="preserve">
     135  <data name="Communicator.LoginSuccess" xml:space="preserve">
    124136    <value>The Login was successfull</value>
    125137  </data>
    126   <data name="Logout.Success" xml:space="preserve">
     138  <data name="Communicator.LogoutSuccess" xml:space="preserve">
    127139    <value>You where logged out successfully. Good bye</value>
    128140  </data>
  • trunk/sources/HeuristicLab.Hive.Server.Core/UserRoleManager.cs

    r907 r929  
    1717
    1818    IUserAdapter userAdapter;
    19     ResourceManager rm;
    2019
    2120    public UserRoleManager() {
    2221      userAdapter = ServiceLocator.GetUserAdapter();
    23       rm = new ResourceManager("HiveServerMessages.resx", Assembly.GetExecutingAssembly());
    2422
    2523      users = new List<User>();
     
    3028      users.Add(new User { PermissionOwnerId = 3, Name = "Greg", Password = "greg" });
    3129
    32       userGroups.Add(new UserGroup { UserGroupId = 1 });
    33       userGroups.Add(new UserGroup { UserGroupId = 2 });
     30      userGroups.Add(new UserGroup { PermissionOwnerId = 4 });
     31      userGroups.Add(new UserGroup { PermissionOwnerId = 5 });
    3432    }
    3533
     
    7977      response.Success = true;
    8078      response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_USER_REMOVED;
    81 
     79                         
    8280      return response;
    8381    }
Note: See TracChangeset for help on using the changeset viewer.