I would like to be able to import roles using the Import Node module. This module is great, so far, with regards to importing Ubercart products and users, but I would also like to do automatic import of roles. I'm attempting to migrate a site from Xoops to Drupal.

Maybe there's already a way to do it, but it's not obvious.

Comments

not_Dries_Buytaert’s picture

Title: Import Roles » Import roles per user
Component: Miscellaneous » Code

I suppose you mean roles per user, not just the plain list of role names like this one '{domain}/admin/user/roles'.
NB: each user may have multiple roles.

Robrecht Jacques’s picture

Version: 6.x-1.0-rc4 » 6.x-1.x-dev
Status: Active » Postponed
Issue tags: +User Role

Users with roles can be imported, eg:

user, mail, roles
myname, myname@example.org, authenticated user || administrator

The roles itself can not be imported. Making this a postponed minor feature request. You would probably want to import the permissions assigned to each role.

hanoii’s picture

So roles can or cannot be imported? I mean, importing users and assign roles to them.

I guess not, and +1 for that feature.

hanoii’s picture

Status: Postponed » Needs review
StatusFileSize
new4.82 KB

I coded this one.

fun module to hack into!

attached is the patch, I think it's fairly good, I tried to follow the same approaches as other stuff, I hope to have done it properly. The only bit I am not 100% sure about is the preview of roles, but it shouldn't be that bad how I've done it.

hanoii’s picture

StatusFileSize
new4.74 KB

Removed some spaces

hanoii’s picture

StatusFileSize
new4.72 KB

Removed even more spaces

gotcha41’s picture

will this be included in the module one day?

I'm looking for the exact same functionality and I prefer not to work with patches (as modifications will be lost when upgrading to a newer version).

Also, being able to import a list of roles to the system would be great

hanoii’s picture

@gotcha41, a great way for a patch be accepted is to test it and reporting back to this issue in order for it to be considered.

Bricks and Clicks Marketing’s picture

@gotcha41 - in this case, it would depend on how often you intend on importing users. Once they're imported, it won't matter if the modification is lost on upgrade as you'll already have the users - unless you need to do it again.

hanoii’s picture

StatusFileSize
new5.63 KB

Attached is a revised patch, as I found some issues with default assignment of roles.