/// <summary>
        /// Gets authors.
        /// </summary>
        /// <param name="blogId">
        /// The blog id.
        /// </param>
        /// <param name="userName">
        /// The user name.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        /// <returns>
        /// A list of authors.
        /// </returns>
        internal List <MWAAuthor> GetAuthors(string blogId, string userName, string password)
        {
            var authors = new List <MWAAuthor>();

            if (Security.IsAuthorizedTo(Rights.EditOtherUsers))
            {
                int total;

                var users = Membership.Provider.GetAllUsers(0, 999, out total);

                authors.AddRange(
                    users.Cast <MembershipUser>().Select(
                        user =>
                        new MWAAuthor
                {
                    user_id      = user.UserName,
                    user_login   = user.UserName,
                    display_name = user.UserName,
                    user_email   = user.Email,
                    meta_value   = string.Empty
                }));
            }
            else
            {
                // If not able to administer others, just add that user to the options.
                var single = Membership.GetUser(userName);
                if (single != null)
                {
                    var temp = new MWAAuthor
                    {
                        user_id      = single.UserName,
                        user_login   = single.UserName,
                        display_name = single.UserName,
                        user_email   = single.Email,
                        meta_value   = string.Empty
                    };
                    authors.Add(temp);
                }
            }

            return(authors);
        }
        internal List <MWAAuthor> GetAuthors(string blogID, string userName, string password)
        {
            ValidateRequest(userName, password);

            List <MWAAuthor> authors = new List <MWAAuthor>();

            if (Roles.IsUserInRole(userName, BlogSettings.Instance.AdministratorRole))
            {
                int total = 0;
                int count = 0;
                MembershipUserCollection users = Membership.Provider.GetAllUsers(0, 999, out total);

                foreach (MembershipUser user in users)
                {
                    count++;
                    MWAAuthor temp = new MWAAuthor();
                    temp.user_id      = user.UserName;
                    temp.user_login   = user.UserName;
                    temp.display_name = user.UserName;
                    temp.user_email   = user.Email;
                    temp.meta_value   = "";
                    authors.Add(temp);
                }
            }
            else
            {
                // If not admin, just add that user to the options.
                MembershipUser single = Membership.GetUser(userName);
                MWAAuthor      temp   = new MWAAuthor();
                temp.user_id      = single.UserName;
                temp.user_login   = single.UserName;
                temp.display_name = single.UserName;
                temp.user_email   = single.Email;
                temp.meta_value   = "";
                authors.Add(temp);
            }
            return(authors);
        }
示例#3
0
        /// <summary>
        /// Gets authors.
        /// </summary>
        /// <param name="blogId">
        /// The blog id.
        /// </param>
        /// <param name="userName">
        /// The user name.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        /// <returns>
        /// A list of authors.
        /// </returns>
        internal List<MWAAuthor> GetAuthors(string blogId, string userName, string password)
        {
            var authors = new List<MWAAuthor>();

            if (Security.IsAuthorizedTo(Rights.EditOtherUsers))
            {
                int total;

                var users = Membership.Provider.GetAllUsers(0, 999, out total);

                authors.AddRange(
                    users.Cast<MembershipUser>().Select(
                        user =>
                        new MWAAuthor
                            {
                                user_id = user.UserName,
                                user_login = user.UserName,
                                display_name = user.UserName,
                                user_email = user.Email,
                                meta_value = string.Empty
                            }));
            }
            else
            {
                // If not able to administer others, just add that user to the options.
                var single = Membership.GetUser(userName);
                if (single != null)
                {
                    var temp = new MWAAuthor
                        {
                            user_id = single.UserName,
                            user_login = single.UserName,
                            display_name = single.UserName,
                            user_email = single.Email,
                            meta_value = string.Empty
                        };
                    authors.Add(temp);
                }
            }

            return authors;
        }
示例#4
0
        internal List<MWAAuthor> GetAuthors(string blogID, string userName, string password)
        {
            ValidateRequest(userName, password);

            List<MWAAuthor> authors = new List<MWAAuthor>();

            if (Roles.IsUserInRole(userName, BlogSettings.Instance.AdministratorRole))
            {
                int total = 0;
                int count = 0;
                MembershipUserCollection users = Membership.Provider.GetAllUsers(0, 999, out total);

                foreach (MembershipUser user in users)
                {
                    count++;
                    MWAAuthor temp = new MWAAuthor();
                    temp.user_id = user.UserName;
                    temp.user_login = user.UserName;
                    temp.display_name = user.UserName;
                    temp.user_email = user.Email;
                    temp.meta_value = "";
                    authors.Add(temp);
                }
            }
            else
            {
                // If not admin, just add that user to the options.
                MembershipUser single = Membership.GetUser(userName);
                MWAAuthor temp = new MWAAuthor();
                temp.user_id = single.UserName;
                temp.user_login = single.UserName;
                temp.display_name = single.UserName;
                temp.user_email = single.Email;
                temp.meta_value = "";
                authors.Add(temp);
            }
            return authors;
        }