Display content in the CMS depending on the user's permissions/group

Vote:
 

Is there a way to display content on a page in the CMS that only shows for specific user group members? What I want to do is lock editing and publishing of some pages for certain groups. Then if they go to that page in the CMS, they get a message that says something like, "Please contact support to make this page active and editable..." We're using Epi 7.5

Thanks!

#151716
Aug 04, 2016 17:33
Vote:
 

As explained in http://webhelp.episerver.com/CMS/7.5/EN/#Authorization/Admin_SettingAccessRightsTreeStructure.htm, you can assign users to a group, then assign read-only access rights for a page (and it descendants) to the group. These users can only see those pages -- they can't edit them.

#151718
Aug 04, 2016 18:21
Vote:
 

That link does not answer my question. 

#151724
Aug 04, 2016 19:47
Vote:
 

Hi Nathan,

As Bob said, you can assign users to a group that has read-only access to a page. This will lock editing and publishing.

To show a message to users that have read but not publish access, you can use something like this the view:

@if (!Model.CurrentPage.ACL.QueryDistinctAccess(AccessLevel.Publish))
{
    <p>Please contact support to make this page active and editable...</p>
}

And if you want that message to be visible only in edit mode, you can have something like this:

@if (PageEditing.PageIsInEditMode && !Model.CurrentPage.QueryDistinctAccess(AccessLevel.Publish))
{
    <p>Please contact support to make this page active and editable...</p>
}

Hope this helps!

#151727
Edited, Aug 04, 2016 22:49
Vote:
 
#151728
Aug 04, 2016 22:52
Vote:
 

Hi Dejan, thank you for your response. I could not get it to work. I am a MVC newbie. When I put in your code, and got to Model.CurrentPage, I got an error on it and Visual Studio suggested it create a new property called CurrentPage on the model. That didn't look right to me. Do you know if there's a special set up deeper into the project that has to be done before CurrentPage is accessible like you have it? I'm sorry if those are bad questions. Again, I'm new at this. I'd appreciate some more insight if you have any. Thanks!

#151745
Aug 05, 2016 15:19
Vote:
 

Hi Nathan,

My code is based on Alloy sample project.

Can you send me how your controller, view model, and view look like?

#151747
Aug 05, 2016 15:22
* 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.