Ejemplo n.º 1
0
 public void LogoutDomain(string domainID)
 {
     DomainAuthentication domainAuth =
     new DomainAuthentication(
      "iFolder",
      domainID,
      null);
        domainAuth.Logout(simiasManager.WebServiceUri, simiasManager.DataPath);
        try
        {
     DomainInformation dom =
      simws.GetDomainInformation(domainID);
     if (dom != null)
     {
      dom.Authenticated = false;
      ClearDomainPassPhrase(domainID);
      if (keyedDomains.Contains(dom.ID))
       keyedDomains[dom.ID] = dom;
      else
      {
       AddDomainToHashtable(dom);
       if (DomainAdded != null)
       {
        DomainAddedIdleHandler addedHandler =
     new DomainAddedIdleHandler(domainID, this);
        GLib.Idle.Add(addedHandler.IdleHandler);
       }
      }
     }
        }
        catch{}
        if (DomainLoggedOut != null)
     DomainLoggedOut(this, new DomainEventArgs(domainID));
 }
Ejemplo n.º 2
0
 private void OnDomainAddedEvent(object o, DomainEventArgs args)
 {
     lock (typeof(DomainController) )
        {
     if (args == null || args.DomainID == null)
      return;
     DomainInformation domain = (DomainInformation)keyedDomains[args.DomainID];
     if (domain != null)
     {
      return;
     }
     try
     {
      domain = simws.GetDomainInformation(args.DomainID);
     }
     catch (Exception)
     {
      Debug.PrintLine("Ramesh: Got an exception");
      return;
     }
     if( domain == null)
     {
      Debug.PrintLine("Ramesh: Domain is null");
     }
     AddDomainToHashtable(domain);
     if (DomainAdded != null)
     {
      DomainAddedIdleHandler addedHandler =
       new DomainAddedIdleHandler(args.DomainID, this);
      GLib.Idle.Add(addedHandler.IdleHandler);
     }
        }
 }
Ejemplo n.º 3
0
 public DomainInformation AddDomain(string host, string username, string password, bool bSavePassword, bool bSetAsDefault)
 {
     DomainInformation dom = null;
        SetHttpProxyForHost(host);
        try
        {
     dom = simws.ConnectToDomain(username, password, host);
     if (dom != null &&
      (dom.StatusCode == StatusCodes.Success ||
       dom.StatusCode == StatusCodes.SuccessInGrace))
     {
      AddDomainToHashtable(dom);
      if (bSetAsDefault)
      {
       try
       {
        simws.SetDefaultDomain(dom.ID);
        dom.IsDefault = true;
        string oldDomainID = null;
        if (defDomainID != null && defDomainID != dom.ID)
        {
     oldDomainID = defDomainID;
     lock (typeof(DomainController))
     {
      DomainInformation oldDefaultDomain = (DomainInformation)keyedDomains[oldDomainID];
      if (oldDefaultDomain != null)
       oldDefaultDomain.IsDefault = false;
     }
        }
        defDomainID = dom.ID;
        if (NewDefaultDomain != null)
     NewDefaultDomain(this, new NewDefaultDomainEventArgs(oldDomainID, defDomainID));
       }
       catch {}
      }
      if (DomainAdded != null)
      {
       DomainAddedIdleHandler addedHandler =
        new DomainAddedIdleHandler(dom.ID, this);
       GLib.Idle.Add(addedHandler.IdleHandler);
      }
     }
        }
        catch (Exception e)
        {
     if (e.Message.IndexOf("Simias.ExistsException") != -1 ||
      e.Message.IndexOf("already exists") != -1)
     {
      throw new DomainAccountAlreadyExistsException("An account with this domain already exists");
     }
     else
     {
      throw e;
     }
        }
        return dom;
 }
Ejemplo n.º 4
0
 private Status HandleDomainLoggedIn(string domainID, Status status)
 {
     DomainController.upgradeStatus = status;
        Debug.PrintLine("In handledoaminloggedin");
        try
        {
     DomainInformation dom =
      simws.GetDomainInformation(domainID);
     if (dom != null)
     {
      dom.Authenticated = true;
      if (keyedDomains.Contains(dom.ID))
       keyedDomains[dom.ID] = dom;
      else
      {
       AddDomainToHashtable(dom);
       if (DomainAdded != null)
       {
        DomainAddedIdleHandler addedHandler =
     new DomainAddedIdleHandler(domainID, this);
        GLib.Idle.Add(addedHandler.IdleHandler);
       }
      }
     }
        }
        catch{}
        if (DomainLoggedIn != null)
     DomainLoggedIn(this, new DomainEventArgs(domainID));
        if (status.statusCode == StatusCodes.SuccessInGrace)
        {
     if (status.RemainingGraceLogins < status.TotalGraceLogins)
     {
      if (DomainInGraceLoginPeriod != null)
      {
       DomainInGraceLoginPeriodEventArgs graceEventArgs =
        new DomainInGraceLoginPeriodEventArgs(
     domainID,
     status.RemainingGraceLogins);
       DomainInGraceLoginPeriod(this, graceEventArgs);
      }
     }
        }
        CheckForUpdate(domainID);
        return DomainController.upgradeStatus;
 }