Try our conversational search powered by Generative AI!

Copy/Paste pages and Access Level

A.D
A.D
Vote:
 

I created a page type that has a specific access level - only 'Group1' can create instances of this page.

People in Group2 do not see this page type as an option when creating new pages, however they can still Copy and Paste existing instances of this page type! The copy is then editable by Group2. Is this correct behaviour? It doesn't seem right to me.

Also, is there any way to disable the 'Copy' functionality? What happens if an enthusiastic user copies and pastes an entire, massive website?

Thanks

#150929
Jul 04, 2016 7:28
Vote:
 

You can always listen to the content event for publishing and cancel it based on user role / page type as a workaround.

See http://world.episerver.com/blogs/Janaka-Fernando/Dates/2015/4/adding-custom-logic-to-your-publishing-step/

for some examples. It's pretty easy and fast to implement. It would be neat to have some more options to block copy on some page types and not only create.

#150933
Edited, Jul 04, 2016 10:16
A.D
Vote:
 

Thanks for the link Daniel, that helps

I really think that the Access attribute should stop users from copying anything but the types they have access to. This seems like a bug to me, unless someone can explain otherwise. As far as I'm concerned "Copy and Paste" = "Create".

Anyway, something like this might work in certain situations - you can still copy, but not paste:

   public void Initialize(InitializationEngine context)
   {

            var contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();

            contentEvents.CreatingContent += contentEvents_CreatingContent;
    }       

 private void contentEvents_CreatingContent(object sender, ContentEventArgs e)
        {
            if (e.Content is IChangeTrackable)

            {
                if (PrincipalInfo.CurrentPrincipal.IsInRole("SomeRole") && !(e.Content is SomeContentType)) 
                {
                    e.CancelAction = true;

                    e.CancelReason = "You don't have permission to create this type of page.";
                }
            }
        }
#150950
Jul 05, 2016 3:58
* 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.