Multiple virtual roles

Vote:
 

Does anyone know if it possible to do a VirtualRoleProvider (or the likes) which creates more than a single virtual role? Say, I wanted to create a number of roles based on a table in SQL server?

I believe it must be a pretty common scenario.

#50876
May 16, 2011 12:58
Vote:
 

I think you need to create one for each role, but you could make your own RoleProvider and add roles there

#50884
May 16, 2011 13:51
Vote:
 

Thank you for the answer.

You're right - It is possible to extend the membership- and role provider to obtain the same functionaliy. But I'm just puzzled by the fact that this is not possible with the VirtualRoleProvider, it being based on the Provider model!?! Anyways, shouln't it at least be possible to plug in at the same place?

#50886
May 16, 2011 15:14
Vote:
 

The Virtual Role only gets its name through configuration. Each configuration element can only support one role name, but you can certainly add the same type reference multiple times with different names. If in your role you implement the Initialize method you'll get the name-value pairs of the config so you can find out what role name has been configured for the instance. Or add your own extra configuration (decompile the EPiServer.Security.UserMappedRole for inspiration).

#50893
Edited, May 16, 2011 16:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.