コード例 #1
0
        internal List <MWAAuthor> GetAuthors(string blogID, string userName, string password)
        {
            ValidateRequest(userName, password);

            var authors = new List <MWAAuthor>();

            //if (Roles.IsUserInRole(userName, BlogSettings.Instance.AdministratorRole))
            //TODO: Adjust to actual admin role name
            if (Roles.IsUserInRole("Admin"))
            {
                int total = 0;
                int count = 0;
                MembershipUserCollection users = Membership.Provider.GetAllUsers(0, 999, out total);

                foreach (MembershipUser user in users)
                {
                    count++;
                    MWAAuthor author = new MWAAuthor();
                    author.user_id      = user.UserName;
                    author.user_login   = user.UserName;
                    author.display_name = user.UserName;
                    author.user_email   = user.Email;
                    author.meta_value   = "";
                    authors.Add(author);
                }
            }
            else
            {
                // If not admin, just add that user to the options.
                MembershipUser single = Membership.GetUser(userName);
                MWAAuthor      author = new MWAAuthor();
                author.user_id      = single.UserName;
                author.user_login   = single.UserName;
                author.display_name = single.UserName;
                author.user_email   = single.Email;
                author.meta_value   = "";
                authors.Add(author);
            }
            return(authors);
        }
コード例 #2
0
        internal List<MWAAuthor> GetAuthors(string blogID, string userName, string password)
        {
            ValidateRequest(userName, password);

            var authors = new List<MWAAuthor>();

            //if (Roles.IsUserInRole(userName, BlogSettings.Instance.AdministratorRole))
            //TODO: Adjust to actual admin role name
            if (Roles.IsUserInRole("Admin"))
            {
                int total = 0;
                int count = 0;
                MembershipUserCollection users = Membership.Provider.GetAllUsers(0, 999, out total);

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