Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7553


Ignore:
Timestamp:
03/05/12 22:29:59 (13 years ago)
Author:
ascheibe
Message:

#1648 adapted client management for use with Hive

Location:
branches/ClientUserManagement
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientInformation.cs

    r7536 r7553  
    5454
    5555    private ClientInformation() {
    56       FetchClientInformationFromServer();
     56      if (ClientInformationUtils.IsClientHeuristicLab()) {
     57        FetchClientInformationFromServer();
     58      } else {
     59        // this means we are executed by an Hive slave, therefore we just get our machine id (e.g. for OKB Algs)
     60        // because the slave has already done the registration process
     61        GenerateLocalClientConfig();
     62      }
     63    }
     64
     65    private void GenerateLocalClientConfig() {
     66      clientExists = true;
     67      errorOccured = false;
     68      occuredException = null;
     69      clientInfo = new Client();
     70      clientInfo.Id = ClientInformationUtils.GetUniqueMachineId();
    5771    }
    5872
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientInformationUtils.cs

    r7536 r7553  
    6161      FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
    6262      return versionInfo.FileVersion;
     63    }
     64
     65    public static bool IsClientHeuristicLab() {
     66      return Process.GetCurrentProcess().ProcessName == Settings.Default.HLExeName;
    6367    }
    6468
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/HeuristicLab.Clients.Access-3.3.csproj

    r7536 r7553  
    138138    <Compile Include="ServiceClients\UserGroup.cs" />
    139139    <Compile Include="ServiceClients\UserGroupBase.cs" />
     140    <Compile Include="Settings.Designer.cs">
     141      <AutoGen>True</AutoGen>
     142      <DesignTimeSharedInput>True</DesignTimeSharedInput>
     143      <DependentUpon>Settings.settings</DependentUpon>
     144    </Compile>
    140145    <Compile Include="UserInformation.cs" />
    141146    <Compile Include="Views\LightweightUserGroupSelectionDialog.cs">
     
    178183    <None Include="Properties\AssemblyInfo.cs.frame" />
    179184    <None Include="ServiceClients\GenerateServiceClients.cmd" />
     185    <None Include="Settings.settings">
     186      <Generator>SettingsSingleFileGenerator</Generator>
     187      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     188    </None>
    180189    <None Include="UpdateLocalInstallation.cmd" />
    181190  </ItemGroup>
  • branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/UserInformation.cs

    r7536 r7553  
    2323using System.Collections.Generic;
    2424using System.ServiceModel.Security;
    25 using HeuristicLab.Clients.Common.Properties;
    2625
    2726namespace HeuristicLab.Clients.Access {
     
    8079
    8180    private void FetchUserInformationFromServer() {
    82       userName = Settings.Default.UserName;
     81      userName = HeuristicLab.Clients.Common.Properties.Settings.Default.UserName;
    8382
    8483      try {
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r7536 r7553  
    663663    #region UserGroupBase
    664664    public IEnumerable<DT.UserGroupBase> GetAllLeightweightUsersAndGroups() {
     665      //TODO: it must be possible to include a role so not all users are returned but only the ones who are allowed to use a certain service
     666      List<DT.UserGroup> userGroups = new List<DT.UserGroup>();
     667      List<DT.UserGroupBase> result = new List<DT.UserGroupBase>();
     668
     669      // this is just for generating users from asp.net authenticaton db; we should maybe provide an updatescript instead
     670      List<Guid> accessUserGuids = null;
     671      using (DA.ASPNETAuthenticationDataContext context = new DA.ASPNETAuthenticationDataContext()) {
     672        var query = from u in context.aspnet_Users
     673                    select u.UserId;
     674        accessUserGuids = query.ToList();
     675      }
     676      var lightweightUsers = accessUserGuids.Select(x => BuildLightweightUserDto(x));
     677
     678      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
     679        var query = from u in context.UserGroupBases.OfType<DA.UserGroup>()
     680                    select Convert.ToDto(u);
     681        userGroups = query.ToList();
     682      }
     683
     684      result.AddRange(lightweightUsers);
     685      result.AddRange(userGroups);
     686
     687      return result;
     688    }
     689
     690    public IEnumerable<DT.UserGroupBase> GetLeightweightUsersAndGroups(IEnumerable<Guid> ids) {
    665691      List<DA.UserGroupBase> dbUserGroupsBases = new List<DA.UserGroupBase>();
    666692      List<DT.UserGroupBase> result = new List<DT.UserGroupBase>();
     
    668694      using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
    669695        var query = from u in context.UserGroupBases
     696                    where ids.Contains(u.Id)
    670697                    select u;
    671698        dbUserGroupsBases = query.ToList();
     
    683710      return result;
    684711    }
    685 
    686     public IEnumerable<DT.UserGroupBase> GetLeightweightUsersAndGroups(IEnumerable<Guid> ids) {
    687       List<DA.UserGroupBase> dbUserGroupsBases = new List<DA.UserGroupBase>();
    688       List<DT.UserGroupBase> result = new List<DT.UserGroupBase>();
    689 
    690       using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) {
    691         var query = from u in context.UserGroupBases
    692                     where ids.Contains(u.Id)
    693                     select u;
    694         dbUserGroupsBases = query.ToList();
    695       }
    696 
    697       foreach (var ugb in dbUserGroupsBases) {
    698         if (ugb.GetType() == typeof(DA.User)) {
    699           var user = BuildLightweightUserDto(ugb.Id);
    700           result.Add(user);
    701         } else if (ugb.GetType() == typeof(DA.UserGroup)) {
    702           var group = Convert.ToDto(ugb as DA.UserGroup);
    703           result.Add(group);
    704         }
    705       }
    706       return result;
    707     }
    708712    #endregion
    709713
Note: See TracChangeset for help on using the changeset viewer.