Exemplo n.º 1
0
        /// <summary>
        /// event handler that gets called when the save user button is clicked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnSaveButton_Click(object source, EventArgs e)
        {
            Hashtable ServerProvisioningNamesNew = new Hashtable();

            foreach (string userid in ServerProvisioningNames.Keys)
            {
                int preference = GetRightsForUser(userid);
                if (preference == -1)
                {
                    preference = 0xffff;
                }
                UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);
                if (rights.ProvisioningAllowed)
                {
                    ServerProvisioningNamesNew.Add(userid, ServerProvisioningNames[userid]);
                }
            }
            ServerProvisioningNames = ServerProvisioningNamesNew;
            String [] ServerNames = new string [ServerProvisioningNames.Keys.Count];
            String [] UserIDs     = new string [ServerProvisioningNames.Keys.Count];
            ServerProvisioningNames.Keys.CopyTo(UserIDs, 0);
            ServerProvisioningNames.Values.CopyTo(ServerNames, 0);

            iFolderAdmin remoteweb = new iFolderAdmin();

            iFolderServer[] list = web.GetServers();

            foreach (iFolderServer server in list)
            {
                if (server.IsMaster)
                {
                    remoteweb.PreAuthenticate = true;
                    remoteweb.Credentials     = web.Credentials;
                    remoteweb.Url             = server.PublicUrl + "/iFolderAdmin.asmx";
                    remoteweb.GetAuthenticatedUser();
                    remoteweb.ProvisionUsersToServers(ServerNames, UserIDs);
                    break;
                }
            }

            /// clear the hastable
            ServerProvisioningNames.Clear();

            SaveButton.Enabled = false;

            /// Display the page with new values
            Accounts.DataSource = CreateDataSource();
            Accounts.DataBind();
            AllUsersCheckBox.Checked = false;
            SetPageButtonState();
            GetSelectedItem();
        }
Exemplo n.º 2
0
        /// <summary>
        /// event handler that gets called when the provision user button is clicked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnProvisionButton_Click(object source, EventArgs e)
        {
            string uplist = "";
            string plist  = "";

            foreach (string userid in CheckedUsers.Keys)
            {
                int preference = GetRightsForUser(userid);
                if (preference == -1)
                {
                    preference = 0xffff;
                }
                UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);
                if (!rights.ProvisioningAllowed)
                {
                    continue;
                }

                iFolderUser ProvisionedUser = web.GetUser(userid);
                if (ProvisionedUser.HomeServer == null || ProvisionedUser.HomeServer == String.Empty || ProvisionedUser.HomeServer == "")
                {
                    uplist += userid;
                    uplist += ":";
                }
                else
                {
                    plist += userid;
                    plist += ":";
                    plist += ProvisionedUser.HomeServer;
                    plist += ":";
                }
            }

            /// clear the hastable
            ServerProvisioningNames.Clear();
            if ((uplist == null || uplist == string.Empty) && (plist == null || plist == string.Empty))
            {
                string errormessage = GetString("ERRORACCESSEXCEPTION");
                TopNav.ShowError(errormessage);
                return;
            }

            /// call the next page to provision the users
            Response.Redirect(String.Format("ProvisionUsers.aspx?&userlist={0}&puserlist={1}", uplist, plist));
        }