Permissions for all the widgets in a page.

Posted by Community Admin on 03-Aug-2018 09:14

Permissions for all the widgets in a page.

All Replies

Posted by Community Admin on 08-Apr-2015 00:00

Hi team, 

I have some doubts in setting the permissions of widgets in a page.

Instead of assigning the permission for each widget separate inside a page, is there any option to set the permission globally for all the widgets of a page.

In our project we have 2 main roles content manager and content writer. content manager should able to edit, move, delete and can add new content widget to the main page. And content writer only should able to edit and update the content widget to the main page, he is not allowed to delete or move the content widget. Finally it is worked well by editing the permission of each widget separate separately, also i checked it by logging in as content writer and content manager.

but to do this we need to edit the permission of each widget separately. If i delete a content widget and added a new content widget in that same place the permission of deleted content widget is not inherited to the new one. and again we need to set the permission from the scratch. so im searching a way to set the permission globally.  i also searched  a lot about page permission and permissions of all page, but there is no option to set move, delete permission for the widget, only edit content of the page, add widget to the page permission is there.
so now my question is,

 1. how to set permission to (move, delete, edit) all content widgets of a page(globally)?. and 

2. how to inherit the permissions to new content widget from the deleted one, or from the another content widget of the same page?.

 

 Thank u.

Posted by Community Admin on 13-Apr-2015 00:00

Hi,

Answering the two questions:

1. To set permissions on widgets different than the default set of permissions is best to do this using Sitefinity API for permissions. This is because the default permissions for widgets are rooted in the PageManager class.

To update permissions on a widget refer to the attached UpdatePermissionsOnWidget.zip containing a webform that accepts a title of a page and loops trough all of this page widgets assigning Authors role to have View permission over the widgets.

SecurityConstants.Sets.Controls.View
Update the above row to specify the rest of permissions available for permission set "Controls" and grant permissions for different roles.

2. To copy permissions you need a control that is placed and present on a page, permissions can`t be copied from a deleted control.
Referring to the sample attached it is needed to retrieve the control from which to copy and the control to copy to and then use CopyPermissions method available from PageManager class.
var manager = PageManager.GetManager();
                    manager.CopyPermissions(control1.Permissions, (IList)control2.Permissions, control1.Id, control2.Id);

For the API sample on working with controls on Sitefinity pages please refer to this documentation article.

Regards,
Stanislav Velikov
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed