Changeset 7249 for trunk/sources/HeuristicLab.Clients.Hive
- Timestamp:
- 12/30/11 18:02:41 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Clients.Hive/3.3
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj
r7219 r7249 116 116 </ItemGroup> 117 117 <ItemGroup> 118 <Compile Include="Exceptions\AnonymousUserException.cs" /> 118 119 <Compile Include="HiveAdminClient.cs" /> 119 120 <Compile Include="HiveClient.cs" /> -
trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs
r7142 r7249 59 59 public T CallHiveService<T>(Func<IHiveService, T> call) { 60 60 HiveServiceClient client = NewServiceClient(); 61 HandleAnonymousUser(client); 62 61 63 try { 62 64 return call(client); 63 } finally { 65 } 66 finally { 64 67 try { 65 68 client.Close(); … … 73 76 public void CallHiveService(Action<IHiveService> call) { 74 77 HiveServiceClient client = NewServiceClient(); 78 HandleAnonymousUser(client); 79 75 80 try { 76 81 call(client); 77 } finally { 82 } 83 finally { 78 84 try { 79 85 client.Close(); … … 84 90 } 85 91 } 92 93 private void HandleAnonymousUser(HiveServiceClient client) { 94 if (client.ClientCredentials.UserName.UserName == Settings.Default.AnonymousUserName) { 95 try { 96 client.Close(); 97 } 98 catch (Exception) { 99 client.Abort(); 100 } 101 throw new AnonymousUserException(); 102 } 103 } 86 104 } 87 105 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.Designer.cs
r7132 r7249 68 68 } 69 69 } 70 71 [global::System.Configuration.ApplicationScopedSettingAttribute()] 72 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 73 [global::System.Configuration.DefaultSettingValueAttribute("anonymous")] 74 public string AnonymousUserName { 75 get { 76 return ((string)(this["AnonymousUserName"])); 77 } 78 } 70 79 } 71 80 } -
trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.settings
r7132 r7249 18 18 <Value Profile="(Default)">5</Value> 19 19 </Setting> 20 <Setting Name="AnonymousUserName" Type="System.String" Scope="Application"> 21 <Value Profile="(Default)">anonymous</Value> 22 </Setting> 20 23 </Settings> 21 24 </SettingsFile> -
trunk/sources/HeuristicLab.Clients.Hive/3.3/app.config
r7132 r7249 22 22 <setting name="MaxRepeatServiceCalls" serializeAs="String"> 23 23 <value>5</value> 24 </setting> 25 <setting name="AnonymousUserName" serializeAs="String"> 26 <value>anonymous</value> 24 27 </setting> 25 28 </HeuristicLab.Clients.Hive.Settings>
Note: See TracChangeset
for help on using the changeset viewer.