Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Restrict access to certain block types

Vote:
 

I am working on a multisite solution and I need to restrict the block types available to either a specific user group (e.g. editor for site A shouldn't be able to see blocks for site B) or, better, restricted to that particular site. 

If I have a SiteAPageData base class that inherits PageData, and another for SiteBPageData, is there a way I can restrict the access to these classes and the blocks that inherit from them?

Any help or code examples would be greatly appreciated, thanks.

#179195
Jun 02, 2017 16:09
Vote:
 

Hello Peter

This is possible to do in admin mode using groups. Look for the video titled “Making a page type available for only some users” in the help section below:

http://webhelp.episerver.com/latest/cms-admin/content-types.htm

The same approach can be used to restrict access to blocks in admin mode.

David

#179196
Edited, Jun 02, 2017 16:25
Vote:
 

Thanks for your quick and helpful response, David. I can see how I can update the block access as well, which is what I was after. Was hoping there was a code implementation I could use so that any new blocks created on either site will automatically inherit from the base class access level, but this will do the trick. Just need to remember to update the access rights when the block is made. Thanks again.

Peter

#179197
Jun 02, 2017 16:43
Vote:
 

There's also an Access attribute that can be used to restrict access for a Content type.

[Access(Roles = "SomeRole")]


https://world.episerver.com/documentation/developer-guides/CMS/Content/Attributes/

#197876
Oct 16, 2018 9:34
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.