I'm trying to set the permissions so that only one role of my choosing can view them. The code seems to be executing correctly, but when viewing the permissions in the backend pages it still looks like it is when having default permissions.

However the code must have done something, because when trying set the permissions in the backend to the role i specified in my code i get an error saying return code 0, but checking any other role works ok.

You have to remove manager.SaveChanges();, because the method is called internally. When you call this method this causes duplicate entries in sf_permissions table. Delete the broken item and re upload it.

Best wishes,
Ivan Dimitrov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Yes, first you need to break the inheritance, because the Image/File inherits permissions from the parent - Album. You should work only with the master and you should add the permissions only if they are null for the given principal.

The code below explicitly breaks the inheritance for the content item. You should use ContentLifecycleStatus.Master which is the primary state of an item and always exists. It is not required to have an item in draft mode.

Greetings,
Ivan Dimitrov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Webinars

Tools

Progress, Telerik, Sitefinity and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.