Пример #1
0
        /// <summary>
        /// Event handler for Add User
        /// </summary>
        private void OnAddUser(object o, EventArgs args)
        {
            bool SharingIsDisabled = ifws.GetDisableSharingPolicy(ifolder.CurrentUserID, ifolder.ID, ifolder.OwnerID, ifolder.DomainID);

            if (SharingIsDisabled == true)
            {
                UserSelector = new iFolderUserSelector(topLevelWindow,
                                                       simws,
                                                       ifolder.DomainID);
                if (!Util.RegisterModalWindow(UserSelector))
                {
                    try
                    {
                        Util.CurrentModalWindow.Present();
                    }
                    catch {}
                    UserSelector.Destroy();
                    return;
                }

                UserSelector.Response +=
                    new ResponseHandler(OnUserSelectorResponse);

                UserSelector.ShowAll();
            }
            else
            {
                iFolderMsgDialog dialog = new iFolderMsgDialog(
                    null,
                    iFolderMsgDialog.DialogType.Info,
                    iFolderMsgDialog.ButtonSet.Ok,
                    Util.GS("Policy Violation"),
                    Util.GS("Sharing is disabled so this iFolder can not be shared."), Util.GS(" "));
                dialog.Run();
                dialog.Hide();
                dialog.Destroy();
                return;
            }
        }
 private void OnUserSelectorResponse(object o, ResponseArgs args)
 {
     if(UserSelector != null)
        {
     switch(args.ResponseId)
     {
      case Gtk.ResponseType.Ok:
      {
       foreach(MemberInfo member in UserSelector.SelectedUsers)
       {
        if(!curUsers.ContainsKey(member.UserID))
        {
     try
     {
     iFolderUser newUser =
      ifws.AddAndInviteUser(
       ifolder.ID,
       member.Name,
       member.GivenName,
       member.FamilyName,
       member.UserID,
       null,
       "ReadWrite" );
      TreeIter iter =
       UserTreeStore.AppendValues(newUser);
      if (memberFullNames.Contains(newUser.FN))
      {
       duplicateMembers[newUser.FN] = 0;
      }
      else
       memberFullNames[newUser.FN] = 0;
      curUsers.Add(newUser.UserID, iter);
     }
     catch(Exception e)
     {
      iFolderExceptionDialog ied =
        new iFolderExceptionDialog(
      topLevelWindow, e);
      ied.Run();
      ied.Hide();
      ied.Destroy();
      ied = null;
      break;
     }
        }
       }
       UserSelector.Hide();
       UserSelector.Destroy();
       UserSelector = null;
       break;
      }
      case Gtk.ResponseType.Help:
      {
       Util.ShowHelp("sharewith.html#bq6lwm0", topLevelWindow);
       break;
      }
      case Gtk.ResponseType.Cancel:
      {
       UserSelector.Hide();
       UserSelector.Destroy();
       UserSelector = null;
       break;
      }
     }
        }
 }
 private void OnAddUser(object o, EventArgs args)
 {
     UserSelector = new iFolderUserSelector( topLevelWindow,
      simws,
      ifolder.DomainID);
        UserSelector.Response +=
       new ResponseHandler(OnUserSelectorResponse);
        UserSelector.ShowAll();
 }
 private void OnAddUser(object o, EventArgs args)
 {
     bool SharingIsDisabled = ifws.GetDisableSharingPolicy(ifolder.CurrentUserID, ifolder.ID, ifolder.OwnerID, ifolder.DomainID);
        if( SharingIsDisabled == true)
        {
     UserSelector = new iFolderUserSelector( topLevelWindow,
       simws,
       ifolder.DomainID);
     if (!Util.RegisterModalWindow(UserSelector))
     {
      try
      {
       Util.CurrentModalWindow.Present();
      }
      catch{}
      UserSelector.Destroy();
      return;
     }
     UserSelector.Response +=
        new ResponseHandler(OnUserSelectorResponse);
     UserSelector.ShowAll();
        }
        else
        {
     iFolderMsgDialog dialog = new iFolderMsgDialog(
      null,
      iFolderMsgDialog.DialogType.Info,
       iFolderMsgDialog.ButtonSet.Ok,
       Util.GS("Policy Violation"),
      Util.GS("Sharing is disabled so this iFolder can not be shared."),Util.GS(" "));
     dialog.Run();
     dialog.Hide();
     dialog.Destroy();
     return;
        }
 }
Пример #5
0
        private void OnUserSelectorResponse(object o, ResponseArgs args)
        {
            if (UserSelector != null)
            {
                switch (args.ResponseId)
                {
                case Gtk.ResponseType.Ok:
                {
                    foreach (MemberInfo member in UserSelector.SelectedUsers)
                    {
                        if (!curUsers.ContainsKey(member.UserID))
                        {
                            try
                            {
                                /*
                                 * try
                                 * {
                                 *      // Add the member to the domain.  If the member is
                                 *      // already a member of the domain, the call will do
                                 *      // nothing.  This call will facilitate the local
                                 *      // workstation not adding every possible domain user
                                 *      // to the local workstatin until they've actually
                                 *      // been added as an iFolder member.
                                 *      simws.AddMemberToDomain(ifolder.DomainID,
                                 *                                                      member.Name,
                                 *                                                      member.UserID,
                                 *                                                      null,	// FIXME: Where should I get the PublicKey?
                                 *                                                      member.GivenName,
                                 *                                                      member.FamilyName);
                                 * }
                                 * catch {}
                                 */

                                iFolderUser newUser =
                                    ifws.AddAndInviteUser(
                                        ifolder.ID,
                                        member.Name,
                                        member.GivenName,
                                        member.FamilyName,
                                        member.UserID,
                                        null,
                                        "ReadOnly");

                                TreeIter iter =
                                    UserTreeStore.AppendValues(newUser);

                                if (memberFullNames.Contains(newUser.FN))
                                {
                                    // This is a duplicate
                                    duplicateMembers[newUser.FN] = 0;
                                }
                                else
                                {
                                    memberFullNames[newUser.FN] = 0;
                                }

                                curUsers.Add(newUser.UserID, iter);
                            }
                            catch (Exception e)
                            {
                                iFolderExceptionDialog ied =
                                    new iFolderExceptionDialog(
                                        topLevelWindow, e);
                                ied.Run();
                                ied.Hide();
                                ied.Destroy();
                                ied = null;
                                break;
                            }
                        }
                    }
                    UserSelector.Hide();
                    UserSelector.Destroy();
                    UserSelector = null;
                    break;
                }

                case Gtk.ResponseType.Help:
                {
                    Util.ShowHelp("sharewith.html", topLevelWindow);
                    break;
                }

                case Gtk.ResponseType.Cancel:
                {
                    UserSelector.Hide();
                    UserSelector.Destroy();
                    UserSelector = null;
                    break;
                }
                }
            }
        }