Ability to import/export users and roles?

Topics: Administration, Customizing Orchard
Jan 5, 2012 at 12:13 AM

I'd like to pre-populate a site with a number of users and roles.  The command line for users gives you the ability to create users but it doesn't assign any roles to that user nor does the role module allow you to add any roles to a user or create roles.

 

Is there an option I'm not considering (besides writing it myself)?

Coordinator
Jan 5, 2012 at 12:18 AM

I don't see import/export code on the roles part driver, so yes you'd have to write that. This would be a great contribution.

Jan 5, 2012 at 12:23 AM
Thanks for the quick reply. Is there a built in type that has special Import/Export logic that can help guide me?

I've added Import/export logic to many items through overriding these two methods:

protected override void Exporting(ContentPart part, Fields.ChoiceListField field, ExportContentContext context)
{
context.Element(field.FieldDefinition.Name + "." + field.Name).SetAttributeValue("Options", field.Options);
context.Element(field.FieldDefinition.Name + "." + field.Name).SetAttributeValue("Value", field.SelectedValue);
}

protected override void Importing(ContentPart part, Fields.ChoiceListField field, ImportContentContext context)
{
field.Options = context.Attribute(field.FieldDefinition.Name + "." + field.Name, "Options");
field.SelectedValue = context.Attribute(field.FieldDefinition.Name + "." + field.Name, "Value");
}

Problem is, these are types that are referenced by Content Parts already in the list of import export items.

I'll take a look at some contributions that export settings at the "site" level (like smtp settings) but any advice anyone can give is appreciated.

On Wed, Jan 4, 2012 at 6:19 PM, bertrandleroy <notifications@codeplex.com> wrote:

From: bertrandleroy

I don't see import/export code on the roles part driver, so yes you'd have to write that. This would be a great contribution.

Read the full discussion online.

To add a post to this discussion, reply to this email (orchard@discussions.codeplex.com)

To start a new discussion for this project, email orchard@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com




--
================
John B Fraser
================

Coordinator
Jan 5, 2012 at 1:24 AM

Tags maybe?

Aug 21, 2012 at 12:18 PM

Any success in roles export/importing?