Esempio n. 1
0
        /// <summary>
        /// Page load event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                CancelButton.Text = GetString("CANCEL");

                // Initialize localized fields.
                HeaderTitle.Text = GetString("SELECTSERVER");
                OkButton.Text    = GetString("PROVISIONREPROVISION");
                OkButton.Enabled = false;

                string [] ServerList = GetServerList();
                SelectServerList.DataSource = ServerList;
                SelectServerList.DataBind();
                // Initialize state variables.
                CurrentUserOffset = 0;
                TotalUsers        = 0;
            }
            //TODO: Calculate size of string for localize string and set width of button with respect to it.
            OkButton.Width = 250;
        }
Esempio n. 2
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            if (userID != null && ServerID != null && ServerID != String.Empty)
            {
                sysAccessPolicy = web.GetUserSystemRights(userID, ServerID);
            }
            else
            {
                sysAccessPolicy = 0;
            }
            uRights = new UserSystemAdminRights(sysAccessPolicy);
            if (uRights.ServerPolicyManagementAllowed == false)
            {
                Page.Response.Redirect(String.Format("Error.aspx?ex={0}&Msg={1}", GetString("ACCESSDENIED"), GetString("ACCESSDENIEDERROR")));
            }

            if (!IsPostBack)
            {
                remoteweb = new iFolderAdmin();


                OkButton.Text     = GetString("OK");
                CancelButton.Text = GetString("CANCEL");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Page load event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                // Remember the page that we came from.
                string param = Request.Params["ref"];
                ReferringPage = ((param == null) || (param == String.Empty)) ?
                                Page.Request.UrlReferrer.ToString() : param;

                // Initialize the localized fields.
                CancelButton.Text     = GetString("CANCEL");
                NextButton.Text       = GetString("NEXT");
                NameLabel.Text        = GetString("NAMETAG");
                DescriptionLabel.Text = GetString("DESCRIPTIONTAG");

                // Initialize state variables.
                Name.Text        = iFolderName;
                Description.Text = iFolderDescription;
                SetFocus(Name);

                // If there is a name, enable the next button.
                if (Name.Text.Length > 0)
                {
                    NextButton.Enabled = true;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Page Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // localization
            rm = (ResourceManager)Application["RM"];

            // check connection
            iFolderAdmin web = (iFolderAdmin)Session["Connection"];

            if (web == null)
            {
                Logout(rm.GetString("MESSAGEINFORMATION"), rm.GetString("LOGINLOSTSESSION"));
            }

            if (!IsPostBack)
            {
                // username
                UserName.Text = Trim((string)Session["Name"], MAX_HEADER_STRING);

                // system name
                SystemName.Text = String.Format("{0} - {1}", Trim((string)Session["System"], MAX_HEADER_STRING),
                                                (string)Session["Version"]);

                // strings
                LogoutButton.Text = rm.GetString("LOGOUT");
                HelpButton.Text   = rm.GetString("HELP");

                // help
                HelpButton.NavigateUrl = String.Format("help/{0}/index.html",
                                                       Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            if (userID != null)
            {
                sysAccessPolicy = web.GetUserSystemRights(userID, null);
            }
            else
            {
                sysAccessPolicy = 0;
            }
            uRights = new UserSystemAdminRights(sysAccessPolicy);
            if (uRights.ServerPolicyManagementAllowed == false)
            {
                Page.Response.Redirect(String.Format("Error.aspx?ex={0}&Msg={1}", GetString("ACCESSDENIED"), GetString("ACCESSDENIEDERROR")));
            }

            if (!IsPostBack)
            {
                // Initialize the localized fields.

                // Initialize state variables.
                CurrentServerOffset = 0;
                TotalServers        = 0;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web        = Session["Connection"] as iFolderAdmin;
            currentURL = web.Url;
            remoteweb  = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = web.Url;

            iFolderServer[] list = web.GetServers();
            foreach (iFolderServer server in list)
            {
                if (server.IsMaster)
                {
                    MasterServerUrl = server.PublicUrl;
                    break;
                }
            }

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                PolicyApplyButton.Text  = GetString("SAVE");
                PolicyCancelButton.Text = GetString("CANCEL");

                // Set the policy buttons to disabled on page load.
                EnablePolicyButtons = false;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Gets the size of the specified file.
        /// </summary>
        /// <param name="web"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private long GetFileSize(iFolderAdmin web, string fileName)
        {
            long fileSize = 0;

            UriBuilder uri = new UriBuilder(web.Url);

            uri.Path = String.Format("/simias10/admindata/{0}?size=1", fileName);

            HttpWebRequest webRequest = WebRequest.Create(uri.Uri) as HttpWebRequest;

            webRequest.Method          = "GET";
            webRequest.PreAuthenticate = true;
            webRequest.Credentials     = web.Credentials;
            webRequest.CookieContainer = web.CookieContainer;

            HttpWebResponse webResponse = webRequest.GetResponse() as HttpWebResponse;

            try
            {
                StreamReader sr = new StreamReader(webResponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
                fileSize = Convert.ToInt64(sr.ReadLine());
            }
            finally
            {
                webResponse.Close();
            }

            return(fileSize);
        }
Esempio n. 8
0
        /// <summary>
        /// Page load event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web       = Session["Connection"] as iFolderAdmin;
            remoteweb = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = web.Url;

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                // Initialize localized fields.
                HeaderTitle.Text  = String.Format(GetString("SELECTIFOLDEROWNER"), iFolderName);
                BackButton.Text   = GetString("BACK");
                NextButton.Text   = GetString("NEXT");
                CancelButton.Text = GetString("CANCEL");

                // Remember the page that we came from.
                string param = Request.Params["ref"];
                ReferringPage = ((param == null) || (param == String.Empty)) ?
                                Page.Request.UrlReferrer.ToString() : param;

                // Initialize state variables.
                CurrentUserOffset = MemberListPage;
                TotalUsers        = 0;
            }
        }
Esempio n. 9
0
/*
 *              public bool PolicyChanged
 *              {
 *                      get
 *                      {
 *                              return Enabled.Checked;
 *                      }
 *              }
 */
        #endregion

        #region Private Methods

        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            web = Session["Connection"] as iFolderAdmin;
            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                EncryptionTitle.Text = GetString("ENCRYPTION");
                //SSLTitle.Text = "Secure Data Transfer";
//				EncryptionTag.Text = "Set Encryption";
//				Enabled.Checked = false;
                encryption.Text = rm.GetString("ON");
                //ssl.Text = "On";
                //		lbl_encryption.Text = "Encrypt";
                //		lbl_ssl.Text = "Use SSL";
                ssl.Visible            = enforceSSL.Visible = false;
                enforceEncryption.Text = rm.GetString("ENFORCED");
                //enforceSSL.Text = "Enforced";
                enforceEncryption.Enabled = enforceSSL.Enabled = false;
                encryption.Enabled        = ssl.Enabled = true;
                encryption.Checked        = enforceEncryption.Checked = false;
                //ssl.Checked = enforceSSL.Checked = false;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Page load event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;
            //string userID = Session[ "UserID" ] as String;

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                DisableButton.Text   = GetString("DISABLE");
                EnableButton.Text    = GetString("ENABLE");
                ProvisionButton.Text = GetString("PROVISION");
                SaveButton.Text      = GetString("SAVE");

                // Initialize state variables.
                CurrentUserOffset        = 0;
                TotalUsers               = 0;
                AllUsersCheckBox.Checked = false;
                CheckedUsers             = new Hashtable();
                ServerProvisioningNames  = new Hashtable();

                IdentityPolicy policy = web.GetIdentityPolicy();
                if (policy.CanCreate)
                {
                    CreateButton.Text    = GetString("CREATE");
                    CreateButton.Visible = true;
                }

                if (policy.CanDelete)
                {
                    DeleteButton.Text    = GetString("DELETE");
                    DeleteButton.Visible = true;
                }

                // Get the owner of the system.
                iFolder domain = web.GetiFolder(web.GetSystem().ID);
                SuperAdminID = domain.OwnerID;
            }

            // In ru/pl/hu as the PROVISION string is too long , increase the width for this language.
            string code = Thread.CurrentThread.CurrentUICulture.Name;

            if (code.StartsWith("ru") || code.StartsWith("hu"))
            {
                ProvisionButton.Width = 250;
            }
            else if (code.StartsWith("pl"))
            {
                ProvisionButton.Width = 180;
            }
            else if (code.StartsWith("pt") || code.StartsWith("de"))
            {
                DisableButton.Width = 120;
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL          = web.Url;
            remoteweb                 = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = web.Url;
            reachable                 = true;

            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            grpAccessPolicy = web.GetUserGroupRights(userID, null);
            uRights         = new UserGroupAdminRights(grpAccessPolicy);
            if (!IsPostBack)
            {
                // Initialize the localized fields.
                iFolderList.Columns[iFolderTypeColumn].HeaderText  = GetString("TYPE");
                iFolderList.Columns[iFolderNameColumn].HeaderText  = GetString("NAME");
                iFolderList.Columns[iFolderOwnerColumn].HeaderText = GetString("OWNER");

                //DeleteiFolderButton.Text = GetString( "DELETE" );
                DisableiFolderButton.Text = GetString("DISABLE");
                EnableiFolderButton.Text  = GetString("ENABLE");
                DeleteiFolderButton.Text  = GetString("DELETE");
                //CreateiFolderButton.Text = GetString( "CREATE" );

                AlliFoldersLink.Text    = GetString("ALL");
                OwnediFoldersLink.Text  = GetString("OWNED");
                SharediFoldersLink.Text = GetString("SHARED");

                // Initialize state variables.
                CurrentiFolderOffset        = 0;
                TotaliFolders               = 0;
                AlliFoldersCheckBox.Checked = false;
                CheckediFolders             = new Hashtable();

                // Set the active ifolder tab.
                ActiveiFolderTab = ListDisplayType.All;

                //CreateiFolderButton.Enabled = GetCreateButtonStatus();
            }

            // Set the active ifolder display tab.
            SetActiveiFolderListTab(ActiveiFolderTab);
            DeleteiFolderButton.Enabled = uRights.DeleteiFolderAllowed;

            if (uRights.EnableDisableiFolderAllowed == false)
            {
                AlliFoldersCheckBox.Enabled = false;
                //iFolderListCheckBox.Enabled = false;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL = web.Url;

            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            if (userID != null)
            {
                sysAccessPolicy = web.GetUserSystemRights(userID, null);
            }
            else
            {
                sysAccessPolicy = 0;
            }
            uRights = new UserSystemAdminRights(sysAccessPolicy);
            if (uRights.SystemPolicyManagementAllowed == false)
            {
                Page.Response.Redirect(String.Format("Error.aspx?ex={0}&Msg={1}", GetString("ACCESSDENIED"), GetString("ACCESSDENIEDERROR")));
            }

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                DeleteButton.Text = GetString("DELETE");
                EditButton.Text   = GetString("EDIT");
                AddButton.Text    = GetString("ADD");
                //AddSecButton.Text = GetString( "ADD" ) + " " + GetString( "SECONDARY" );
                ReprovisionStatusButton.Text = GetString("REPROVISIONBUTTON");
                SaveButton.Text        = GetString("SAVE");
                CancelButton.Text      = GetString("CANCEL");
                GroupSegregated.Text   = GetString("CREATESEGREGATEDGROUPS");
                PrimaryAdminsLink.Text = GetString("PRIMARY");
                GroupAdminsLink.Text   = GetString("SECONDARY");

                FullNameSetting.Items[0].Text       = "(" + GetString("FIRSTNAME") + ", " + GetString("LASTNAME") + ")";
                FullNameSetting.Items[1].Text       = "(" + GetString("LASTNAME") + ", " + GetString("FIRSTNAME") + ")";
                GroupQuotaRestriction.Items[0].Text = GetString("UIBASED");
                GroupQuotaRestriction.Items[1].Text = GetString("SYNCBASED");

                // Initialize state variables.
                CurrentAdminOffset        = 0;
                TotalAdmins               = 0;
                AllAdminsCheckBox.Checked = false;
                CheckedMembers            = new Hashtable();
                //select the active admin tab
                ActiveAdminTab     = ListDisplayType.PrimaryAdmins;
                EditButton.Visible = false;
                //AddSecButton.Visible = false;
            }
            SetActiveAdminListTab(ActiveAdminTab);
        }
Esempio n. 13
0
        /// <summary>
        /// Event handler for the ok button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OkButton_Clicked(Object sender, EventArgs e)
        {
            /// Extract the user list and server name
            string SelectedUserList = Request.QueryString.Get("UserList");

            string [] ListOfSelectedUsers = SelectedUserList.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            string    ServerName          = SelectServerList.SelectedValue;

            iFolderServer[] list = web.GetServers();
            remoteweb = new iFolderAdmin();

            if (ListOfSelectedUsers.Length > 0 && ListOfSelectedUsers[0] != null && ListOfSelectedUsers[0] != String.Empty && ListOfSelectedUsers[0] != "")
            {
                foreach (iFolderServer server in list)
                {
                    if (server.IsMaster)
                    {
                        remoteweb.PreAuthenticate = true;
                        remoteweb.Credentials     = web.Credentials;
                        remoteweb.Url             = server.PublicUrl + "/iFolderAdmin.asmx";
                        remoteweb.GetAuthenticatedUser();
                        remoteweb.ProvisionUsersToServer(ServerName, ListOfSelectedUsers);
                        break;
                    }
                }
            }

            string pSelectedUserList = Request.QueryString.Get("PUserList");

            string [] pListOfSelectedUsers = pSelectedUserList.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            for (int index = 0; (index < (pListOfSelectedUsers.Length - 1)); index++)
            {
                foreach (iFolderServer server in list)
                {
                    if (String.Compare(server.Name, pListOfSelectedUsers[index + 1]) == 0)
                    {
                        remoteweb.PreAuthenticate = true;
                        remoteweb.Credentials     = web.Credentials;
                        remoteweb.Url             = server.PublicUrl + "/iFolderAdmin.asmx";
                        remoteweb.GetAuthenticatedUser();
                        string SelectedUser = pListOfSelectedUsers[index++];
                        if (SelectedUser != null && SelectedUser != String.Empty && SelectedUser != "")
                        {
                            remoteweb.ReProvisionUsersToServer(ServerName, SelectedUser);
                            // break from inner forloop because one user is reprovisioned to one server, so go to next user.
                            break;
                        }
                    }
                }
            }


            string url = "Users.aspx";

            Page.Response.Redirect(url);
        }
Esempio n. 14
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();
        }
Esempio n. 15
0
        //private bool SharingOnChecked = false;

/*
 *              /// <summary>
 *              /// to keep track of encryption check box on page load
 *              /// </summary>
 *              protected bool EncryptionWasChecked;
 *
 *              /// <summary>
 *              /// to keep track whether sharing was enforced for this particular user earlier
 *              /// </summary>
 *              protected bool SharingWasEnforced;
 */

        #endregion

        #region Private Methods

        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            web = Session["Connection"] as iFolderAdmin;
            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                DisableSharingTitle.Text    = GetString("DISABLESHARING");
                disableSharingOn.Text       = GetString("ON");
                enforcedDisableSharing.Text = GetString("ENFORCE");
                disablePastSharing.Text     = GetString("DISABLEPASTSHARING");
                disableSharingOn.Checked    = enforcedDisableSharing.Checked = false;
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL = String.Copy(web.Url);
            reachable        = true;

            // localization
            rm = Application["RM"] as ResourceManager;
//			TopNav.ShowInfo(String.Format("URL: {0}", web.Url));

            userID          = Session["UserID"] as String;
            grpAccessPolicy = web.GetUserGroupRights(userID, null);
            uRights         = new UserGroupAdminRights(grpAccessPolicy);

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                DeleteButton.Text  = GetString("DELETE");
                DisableButton.Text = GetString("DISABLE");
                EnableButton.Text  = GetString("ENABLE");
                //CreateButton.Text = GetString( "CREATE" );

                AlliFoldersLink.Text      = GetString("ALL");
                OrphanediFoldersLink.Text = GetString("ORPHANED");

                // Initialize state variables.
                CurrentiFolderOffset        = 0;
                TotaliFolders               = 0;
                AlliFoldersCheckBox.Checked = false;
                CheckediFolders             = new Hashtable();

                //Set the active ifolder tab
                ActiveiFolderTab = ListDisplayType.All;
            }
            // Set the active ifolder display tab
            SetActiveiFolderListTab(ActiveiFolderTab);
            DeleteButton.Enabled = uRights.DeleteiFolderAllowed;

//			TopNav.ShowInfo(String.Format("URL: {0}", web.Url));
            string code = Thread.CurrentThread.CurrentUICulture.Name;

            if (code.StartsWith("pt") || code.StartsWith("de") || code.StartsWith("ru"))
            {
                DisableButton.Width = 120;
                EnableButton.Width  = 120;
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL = web.Url;

            remoteweb = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = web.Url;
            iFolderLocation           = null;

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                iFolderMemberList.Columns[3].HeaderText = GetString("TYPE");
                iFolderMemberList.Columns[4].HeaderText = GetString("NAME");
                iFolderMemberList.Columns[5].HeaderText = GetString("USERNAME");
                iFolderMemberList.Columns[6].HeaderText = GetString("RIGHTS");

                DescriptionButton.Text  = GetString("SAVE");
                AdoptButton.Text        = GetString("ADOPT");
                MemberDeleteButton.Text = GetString("DELETE");
                MemberAddButton.Text    = GetString("ADD");
                MemberOwnerButton.Text  = GetString("OWNER");
                MemberRightsButton.Text = GetString("SET");

                MemberRightsList.Items[0].Text = GetString("READONLY");
                MemberRightsList.Items[1].Text = GetString("READWRITE");
                MemberRightsList.Items[2].Text = GetString("FULLCONTROL");

                AdoptButtonClicked = false;

                // Initialize state variables.
                CurrentMemberOffset = 0;
                TotaliFolderMembers = 0;
                MembersChecked      = false;
                CheckedMembers      = new Hashtable();
            }
            /// Disable all the buttons...
            EnableMemberActionButtons = false;                          //MemberRightsChangeAllowed;
            EnableOwnerActionButton   = false;                          //MemberRightsChangeAllowed;
        }
Esempio n. 18
0
        /// <summary>
        /// Page Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                // data
                BindData();

                // strings
                OKButton.Text = GetString("OK");
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;
            string userID = Session["UserID"] as String;

            if (userID != null)
            {
                sysAccessPolicy = web.GetUserSystemRights(userID, null);
            }
            else
            {
                sysAccessPolicy = 0;
            }
            uRights = new UserSystemAdminRights(sysAccessPolicy);
            if (uRights.ReportsGenerationAllowed == false)
            {
                Page.Response.Redirect(String.Format("Error.aspx?ex={0}&Msg={1}", GetString("ACCESSDENIED"), GetString("ACCESSDENIEDERROR")));
            }

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                EnableReportingLabel.Text   = GetString("ENABLEREPORTING");
                FrequencyList.Items[0].Text = GetString("DAILY");
                FrequencyList.Items[1].Text = GetString("WEEKLY");
                FrequencyList.Items[2].Text = GetString("MONTHLY");

                ReportLocation.Items[0].Text = GetString("REPORTIFOLDER");
                ReportLocation.Items[1].Text = GetString("REPORTDIRECTORY");

                SaveReportConfig.Text   = GetString("SAVE");
                CancelReportConfig.Text = GetString("CANCEL");

                // Populate the dropdown lists.
                InitializeTimeOfDayList();
                InitializeDayOfWeekList();
                InitializeDayOfMonthList();
                InitializeReportFormat();
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL          = web.Url;
            remoteweb                 = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = web.Url;
            reachable                 = true;

            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            if (userID != null)
            {
                sysAccessPolicy = web.GetUserGroupRights(userID, null);
            }
            else
            {
                sysAccessPolicy = 0;
            }
            uRights = new UserSystemAdminRights(sysAccessPolicy);
            if (uRights.SystemPolicyManagementAllowed == false)
            {
                Page.Response.Redirect(String.Format("Error.aspx?ex={0}&Msg={1}", GetString("ACCESSDENIED"), GetString("ACCESSDENIEDERROR")));
            }

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                iFolderList.Columns[iFolderTypeColumn].HeaderText  = GetString("TYPE");
                iFolderList.Columns[iFolderNameColumn].HeaderText  = GetString("NAME");
                iFolderList.Columns[iFolderOwnerColumn].HeaderText = GetString("OWNER");

                // Initialize state variables.
                CurrentiFolderOffset = 0;
                TotaliFolders        = 0;
                CheckediFolders      = new Hashtable();
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            remoteweb = new iFolderAdmin();

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                SetFocus(DataPathName);

                AddDataPathButton.Text = GetString("ADD");
                CancelButton.Text      = GetString("CANCEL");

                ReferringPage = Page.Request.UrlReferrer.ToString();
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;

            // localization
            rm = Application["RM"] as ResourceManager;

            if (!IsPostBack)
            {
                // Remember the page that we came from.
                ReferringPage = Page.Request.UrlReferrer.ToString();

                // Initialize the localized fields.
                CreateButton.Text = GetString("CREATE");
                CancelButton.Text = GetString("CANCEL");

                // Initialize state variables.
                SetFocus(UserName);
            }
        }
Esempio n. 23
0
        private bool UpdateProxyUserInfo(string ldapAdmin, string ldapAdminPwd, string proxyDN, string ProxyDNPwd)
        {
            bool status = true;

            try
            {
                iFolderServer[] list = web.GetServers();
                foreach (iFolderServer server in list)
                {
                    //check all servers other than current server.
                    if (server.ID != ServerID)
                    {
                        log.Info("Connecting to {0}", server.ID);
                        remoteweb = new iFolderAdmin();
                        remoteweb.PreAuthenticate = true;
                        remoteweb.Credentials     = web.Credentials;
                        remoteweb.Url             = server.PublicUrl + "/iFolderAdmin.asmx";
                        remoteweb.GetAuthenticatedUser();
                        //Pick information from IdentityProvider
                        LdapInfo ldapInfo = remoteweb.GetLdapDetails();
                        log.Info("Proxy User = {0} on {1}", ldapInfo.ProxyDN, server.ID);
                        if (proxyDN == ldapInfo.ProxyDN)
                        {
                            //ldapInfo.ProxyDN = ProxyDN;
                            ldapInfo.ProxyPassword = ProxyDNPwd;
                            log.Info("Changing proxy user password on : {0}", server.ID);
                            remoteweb.SetLdapDetails(ldapInfo, ldapAdmin, ldapAdminPwd, server.ID);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                status = false;
                log.Info("Exception in UpdateProxyUserInfo : (0)", ex.Message);
                TopNav.ShowInfo(String.Format(GetString("ALLSERVERPROXYPASSWORDCHANGEERROR")));
                return(status);
            }
            return(status);
        }
Esempio n. 24
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            web = Session["Connection"] as iFolderAdmin;
            // localization
            rm = Application["RM"] as ResourceManager;

            currentURL = web.Url;
            remoteweb  = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = web.Url;

            if (!IsPostBack)
            {
                SharingTitle.Text          = GetString("SHARING");
                SharingOn.Text             = GetString("ON");
                enforcedSharing.Text       = GetString("ENFORCED");
                disablePastSharing.Text    = GetString("DISABLEPASTSHARING");
                SharingOn.Checked          = enforcedSharing.Checked = false;
                disablePastSharing.Checked = false;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Do Login
        /// </summary>
        /// <param name="username">Username</param>
        /// <param name="password">Password</param>
        /// <param name="check">Perform browser checks.</param>
        private void DoLogin(string username, string password, bool check)
        {
            // client information
            log.Info(Context, "Client Information: {0}, {1}, {2}",
                     username, Context.Request.UserHostName,
                     Context.Request.UserAgent);

            // expires for new cookies
            DateTime expires = DateTime.Now + TimeSpan.FromDays(30);

            // check for cookies
            if (check)
            {
                HttpCookie testCookie = Request.Cookies["test"];
                if (testCookie == null)
                {
                    MessageType.Text = rm.GetString("LOGINERROR");
                    MessageText.Text = "LOGINNOCOOKIES";

                    // log access
                    log.Info(Context, "Login Failed: Browser Cookies Disabled");

                    return;
                }
            }

            // check for running scripts
            // NOTE: check the value for iChain
            if (check)
            {
                string noscript = Request.Form.Get("noscript");
                if ((noscript != null) && (noscript == "true"))
                {
                    MessageType.Text = rm.GetString("LOGINERROR");
                    MessageText.Text = "LOGINNOSCRIPT";

                    // log access
                    log.Info(Context, "Login Failed: Browser Scripts Disabled");

                    return;
                }
            }

            try
            {
                // connection
                iFolderAdmin web = new iFolderAdmin();

                // update web url
                // always use the original path from the WSDL file
                string simiasUrl = Environment.GetEnvironmentVariable("SimiasUrl");
                if (simiasUrl == null)
                {
                    simiasUrl = System.Configuration.ConfigurationSettings.AppSettings.Get("SimiasUrl");
                }

                UriBuilder webUrl = new UriBuilder(simiasUrl);

                webUrl.Path = (new Uri(web.Url)).PathAndQuery;
                web.Url     = webUrl.Uri.ToString();

                UTF8Encoding utf8Name = new UTF8Encoding();
                byte[]       encodedCredsByteArray = utf8Name.GetBytes(username);
                string       iFolderUserBase64     = Convert.ToBase64String(encodedCredsByteArray);

                encodedCredsByteArray = utf8Name.GetBytes(password);
                string iFolderPassBase64 = Convert.ToBase64String(encodedCredsByteArray);

                // credentials
                web.PreAuthenticate = true;
                web.Credentials     = new NetworkCredential(iFolderUserBase64, iFolderPassBase64);

                // in only one path this value will persist, that is when language cookie is null
                Session["Language"] = "en";
                string code = Session["Language"] as string;
                // ui language
                if (LanguageList.SelectedValue == null || LanguageList.SelectedValue == String.Empty)
                {
                    /// Case when single sign on happens without the login page so no language selected

                    if ((Request.UserLanguages != null) && (Request.UserLanguages.Length > 0))
                    {
                        code = Request.UserLanguages[0];
                        if (!(code.StartsWith("zh") || code.StartsWith("pt")))
                        {
                            code = code.Substring(0, 2);
                        }
                        else
                        {
                            // On Single sign-on Browser sends language as zh-cn,zh-tw and pt-br .
                            // Help files are placed in a folder with names zh-CN,zh-TW and pt-BR .
                            if (code == "zh-cn")
                            {
                                code = "zh-CN";
                            }
                            else if (code == "zh-tw")
                            {
                                code = "zh-TW";
                            }
                            else if (code == "pt-br")
                            {
                                code = "pt-BR";
                            }
                        }
                        Session["Language"] = code;
                    }
                }
                else
                {
                    /// Normal login so select from the list
                    Session["Language"] = LanguageList.SelectedValue;
                    code = Session["Language"] as string;
                }
                Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(code);
                log.Info(Context, "Current culture :{0}", Thread.CurrentThread.CurrentUICulture.Name);
                // user and system
                iFolderUser user = null;
                try
                {
                    user = web.GetAuthenticatedUser();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                string multibyteserver = web.GetServerStatus();

                iFolderSystem system = web.GetSystem();
                Session["System"] = system.Name;
                iFolderServer server = web.GetHomeServer();
                Session["Version"] = server.Version;

                if (multibyteserver == "no")
                {
                    web.PreAuthenticate = true;
                    web.Credentials     = new NetworkCredential(username, password);
                }
                // cookies
                web.CookieContainer   = new CookieContainer();
                encodedCredsByteArray = utf8Name.GetBytes(user.UserName);
                iFolderUserBase64     = Convert.ToBase64String(encodedCredsByteArray);

                // new username cookie for 30 days
                Response.Cookies["username"].Value   = multibyteserver == "no" ? user.UserName : iFolderUserBase64;
                Response.Cookies["username"].Expires = expires;
                Response.Cookies["username"].Path    = "/admin/";

                // session
                Session["Connection"] = web;
                Session["Name"]       = user.FullName;
                Session["UserID"]     = user.ID;


                // add server information to the session.
                Session["HostName"]    = server.HostName;
                Session["MachineName"] = server.MachineName;
                Session["OSVersion"]   = server.OSVersion;
                Session["ClrVersion"]  = server.ClrVersion;

                // new language cookie for 30 days
                Response.Cookies["language"].Value   = code;
                Response.Cookies["language"].Expires = expires;
                Response.Cookies["language"].Path    = "/admin/";

                // log access
                log.Info(Context, "Login Successful");

                // redirect
                FormsAuthentication.RedirectFromLoginPage(user.UserName, false);
            }
            catch (WebException ex)
            {
                // log access
                log.Info(Context, ex, "Login Failed");

                if (!HandleException(ex))
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                // log access
                log.Info(Context, ex, "Login Failed");
                throw ex;
            }
        }
Esempio n. 26
0
      /// <summary>
      /// Main to start the execution
      /// </summary>
      /// <param name="args"></param>
      public static void Main(string[] args)
      {
          if (args.Length == 0)
          {
              Console.WriteLine("A command line utility to manage users in a Simias Server domain.");
              Console.WriteLine("UserCmd.exe action <options>");
              return;
          }

          ParseCommandLine(args);

          if (action == "help")
          {
              ShowUseage();
              return;
          }

          if (action == null || url == null)
          {
              Console.WriteLine("missing mandatory command line arguments");
              return;
          }

          if (adminName == null)
          {
              Console.Write("Please enter simias admin: ");
              adminName = Console.ReadLine();

              Console.Write("password: "******"/\:";

          admin.Url  = url.TrimEnd(notEndingWith.ToCharArray());
          admin.Url += "/simias10/iFolderAdmin.asmx";

          if (action == "create")
          {
              if (username == null || password == null)
              {
                  Console.WriteLine("missing mandatory command line arguments");
                  return;
              }

              // Make the web service call to register/create the user
              iFolderUser user = null;

              try
              {
                  user = admin.CreateUser(
                      username,
                      password,
                      null,
                      first,
                      last,
                      full,
                      null,
                      email);

                  if (user != null)
                  {
                      Console.WriteLine("Successful");
                  }
              }
              catch (WebException we)
              {
                  if (we.Message.LastIndexOf("401") != 0)
                  {
                      Console.WriteLine("Failed - Invalid admin credentials");
                  }
                  else
                  {
                      Console.Write("Failed - ");
                      Console.WriteLine(we.Message);
                  }
              }
              catch (Exception ex)
              {
                  Console.WriteLine("Failed creating {0}'s account", username);
              }
          }
          else
          if (action == "delete")
          {
              try
              {
                  bool status = admin.DeleteUser(username);
                  if (verbose == true)
                  {
                      Console.WriteLine("Deleting user {0}  Status {1)", username, status.ToString());
                  }
              }
              catch (WebException we)
              {
                  if (we.Message.LastIndexOf("401") != 0)
                  {
                      Console.WriteLine("Failed - Invalid admin credentials");
                  }
                  else
                  {
                      Console.Write("Failed - ");
                      Console.WriteLine(we.Message);
                  }
              }
              catch (Exception ex)
              {
                  Console.WriteLine("Failed deleting {0}'s account", username);
              }
          }
          else
          if (action == "modify")
          {
              iFolderUser user      = null;
              bool        exception = false;
              try
              {
                  user = admin.GetUser(username);
              }
              catch (WebException we)
              {
                  if (we.Message.LastIndexOf("401") != 0)
                  {
                      Console.WriteLine("Failed - Invalid admin credentials");
                  }
                  else
                  {
                      Console.Write("Failed - ");
                      Console.WriteLine(we.Message);
                  }
                  exception = true;
              }
              catch (Exception ex)
              {
                  Console.WriteLine("Failed deleting {0}'s account", username);
                  exception = true;
              }

              if (user != null)
              {
                  if (quota != null)
                  {
                      bool       changed    = false;
                      UserPolicy userPolicy = admin.GetUserPolicy(user.ID, null);
                      if (quota != null)
                      {
                          if (verbose == true)
                          {
                              Console.WriteLine("Changing quota from {0} to {1}", userPolicy.SpaceLimit, Convert.ToInt64(quota));
                          }
                          userPolicy.SpaceLimit = Convert.ToInt64(quota);
                          changed = true;
                      }

                      if (changed == true)
                      {
                          admin.SetUserPolicy(userPolicy);
                      }
                  }

                  if (email != null || first != null || last != null || full != null)
                  {
                      if (first != null)
                      {
                          user.FirstName = first;
                      }

                      if (last != null)
                      {
                          user.LastName = last;
                      }

                      if (full != null)
                      {
                          user.FullName = full;
                      }

                      if (email != null)
                      {
                          user.Email = email;
                      }

                      // Write the changes
                      admin.SetUser(user.ID, user);
                  }

                  if (password != null)
                  {
                      bool status = admin.SetPassword(username, password);
                      if (verbose == true)
                      {
                          Console.WriteLine("SetPassord for {0} - {1}", username, status.ToString());
                      }
                  }
              }
              else if (exception == false)
              {
                  Console.WriteLine("Failed - user {0} does not exist", username);
              }
          }
          else
          if (action == "list")
          {
              try
              {
                  iFolderUserSet userSet = admin.GetUsers(0, 0);
                  //admin.GetUsersBySearch( SearchProperty.UserName, SearchOperation.BeginsWith, "*", 0, 0 );

                  foreach (iFolderUser user in userSet.Items)
                  {
                      Console.Write("ID: {0}  ", user.ID);
                      Console.Write("User: {0}  ", user.UserName);
                      if (user.FullName != null && user.FullName != "")
                      {
                          Console.Write("Fullname: {0}  ", user.FullName);
                      }

                      Console.Write("Enabled: {0}  ", user.Enabled.ToString());
                      Console.WriteLine();
                  }
              }
              catch (WebException we)
              {
                  if (we.Message.LastIndexOf("401") != 0)
                  {
                      Console.WriteLine("Failed - Invalid admin credentials");
                  }
                  else
                  {
                      Console.Write("Failed - ");
                      Console.WriteLine(we.Message);
                  }
              }
              catch (Exception ex)
              {
                  Console.WriteLine("Failed getting a list of users");
              }
          }
          else
          if (action == "setpwd")
          {
              if (username == null || username == String.Empty || password == null)
              {
                  Console.WriteLine("missing mandatory command line arguments");
                  return;
              }

              try
              {
                  bool status = admin.SetPassword(username, password);
                  Console.WriteLine("SetPassord for {0} - {1}", username, status.ToString());
              }
              catch (WebException we)
              {
                  if (we.Message.LastIndexOf("401") != 0)
                  {
                      Console.WriteLine("Failed - Invalid admin credentials");
                  }
                  else
                  {
                      Console.Write("Failed - ");
                      Console.WriteLine(we.Message);
                  }
              }
              catch (Exception ex)
              {
                  Console.WriteLine("Failed setting {0}'s password", username);
              }
          }
          else
          {
              Console.WriteLine("Error: invalid action");
          }

          return;
      }
Esempio n. 27
0
        /// <summary>
        /// Event handler that gets called when OK button is clicked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnOkButton_Click(object source, EventArgs e)
        {
            string currentServerProxyDN    = null;
            string currentServerProxyDNPwd = null;
            bool   proxychagnestatus       = true;

            if (!validOK())
            {
                TopNav.ShowError(GetString("ENTERLDAPDETAILS"));
                return;
            }
            if (!DataValidated())
            {
                TopNav.ShowError(GetString("ERRORINVALIDDATA"));
                return;
            }
            if (String.Compare(LdapProxyUserPwd.Text.Trim(), ConfirmLdapProxyUserPwd.Text.Trim()) != 0)
            {
                TopNav.ShowError(GetString("ERRORPROXYPASSWORDSDOESNOTMATCH"));
                return;
            }
            /// if ldap admin username and password is right, go ahead
            iFolderServer server = web.GetServer(ServerID);

            remoteweb = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = server.PublicUrl + "/iFolderAdmin.asmx";
            remoteweb.GetAuthenticatedUser();
            server = remoteweb.GetServer(ServerID);
            LdapInfo ldapInfo = new LdapInfo();

            ldapInfo.Host           = LdapServer.Text.Trim();
            ldapInfo.SearchContexts = LdapSearchContext.Text;
            ldapInfo.ProxyDN        = LdapProxyUser.Text;
            currentServerProxyDN    = LdapProxyUser.Text;
            ldapInfo.ProxyPassword  = LdapProxyUserPwd.Text;
            currentServerProxyDNPwd = LdapProxyUserPwd.Text;
            ldapInfo.SSL            = (LdapSslList.SelectedValue == GetString("YES")) ? true : false;

            try
            {
                remoteweb.SetLdapDetails(ldapInfo, LdapAdminName.Text.Trim(), LdapAdminPwd.Text, ServerID);
                //now the proxy user info changed, check if the same proxy is
                //used in any other servers.
                if (ldapInfo.ProxyDN != null && ldapInfo.ProxyPassword != null)
                {
                    proxychagnestatus = UpdateProxyUserInfo(LdapAdminName.Text.Trim(), LdapAdminPwd.Text,
                                                            currentServerProxyDN, currentServerProxyDNPwd);
                }
            }
            catch (Exception ex)
            {
                TopNav.ShowInfo(String.Format("{0} {1}", GetString("UNABLETOEDITLDAPDETAILS"), ex.Message));
                GetLdapDetails();
                return;
            }
            if (proxychagnestatus != false)
            {
                Response.Redirect(String.Format("ServerDetails.aspx?ID={0}", ServerID));
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL = web.Url;

            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            if (userID != null)
            {
                sysAccessPolicy = web.GetUserSystemRights(userID, null);
            }
            else
            {
                sysAccessPolicy = 0;
            }
            uRights = new UserSystemAdminRights(sysAccessPolicy);
            if (uRights.SecondaryAdminAddAllowed == false)
            {
                Page.Response.Redirect(String.Format("Error.aspx?ex={0}&Msg={1}", GetString("ACCESSDENIED"), GetString("ACCESSDENIEDERROR")));
            }

            if (!IsPostBack)
            {
                // Initialize the localized fields.

                AggregateDiskQuotaLabel.Text = "Set the Aggregate Disk Quota Limit For Entire Group: ";
                StorageUnitLabel.Text        = GetString("MB");

                NoOfiFoldersList.Items[0].Text     = GetString("ALLOW");
                NoOfiFoldersList.Items[0].Selected = true;

                DiskQuotaRightsList.Items[0].Text     = GetString("ALLOW");
                DiskQuotaRightsList.Items[0].Selected = true;

                FileSizeRightsList.Items[0].Text     = GetString("ALLOW");
                FileSizeRightsList.Items[0].Selected = true;

                SyncIntervalRightsList.Items[0].Text     = GetString("ALLOW");
                SyncIntervalRightsList.Items[0].Selected = true;

                FileListRightsList.Items[0].Text     = GetString("ALLOW");
                FileListRightsList.Items[0].Selected = true;

                SharingRightsList.Items[0].Text     = GetString("ALLOWMODIFYSHARINGPOLICY");
                SharingRightsList.Items[0].Selected = true;

                EncryptionRightsList.Items[0].Text     = GetString("ALLOWMODIFYENCRYPTIONPOLICY");
                EncryptionRightsList.Items[0].Selected = true;

                ProvisioningRightsList.Items[0].Text     = GetString("ALLOWUSERPROVISIONING");
                ProvisioningRightsList.Items[1].Text     = GetString("ALLOWUSERENABLING");
                ProvisioningRightsList.Items[0].Selected = true;
                ProvisioningRightsList.Items[1].Selected = true;

                iFolderRightsList.Items[0].Text     = GetString("ALLOWORPHANIFOLDEROWNERSHIP");
                iFolderRightsList.Items[1].Text     = GetString("ALLOWIFOLDERENABLING");
                iFolderRightsList.Items[2].Text     = GetString("ALLOWSHAREDMEMBERRIGHTS");
                iFolderRightsList.Items[3].Text     = GetString("ALLOWDELETEIFOLDERRIGHTS");
                iFolderRightsList.Items[0].Selected = true;
                iFolderRightsList.Items[1].Selected = true;
                iFolderRightsList.Items[2].Selected = true;
                iFolderRightsList.Items[3].Selected = true;

                iFolderUser user = web.GetUser(SecondaryAdmin);
                string      LebelDisplay;
                if (GetString(op) == "Add")
                {
                    LebelDisplay = GetString("ASSIGNADMINRIGHTS");
                }
                else
                {
                    LebelDisplay = GetString(op) + " " + GetString("ADMINRIGHTSFOR");
                }
                AdminFullNameLabel.Text = LebelDisplay + user.FullName;

                SaveAdminRights.Text   = GetString("SAVE");
                CancelAdminRights.Text = GetString("CANCEL");

                InitializeGroupList();
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Enables processing of HTTP Web requests by a custom HttpHandler
        /// that implements the IHttpHandler interface.
        /// </summary>
        /// <param name="context">An HttpContext object that provides
        /// references to the intrinsic server objects (for example,
        /// Request, Response, Session, and Server) used to service HTTP requests.</param>
        public void ProcessRequest(HttpContext context)
        {
            // Setup the response.
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;

            try
            {
                // Only respond to GET method.
                if (String.Compare(request.HttpMethod, "GET", true) == 0)
                {
                    // The file name of the url is the file that is to be downloaded.
                    string fileName = Path.GetFileName(request.Url.LocalPath);

                    iFolderAdmin web = context.Session["Connection"] as iFolderAdmin;
                    if (web == null)
                    {
                        context.Response.Redirect("Login.aspx");
                    }

                    // Get the size of the file.
                    long fileSize = GetFileSize(web, fileName);

                    // Setup the response.
                    response.Clear();
                    response.BufferOutput = false;
                    response.Cache.SetCacheability(HttpCacheability.Private);
                    response.Cache.SetExpires(DateTime.Now);
                    response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName));
                    response.AddHeader("Content-Length", fileSize.ToString());
                    response.ContentType = (Path.GetExtension(fileName) == ".log") ? "text/plain" : "text/csv";

                    // Uri to log file handler.
                    UriBuilder uri = new UriBuilder(web.Url);
                    uri.Path = String.Format("/simias10/admindata/{0}", fileName);

                    long   offset = 0;
                    byte[] buffer = new byte[BufferSize];
                    Stream output = response.OutputStream;

                    while (offset < fileSize)
                    {
                        // The log file size will change while we are reading the file.
                        // Don't read past what the content-length says is the size.
                        long readLength = fileSize - offset;
                        if (readLength > buffer.Length)
                        {
                            readLength = buffer.Length;
                        }

                        // Add the query string part.
                        uri.Query = String.Format("offset={0}&length={1}", offset, readLength);

                        HttpWebRequest webRequest = WebRequest.Create(uri.Uri) as HttpWebRequest;
                        webRequest.Method          = "GET";
                        webRequest.PreAuthenticate = true;
                        webRequest.Credentials     = web.Credentials;
                        webRequest.CookieContainer = web.CookieContainer;

                        HttpWebResponse webResponse = webRequest.GetResponse() as HttpWebResponse;
                        try
                        {
                            Stream webStream = webResponse.GetResponseStream();

                            int length = webStream.Read(buffer, 0, ( int )readLength);
                            output.Write(buffer, 0, length);
                            offset += length;
                        }
                        finally
                        {
                            webResponse.Close();
                        }
                    }

                    response.Close();
                }
                else
                {
                    log.Debug(context, "Error: Invalid http method - {0}", request.HttpMethod);
                    response.StatusCode = ( int )HttpStatusCode.BadRequest;
                    response.Close();
                }
            }
            catch (Exception ex)
            {
                log.Debug(context, "Error: {0}", ex.Message);
                log.Debug(context, "Stack trace: {0}", ex.StackTrace);
                response.StatusCode = ( int )HttpStatusCode.InternalServerError;
                response.Close();
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Page_Load()
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            web = Session["Connection"] as iFolderAdmin;
            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            if (userID != null)
            {
                sysAccessPolicy = web.GetUserSystemRights(userID, null);
            }
            else
            {
                sysAccessPolicy = 0xffff;
            }
            uRights = new UserSystemAdminRights(sysAccessPolicy);

            // Hide the error panel if previously visible.
            if (ErrorPanel.Visible)
            {
                ErrorPanel.Visible = false;
            }

            if (MessagePanel.Visible)
            {
                ErrorPanel.Visible = false;
            }

            if (!IsPostBack)
            {
                // Initially hide the error panel.
                ErrorPanel.Visible   = false;
                MessagePanel.Visible = false;

                Control body = Page.FindControl("users");
                if (body != null)
                {
                    UserLink.HRef    = null;
                    iFolderLink.HRef = "iFolders.aspx";
                    ServerLink.HRef  = "Servers.aspx";
                    SystemLink.HRef  = "SystemInfo.aspx";
                    ReportsLink.HRef = "Reports.aspx";
                }
                else
                {
                    body = Page.FindControl("ifolders");
                    if (body != null)
                    {
                        UserLink.HRef    = "Users.aspx";
                        iFolderLink.HRef = null;
                        ServerLink.HRef  = "Servers.aspx";
                        SystemLink.HRef  = "SystemInfo.aspx";
                        ReportsLink.HRef = "Reports.aspx";
                    }
                    else
                    {
                        body = Page.FindControl("system");
                        if (body != null)
                        {
                            UserLink.HRef    = "Users.aspx";
                            iFolderLink.HRef = "iFolders.aspx";
                            ServerLink.HRef  = "Servers.aspx";
                            SystemLink.HRef  = null;
                            ReportsLink.HRef = "Reports.aspx";
                        }
                        else
                        {
                            body = Page.FindControl("server");
                            if (body != null)
                            {
                                UserLink.HRef    = "Users.aspx";
                                iFolderLink.HRef = "iFolders.aspx";
                                ServerLink.HRef  = null;
                                SystemLink.HRef  = "SystemInfo.aspx";
                                ReportsLink.HRef = "Reports.aspx";
                            }
                            else
                            {
                                body = Page.FindControl("report");
                                if (body != null)
                                {
                                    UserLink.HRef    = "Users.aspx";
                                    iFolderLink.HRef = "iFolders.aspx";
                                    ServerLink.HRef  = "Servers.aspx";
                                    SystemLink.HRef  = "SystemInfo.aspx";
                                    ReportsLink.HRef = null;
                                }
                                else
                                {
                                    UserLink.HRef    = "Users.aspx";
                                    iFolderLink.HRef = "iFolders.aspx";
                                    ServerLink.HRef  = "Servers.aspx";
                                    SystemLink.HRef  = "SystemInfo.aspx";
                                    ReportsLink.HRef = "Reports.aspx";
                                }
                            }
                        }
                    }
                }

                if (uRights.UserManagementAllowed == false)
                {
                    UserLink.HRef = null;
                }
                if (uRights.iFolderManagementAllowed == false)
                {
                    iFolderLink.HRef = null;
                }
                if (uRights.SystemPolicyManagementAllowed == false)
                {
                    SystemLink.HRef = null;
                }
                if (uRights.ServerPolicyManagementAllowed == false)
                {
                    ServerLink.HRef = null;
                }
                if (uRights.ReportsGenerationAllowed == false)
                {
                    ReportsLink.HRef = null;
                }

                // Initialize the state variables.
                BreadCrumbs.RepeatColumns = 0;
                CrumbList = new ArrayList();
            }
        }