Free cookie consent management tool by TermsFeed Policy Generator

Changeset 945


Ignore:
Timestamp:
12/10/08 14:52:04 (16 years ago)
Author:
msteinbi
Message:

Implementation of UserRoleManager (#417)

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Contracts/ApplicationConstants.cs

    r942 r945  
    2929    public static string RESPONSE_CLIENT_RESOURCE_REMOVED = "Client.ResourceRemoved";
    3030    public static string RESPONSE_CLIENT_RESOURCE_NOT_FOUND = "Client.ResourceNotFound";
     31    public static string RESPONSE_CLIENT_PERMISSIONOWNER_DOESNT_EXIST = "Client.PermissionOwnerDoesntExist";
    3132
    3233    public static string RESPONSE_COMMUNICATOR_HARDBEAT_RECEIVED = "Communicator.HeardbeatReceived";
  • trunk/sources/HeuristicLab.Hive.Contracts/Interfaces/IUserRoleManager.cs

    r934 r945  
    2525    ResponseList<UserGroup> GetAllUserGroups();
    2626    [OperationContract]
    27     Response AddPermissionOwnerToGroup(long groupId, PermissionOwner permissionOwner);
     27    Response AddUserToGroup(long groupId, long userId);
     28    [OperationContract]
     29    Response AddUserGroupToGroup(long groupId, long groupToAddId);
    2830    [OperationContract]
    2931    Response RemovePermissionOwnerFromGroup(long groupId, long userId);
  • trunk/sources/HeuristicLab.Hive.Server.Core/ServerConsoleFacade.cs

    r934 r945  
    9696    }
    9797
    98     public Response AddPermissionOwnerToGroup(long groupId, PermissionOwner permissionOwner) {
    99       return userRoleManager.AddPermissionOwnerToGroup(groupId, permissionOwner);
     98    public Response AddUserToGroup(long groupId, long userId) {
     99      return userRoleManager.AddUserToGroup(groupId, userId);
     100    }
     101
     102    public Response AddUserGroupToGroup(long groupId, long groupToAddId) {
     103      return userRoleManager.AddUserGroupToGroup(groupId, groupToAddId);
    100104    }
    101105
  • trunk/sources/HeuristicLab.Hive.Server.Core/UserRoleManager.cs

    r942 r945  
    1515    IUserAdapter userAdapter;
    1616    IUserGroupAdapter userGroupAdapter;
     17    IPermissionOwnerAdapter permissionOwnerAdapter;
    1718
    1819    public UserRoleManager() {
     
    105106    }
    106107
    107     public Response AddPermissionOwnerToGroup(long groupId, PermissionOwner permissionOwner) {
     108    public Response AddUserToGroup(long groupId, long userId) {
    108109      Response response = new Response();
    109110
    110       if (permissionOwner.PermissionOwnerId != 0) {
     111      User user = userAdapter.GetUserById(userId);
     112      if (user == null) {
    111113        response.Success = false;
    112         response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_ID_MUST_NOT_BE_SET;
     114        response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_USER_DOESNT_EXIST;
    113115        return response;
    114116      }
     
    120122        return response;
    121123      }
    122       userGroup.Members.Add(permissionOwner);
     124      userGroup.Members.Add(user);
    123125      userGroupAdapter.UpdateUserGroup(userGroup);
    124126
    125127      response.Success = true;
    126128      response.StatusMessage = ApplicationConstants.RESPONSE_USERROLE_PERMISSIONOWNER_ADDED;
     129
     130      return response;
     131    }
     132
     133    public Response AddUserGroupToGroup(long groupId, long groupToAddId) {
     134      Response response = new Response();
    127135
    128136      return response;
Note: See TracChangeset for help on using the changeset viewer.