Try our conversational search powered by Generative AI!

Access attribute for Blocks


I'm trying to set the Access attribute for a block, so only a specific group is able to create that block (rather than the default "Everyone"). I'm following the info here:

The block is still being created with the default "Everyone" access. Am I missing something?

Sample code:

namespace cms.Models.Blocks
    [ContentType(DisplayName = "PageTitleBlock", GUID = "623351a8-55c0-4f9f-af08-18a1ffe9ba0f", Description = "")]

    [Access(Roles = "BlockCreators")]

    public class PageTitleBlock : BlockData
            Name = "Image",
            Description = "Background image for banner",
            GroupName = SystemTabNames.Content,
            Order = 1)]
        public virtual ContentReference Image { get; set; }

            Name = "Title",
            Description = "Page Title",
            GroupName = SystemTabNames.Content,
            Order = 2)]
        public virtual String Title { get; set; }

            Name = "Subtitle",
            Description = "Page subtitle",
            GroupName = SystemTabNames.Content,
            Order = 3)]
        public virtual String Subtitle { get; set; }

Oct 08, 2015 0:55


It looks like everything is setup correctly in your code.

You could try to temporary set similar settings on Page type instead for a Block type and see if the pages are restirected.

You could also check access rights for block in admin mode:  Admin->Content Type -> PageTitleBlock -> Settings -> Access Level

Or maybe there is a problem with roles assigned to user that you are using to test - he has BlockCreators role.

Oct 08, 2015 9:29

I've been checking to see if the access rights were applied correctly at the screen you mentioned; just shows "Everyone" for the new block. I also just did a quick test creating a new page type, and had the same results.

I made sure the role exists in the system (in case that made a difference), but got the same results.

Oct 08, 2015 16:33

Did you try clicking the "revert to default" in admin mode?

Oct 09, 2015 9:51

That was the last thing I tried last night, and it did indeed reset the Access level to the one specified in code. Is that the expected behavior?

Oct 09, 2015 15:41

I would expect it to use whatever you had specified in your code, so no. Perhaps if you changed the model at some point, it got "stuck" somehow?

Oct 09, 2015 15:46
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.