示例#1
0
        /// <summary>
        /// Gets the details about the user and fills out the details table.
        /// </summary>
        /// <returns>The user's full name.</returns>
        private string GetUserDetails()
        {
            // Insert NewLine char after 80 char
            int NewlineAt = 80;
            // Get the iFolder user information.
            string NewHomeUrl = web.GetNewHomeServerURLForUserID(UserID);

            if (!String.IsNullOrEmpty(NewHomeUrl))
            {
                UriBuilder remoteurl = new UriBuilder(NewHomeUrl);
                remoteurl.Path = (new Uri(web.Url)).PathAndQuery;
                web.Url        = remoteurl.Uri.ToString();
            }

            iFolderUserDetails details = null;

            try
            {
                details = web.GetUserDetails(UserID);
            }
            catch
            {
                web.Url = currentServerURL;
                details = web.GetUserDetails(UserID);
            }
            if (details == null)
            {
                return(String.Empty);
            }

            // Add the information rows to the table.
            UserName.Text    = FormatInputString(details.UserName, NewlineAt);
            FullName.Text    = FormatInputString(details.FullName, NewlineAt);
            LdapContext.Text = details.LdapContext;
            NewHome.Text     = details.DetailNewHomeServer;
            Completed.Text   = details.DetailDataMovePercentage.ToString();
            CurrentHome.Text = details.DetailHomeServer;
            ReprovState.Text = (String.Compare(details.DetailDataMoveStatus, "NOTELIGIBLE") == 0) ? GetString(details.DetailDataMoveStatus): details.DetailDataMoveStatus;

            web.Url = currentServerURL;

            return(details.FullName);
        }
示例#2
0
        /// <summary>
        /// Gets the details about the user and fills out the details table.
        /// </summary>
        /// <returns>The user's full name.</returns>
        private string GetUserDetails()
        {
            // Insert NewLine char after 80 char
            int NewlineAt = 80;
            // Get the iFolder user information.
            iFolderUserDetails details = web.GetUserDetails(UserID);

            string lastLogin = (details.LastLogin == DateTime.MinValue) ?
                               GetString("NOTAVAILABLE") : Utils.ToDateTimeString(details.LastLogin);

            // Add the information rows to the table.
            UserName.Text = FormatInputString(details.UserName, NewlineAt);
            FullName.Text = FormatInputString(details.FullName, NewlineAt);
            switch (details.MemberType)
            {
            case 1:
                MemberType.Text              = GetString("MEMBERTYPELDAPGROUP");
                GroupDiskQuotaHeader.Text    = GetString("GROUPDISKQUOTA");
                GroupDiskQuotaHeader.Visible = true;
                long GroupDiskQuotaValue = details.GroupDiskQuota;
                if (GroupDiskQuotaValue == -1)
                {
                    GroupDiskQuotaText.Text = "";
                }
                else
                {
                    GroupDiskQuotaText.Text = Utils.ConvertToMBString(GroupDiskQuotaValue, false, rm);
                }
                GroupDiskQuotaText.Visible    = true;
                GroupDiskQuotaLiteral.Text    = GetString("MB");
                GroupDiskQuotaLiteral.Visible = true;
                GroupDiskQuotaSave.Text       = GetString("SAVE");
                GroupDiskQuotaSave.Visible    = true;
                /// Disable for groupadmin...
                string loggedinuserID = Session["UserID"] as String;
                int    pref           = web.GetUserGroupRights(loggedinuserID, UserID);
                if (pref != -1 && pref != 0xffff)
                {
                    GroupDiskQuotaText.Enabled = false;
                    GroupDiskQuotaSave.Enabled = false;
                }

                DiskQuotaUsedHeader.Text     = GetString("DISKSPACEUSED");
                DiskQuotaUsedHeader.Visible  = true;
                DiskQuotaUsedLiteral.Text    = Utils.ConvertToMBString(web.SpaceUsedByGroup(UserID), false, rm) + " " + GetString("MB");
                DiskQuotaUsedLiteral.Visible = true;
                break;

            case 2:
                MemberType.Text = GetString("MEMBERTYPELOCALGROUP");
                break;

            default:
                MemberType.Text = GetString("MEMBERTYPEUSER");
                break;
            }
            if (details.MemberType > 0)
            {
                MembersTag.Text = GetString("MEMBERLISTTAG");
            }
            else
            {
                MembersTag.Text = GetString("GROUPLISTTAG");
            }
            MembersList.Text = FormatInputString(details.GroupOrMemberList, NewlineAt);
            LdapContext.Text = details.LdapContext;
            LastLogin.Text   = lastLogin;
            return(details.FullName);
        }
示例#3
0
        /// <summary>
        /// Creates a DataSource containing user names from a search.
        /// </summary>
        /// <returns>An DataView object containing the ifolder users.</returns>
        private DataView CreateDataSource()
        {
            // store the server list , so that it can be used to fill up the drop down box for each user and need not make
            // calls for each user

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("VisibleField", typeof(bool)));
            dt.Columns.Add(new DataColumn("IDField", typeof(string)));
            dt.Columns.Add(new DataColumn("AdminField", typeof(bool)));
            dt.Columns.Add(new DataColumn("ProvisionedField", typeof(string)));
            dt.Columns.Add(new DataColumn("NameField", typeof(string)));
            dt.Columns.Add(new DataColumn("CurrentHomeField", typeof(string)));
            dt.Columns.Add(new DataColumn("NewHomeField", typeof(string)));
            dt.Columns.Add(new DataColumn("PercentageStatusField", typeof(string)));
            dt.Columns.Add(new DataColumn("StatusField", typeof(string)));
            dt.Columns.Add(new DataColumn("DeleteField", typeof(bool)));

            DataRow dr;

            iFolderUserSet userList = web.GetReprovisionUsers(
                CurrentUserOffset,
                Accounts.PageSize);

            foreach (iFolderUser user in userList.Items)
            {
                string             newHomeUrl = user.NewHomeServerUrl;
                iFolderUserDetails details    = null;
                if (!String.IsNullOrEmpty(newHomeUrl))
                {
                    UriBuilder remoteurl = new UriBuilder(newHomeUrl);
                    remoteurl.Path = (new Uri(web.Url)).PathAndQuery;
                    web.Url        = remoteurl.Uri.ToString();

                    try
                    {
                        details = web.GetUserDetails(user.ID);
                    }
                    catch
                    {
                        web.Url = currentServerURL;
                        details = web.GetUserDetails(user.ID);
                    }
                }

                dr    = dt.NewRow();
                dr[0] = true;
                dr[1] = user.ID;
                dr[2] = (user.MemberRights == Rights.Admin) ? true : false;
                dr[3] = (user.HomeServer == string.Empty) ?  null : user.HomeServer;
                dr[4] = user.UserName;
                dr[5] = (user.HomeServer == string.Empty) ?  null : user.HomeServer;
                dr[6] = (user.NewHomeServer == string.Empty) ?  null : user.NewHomeServer;
                dr[7] = details != null ? (details.DetailDataMovePercentage.ToString() + " %   ") : user.DataMovePercentage.ToString() + " %   ";
                string dataMoveStatus = details != null ? details.DetailDataMoveStatus : user.DataMoveStatus;
                dr [8] = (string.Compare(dataMoveStatus, "NOTELIGIBLE") == 0) ? GetString(dataMoveStatus): dataMoveStatus;
                if (string.Compare(dataMoveStatus, "NOTELIGIBLE") == 0)
                {
                    dr[9] = true;
                }
                else
                {
                    dr[9] = false;
                }

                dt.Rows.Add(dr);
            }

            // If the page size is not full, finish it with empty entries.
            for (int i = dt.Rows.Count; i < Accounts.PageSize; ++i)
            {
                dr    = dt.NewRow();
                dr[0] = false;
                dr[1] = String.Empty;
                dr[2] = false;
                dr[3] = false;
                dr[4] = null;
                dr[5] = String.Empty;
                dr[6] = String.Empty;
                dr[7] = String.Empty;
                dr[8] = String.Empty;
                dr[9] = false;

                dt.Rows.Add(dr);
            }

            // Remember the total number of users.
            TotalUsers = userList.Total;

            web.Url = currentServerURL;

            // Build the data view from the table.
            return(new DataView(dt));
        }