Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7249


Ignore:
Timestamp:
12/30/11 18:02:41 (13 years ago)
Author:
ascheibe
Message:

#1725

  • added a dialog which displays information for anonymous hive users
  • HiveServiceLocator now checks if the username is anonymous and throws an exception if that's the case
Location:
trunk/sources
Files:
5 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ResourcesView.cs

    r7146 r7249  
    363363        MessageBox.Show("A Message Security error has occured. This normally means that your user name or password is wrong.", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
    364364      }
     365      catch (AnonymousUserException) {
     366        HiveInformationDialog dialog = new HiveInformationDialog();
     367        dialog.ShowDialog(this);
     368      }
    365369    }
    366370
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveJobManagerView.cs

    r6976 r7249  
    2424using System.ServiceModel.Security;
    2525using System.Windows.Forms;
     26using HeuristicLab.Clients.Hive.Views;
    2627using HeuristicLab.Collections;
    2728using HeuristicLab.MainForm;
     
    107108    private void HandleServiceException(Exception ex) {
    108109      if (ex is MessageSecurityException) {
    109         MessageBox.Show("A Message Security error has occured. This normally means that your user name or password is wrong.", "HeuristicLab Hive Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
     110        MessageBox.Show("A Message Security error has occured. This normally means that your user name or password is wrong.", "HeuristicLab Hive Job Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
     111      } else if (ex is AnonymousUserException) {
     112        HiveInformationDialog dialog = new HiveInformationDialog();
     113        dialog.ShowDialog(this);
    110114      } else {
    111115        ErrorHandling.ShowErrorDialog(this, "Refresh failed.", ex);
  • trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HeuristicLab.Clients.Hive.Views-3.3.csproj

    r6977 r7249  
    9595  </ItemGroup>
    9696  <ItemGroup>
     97    <Compile Include="HiveInformationDialog.cs">
     98      <SubType>Form</SubType>
     99    </Compile>
     100    <Compile Include="HiveInformationDialog.Designer.cs">
     101      <DependentUpon>HiveInformationDialog.cs</DependentUpon>
     102    </Compile>
    97103    <Compile Include="HiveTasks\OptimizerHiveTaskView.cs">
    98104      <SubType>UserControl</SubType>
     
    183189  </ItemGroup>
    184190  <ItemGroup>
     191    <EmbeddedResource Include="HiveInformationDialog.resx">
     192      <DependentUpon>HiveInformationDialog.cs</DependentUpon>
     193    </EmbeddedResource>
    185194    <EmbeddedResource Include="HiveTasks\OptimizerHiveTaskView.resx">
    186195      <DependentUpon>OptimizerHiveTaskView.cs</DependentUpon>
     
    294303      <Private>False</Private>
    295304    </ProjectReference>
     305  </ItemGroup>
     306  <ItemGroup>
     307    <None Include="Images\109_AllAnnotations_Info_48x48_72.png" />
    296308  </ItemGroup>
    297309  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveImageLibrary.Designer.cs

    r6976 r7249  
    6161        }
    6262       
     63        public static System.Drawing.Bitmap Information {
     64            get {
     65                object obj = ResourceManager.GetObject("Information", resourceCulture);
     66                return ((System.Drawing.Bitmap)(obj));
     67            }
     68        }
     69       
    6370        public static System.Drawing.Icon Slave {
    6471            get {
  • trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/HiveImageLibrary.resx

    r6976 r7249  
    119119  </resheader>
    120120  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     121  <data name="Information" type="System.Resources.ResXFileRef, System.Windows.Forms">
     122    <value>Images\109_AllAnnotations_Info_48x48_72.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     123  </data>
    121124  <data name="Slave" type="System.Resources.ResXFileRef, System.Windows.Forms">
    122125    <value>Images\Monitor.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HeuristicLab.Clients.Hive-3.3.csproj

    r7219 r7249  
    116116  </ItemGroup>
    117117  <ItemGroup>
     118    <Compile Include="Exceptions\AnonymousUserException.cs" />
    118119    <Compile Include="HiveAdminClient.cs" />
    119120    <Compile Include="HiveClient.cs" />
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/HiveServiceLocator.cs

    r7142 r7249  
    5959    public T CallHiveService<T>(Func<IHiveService, T> call) {
    6060      HiveServiceClient client = NewServiceClient();
     61      HandleAnonymousUser(client);
     62
    6163      try {
    6264        return call(client);
    63       } finally {
     65      }
     66      finally {
    6467        try {
    6568          client.Close();
     
    7376    public void CallHiveService(Action<IHiveService> call) {
    7477      HiveServiceClient client = NewServiceClient();
     78      HandleAnonymousUser(client);
     79
    7580      try {
    7681        call(client);
    77       } finally {
     82      }
     83      finally {
    7884        try {
    7985          client.Close();
     
    8490      }
    8591    }
     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    }
    86104  }
    87105}
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.Designer.cs

    r7132 r7249  
    6868            }
    6969        }
     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        }
    7079    }
    7180}
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/Settings.settings

    r7132 r7249  
    1818      <Value Profile="(Default)">5</Value>
    1919    </Setting>
     20    <Setting Name="AnonymousUserName" Type="System.String" Scope="Application">
     21      <Value Profile="(Default)">anonymous</Value>
     22    </Setting>
    2023  </Settings>
    2124</SettingsFile>
  • trunk/sources/HeuristicLab.Clients.Hive/3.3/app.config

    r7132 r7249  
    2222      <setting name="MaxRepeatServiceCalls" serializeAs="String">
    2323        <value>5</value>
     24      </setting>
     25      <setting name="AnonymousUserName" serializeAs="String">
     26        <value>anonymous</value>
    2427      </setting>
    2528    </HeuristicLab.Clients.Hive.Settings>
Note: See TracChangeset for help on using the changeset viewer.