Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Please help me!Please help me!
Previous
 
Next
New Post
5/4/2015 9:32 AM
 

Hey Guys, Thank you very muchfor the advice.

 

I will try to use SQL functionality in a test environment first, Thanks a lot

 
New Post
5/4/2015 1:49 PM
 

Hi again guys, I'm looking for a way to massively add the "Security role" of everyone in the site as "Associado".
You said that it can be done by SQL, but I don't know exatly how to do it.

Accordingly this site, it can also be done by Role Controller and API:
http://stackoverflow.com/questions/16746686/dnn-add-or-create-a-role-in-dotnetnuke-with-sql

do you know how can I do it exatly?

 

 

 

 

 
New Post
5/5/2015 3:28 AM
 

Below is a C# code to add one DNN role ("Role1") to every DNN user in DNN portal (Portal id = 1)

//create role controller
DotNetNuke.Security.Roles.RoleController roleController = new DotNetNuke.Security.Roles.RoleController();
                
//1. Get DNN role                
DotNetNuke.Security.Roles.RoleInfo role = roleController.GetRoleByName(1, "Role1");
                
//Gets all the users from the portal id =1
System.Collections.ArrayList dnnUsers = DotNetNuke.Entities.Users.UserController.GetUsers(1);

//for every user
for (int i = 0; i < dnnUsers.Count; i++)                
//add role 
roleController.AddUserRole(1, (dnnUsers[i] as DotNetNuke.Entities.Users.UserInfo).UserID, role.RoleID, DotNetNuke.Common.Utilities.Null.NullDate);

 
New Post
5/5/2015 7:54 PM
 

Could you not create a new role in ADMIN > SECURITY ROLES. And when you create the role make it an "Auto-Assignment" role, then select the option to Assign to existing users as shown below?

Auto-Assignment of a role in DNN

 

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Please help me!Please help me!


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out