So, you’ve defined all the roles you need in your web.config – but now comes the tricky part – sometimes you need to combine them. For instance, you might want to ensure that only people in the webmaster AD group, working from a company computer within working hours are allowed to publish new pages. Or maybe you want to display a popup website evaluation poll to random anonymous users who are not visiting the site for the first time? This is where the MultiRole comes into play. It takes a comma-separated list of role names and ensures that the user has to belong to every single one of those roles for him to belong to this one as well. Or, by flipping a switch the user just needs to belong to one of the listed roles to be in this one (AND vs OR).
This is how you would register it in <virtualRoles> in web.config:
<add name="LocalDayAdminAuthenticated" type="EPiServer.Research.VirtualRoles.MultiRole, VirtualRolesSamplePack" roles="Administrators,Authenticated,LocalOnly,Daytime" mode="all"/>

  • roles a comma separated list of roles.
  • mode can be “any” or “all”, meaning belonging to any of the roles or all of the roles. Default is “all”.

Last edited Nov 2, 2009 at 7:00 PM by AllanThraen, version 1


No comments yet.