Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/30/11 18:02:41 (12 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.