Automatically Assigning Roles

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
12/5/2011 2:26:08 PM
Gravatar
Total Posts 67

Automatically Assigning Roles

Hello,

Is there a way to automatically assign a custom role? Basically I want to assign a special role when a user registers, but we're going to run a quarterly audit to check if these users actually belong in that roll. We don't want to delete the user, because they can just sign back up again, so we just want to remove the role. It's not the perfect method, but we don't want to have to approve thousands of users one at a time. Any ideas?

12/5/2011 3:10:02 PM
Gravatar
Total Posts 1204
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Automatically Assigning Roles

This can be done with a User Registered Event Handler (custom development). I set up a system like this for our site; we wanted to be able to assign specific roles to new users that exist in Active Directory (our internal users). If you are interested, I can give you some code samples.

Jamie

12/6/2011 10:47:35 AM
Gravatar
Total Posts 67

Re: Automatically Assigning Roles

Thanks Jamie. I don't like the looks of that, I was hoping that it was just a box that I could check.

12/6/2011 11:22:11 AM
Gravatar
Total Posts 1204
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Automatically Assigning Roles

I've been in contact with Joe Audette about this, since there have been several requests for it recently in the forums. He said that he's added an item to his product tracker to add this functionality to mojoPortal at some point in the future. When it's available, there will be a new site setting where administrators can assign one or more default roles to all new site users. As always, there is no time frame for when this may appear, since development priorities are constantly changing.

If you need more advanced functionality, like distinguishing between LDAP and site registered users like we do, that will still require some custom development of a user registered event handler to accomplish.

Jamie

12/7/2011 2:26:40 PM
Gravatar
Total Posts 67

Re: Automatically Assigning Roles

Thanks for the input. We're not going to be accepting LDAP registration because registration is strictly meant to access supplemental content for internal agents. I want to assign an agent role when they register, then we'll remove the role later after an audit (the content is not that secretive).

How would I use the link that you posted? Could I attach a control to the skin, and write the code in there? I guess I'm asking where I should put my code... I know that this is intended so that I modify the core, but how does that work for attaching an action to the profile creation process?

Sorry, I'm more towards the front end and only know so much about the back end (which is still more than most), so I'm a little confused about how this would work.

12/7/2011 3:19:18 PM
Gravatar
Total Posts 1204
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Automatically Assigning Roles

Well, I'd say that first off if you can wait on Joe to put this change into the core, that would be the best option. But if you can't wait and really want to use the custom user handler method, you'll need to either do some custom development in C# in Visual Studio 2010 (or work with someone who can), and do the following:

  • Create a user handler class, starting from Joe's provided code skeleton, and build it to a DLL file.
  • Deploy that custom DLL to the /bin directory of your mojoPortal installation
  • Create a .config file as outlined on that user handler page and place it as instructed.
  • Run www.yoursite.com/setup to register the user handler with your installation

Now, that's the ideal bare minimum required. Realistically, there will be a lot of testing cycles needed to make sure that it's doing what you want, before you deploy to production. Also, I'm assuming that you would be hardcoding the role name directly into the user handler code. If you want to make a user-maintainable screen for selecting the roles, that adds an additional layer of complexity. I made ours user maintainable by creating an aspx page that does per-site database updates, and added it as a custom Administration menu item.

I hope that helps,

Jamie

1/11/2012 2:57:51 PM
Gravatar
Total Posts 67

Re: Automatically Assigning Roles

Hey Jamie, do you know by chance if this has been implemented yet?

1/11/2012 7:09:36 PM
Gravatar
Total Posts 1204
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Automatically Assigning Roles

No, I haven't seen anything about it yet in the source code updates, and I don't have any information beyond that.

Jamie

5/8/2013 11:03:01 AM
Gravatar
Total Posts 18439

Re: Automatically Assigning Roles

See this related thread.

You must sign in to post in the forums. This thread is closed to new posts.