More in this section

Forums / General Discussions / Permissions for all the widgets in a page.

Permissions for all the widgets in a page.

2 posts, 0 answered
  1. kalaivani
    kalaivani avatar
    2 posts
    19 Feb 2015
    08 Apr 2015
    Link to this post

    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.

  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    18 Sep 2017
    13 Apr 2015
    Link to this post

    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 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.
    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.

    Stanislav Velikov
    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
2 posts, 0 answered