Changeset 7553
- Timestamp:
- 03/05/12 22:29:59 (13 years ago)
- Location:
- branches/ClientUserManagement
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientInformation.cs
r7536 r7553 54 54 55 55 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(); 57 71 } 58 72 -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/ClientInformationUtils.cs
r7536 r7553 61 61 FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location); 62 62 return versionInfo.FileVersion; 63 } 64 65 public static bool IsClientHeuristicLab() { 66 return Process.GetCurrentProcess().ProcessName == Settings.Default.HLExeName; 63 67 } 64 68 -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/HeuristicLab.Clients.Access-3.3.csproj
r7536 r7553 138 138 <Compile Include="ServiceClients\UserGroup.cs" /> 139 139 <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> 140 145 <Compile Include="UserInformation.cs" /> 141 146 <Compile Include="Views\LightweightUserGroupSelectionDialog.cs"> … … 178 183 <None Include="Properties\AssemblyInfo.cs.frame" /> 179 184 <None Include="ServiceClients\GenerateServiceClients.cmd" /> 185 <None Include="Settings.settings"> 186 <Generator>SettingsSingleFileGenerator</Generator> 187 <LastGenOutput>Settings.Designer.cs</LastGenOutput> 188 </None> 180 189 <None Include="UpdateLocalInstallation.cmd" /> 181 190 </ItemGroup> -
branches/ClientUserManagement/HeuristicLab.Clients.Access/3.3/UserInformation.cs
r7536 r7553 23 23 using System.Collections.Generic; 24 24 using System.ServiceModel.Security; 25 using HeuristicLab.Clients.Common.Properties;26 25 27 26 namespace HeuristicLab.Clients.Access { … … 80 79 81 80 private void FetchUserInformationFromServer() { 82 userName = Settings.Default.UserName;81 userName = HeuristicLab.Clients.Common.Properties.Settings.Default.UserName; 83 82 84 83 try { -
branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs
r7536 r7553 663 663 #region UserGroupBase 664 664 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) { 665 691 List<DA.UserGroupBase> dbUserGroupsBases = new List<DA.UserGroupBase>(); 666 692 List<DT.UserGroupBase> result = new List<DT.UserGroupBase>(); … … 668 694 using (DA.ClientManagementDataContext context = new DA.ClientManagementDataContext()) { 669 695 var query = from u in context.UserGroupBases 696 where ids.Contains(u.Id) 670 697 select u; 671 698 dbUserGroupsBases = query.ToList(); … … 683 710 return result; 684 711 } 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.UserGroupBases692 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 }708 712 #endregion 709 713
Note: See TracChangeset
for help on using the changeset viewer.