1

I am looking into blog engine and would like to be able to setup a blog for every user in my asp.net membership provider. This is easy to do, although setting up the permissions is not so simple.

Although this is not a great solution as far as i can tell the best way to do this is to create a new role for every user and assign that role to the new blog. Then assign the same rights to the new role that are assigned to the administrators role.

I am struggling to find out how to associate a role with a blog via c# code, and how to assign the rights to this role.

If anybody knows how to do this, or a better way to achieve my goal i would appreciate the help

Jean-Bernard Pellerin
  • 12,556
  • 10
  • 57
  • 79
Paul
  • 693
  • 1
  • 10
  • 25

1 Answers1

1

Look under /Account/create-blog.aspx.cs, there is a method to create new blog for a user and it all comes down to this:

Blog blog = BlogGenerator.CreateNewBlog(
    BlogName.Text, UserName.Text, Email.Text, Password.Text, out message);

So you can loop though your membership and execute this method for every user. It will create child blog for each and set user as admin for this blog only.

rtur
  • 111
  • 2
  • What if I want the user to be set as an Editor? – gbade_ Mar 24 '17 at 08:28
  • Also, a scenario where there are multi-users on one blog. I have programmatically set new users but they don't have any roles. How do I solve this? – gbade_ Mar 24 '17 at 09:51