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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0adding role to user dynamically?!adding role to user dynamically?!
Previous
 
Next
New Post
11/2/2008 7:20 AM
 

hay all, i'm trying to add a role that is already added to the portal to a user who is created dynamically ..

i'm using this code, but it doesn't update the database ..

             DotNetNuke.Security.Roles.RoleController objRoleController = new DotNetNuke.Security.Roles.RoleController();
             objRoleController.AddUserRole(0, user.UserID, 90, System.DateTime.MaxValue);

any one can help, than all .

 
New Post
11/2/2008 3:31 PM
 

Call UserController.UpdateUser afterwards and you should be fine. 

 
New Post
11/12/2008 11:57 AM
 

I am also trying to do something pretty similar.

I have assigned a role to each of the 10 modules that are displayed on the front page of my portal.

I have written a module that displays each of these roles next to a check box.

The user can then tick/untick which modules they want displayed.

I then add or delete roles at realtime depending on their choices.

My issue is that the role changes are not reflected imediately. The user has to log out and log back in to see the changes.

On another thread I was informed that the user/module roles are stored in a cookie and therefore I cannot change roles dynamically at realtime?

If anyone can help it would be REALLY appreciated

 


Blue & White hooped blood runs through my veins!
 
New Post
11/14/2008 8:58 AM
 

This code puts a user in a role and logs them in again:

http://www.adefwebserver.com/DotNetNukeHELP/Misc/AutoPortalLogin.htm

// Login the User
UserController.UserLogin(PortalId, UserInfo, PortalSettings.PortalName, GetIPAddress(), true);
// Redirect the user to the current page
Response.Redirect(Request.RawUrl);

 



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
11/23/2008 12:45 AM
 

Ummmm... All I can say is holy crap. Spent hours upon hours on that exact problem this past week. Tried AddUserRole, found that UpdateUserRole worked a little better and I even tried on my own to call the UserLogin function.... Funny that I was sooo close.  

Didn't think to redirect to the current page.  :-)

Thanks. You da man!

P.S. - This was needed b/c I've implemented a set of modules that use data from an existing application and database. So it was neccessary to leverage the already existing autentication database housing the existing users, and so I decided to write my own login module that generates the user and the role on the fly based on the user's role in the existing system and also a bit of their account state information. Allows me to very nicely show/hide a set of tabs based on existing application data...  Looking forward to 5.0 and the ability to deny access based on a role. Would love to see versioning as a part of the core though... Whew what a long and rambling PS. ;-)

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0adding role to user dynamically?!adding role to user dynamically?!


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