+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / unlock pages user permissions. possible?

unlock pages user permissions. possible?

9 posts, 0 answered
  1. John Reitz
    John Reitz avatar
    1 posts
    Registered:
    09 Apr 2010
    09 Apr 2010
    Link to this post
    I am looking for a way to allow a non-administrator to "unlock" (cancel changes) to a locked page. For example. a user edits a page but then before saving, closes the browser. This causes the page to be locked for any other user. I would like to designate a role that could be assigned to one user who is not the site administrator role to be able to cancel that users changes and unlock the pages for the other userws to be able to edit. There appears to be a cronic issue with a user accidently locking pages then leaving town for weeks at a time..

    i tried creating a "userAdmin" Role that has alot of permissions set, but i must not have the combo right, or it might not be possible?

    please let me know how this can be done.
    thanks
    john
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    11 Apr 2010
    Link to this post
    Hi John Reitz,

    There is no way to unlock a page that has been unlocked by a user if the current user does not belong to "administrators" role. Actually you could implement a simple custom logic to the Grid of the pages and allow certain users to unlock pages. You need to create a new TemplateField of the GridView with  two buttons - one will unlock and save and the other will cancel the changes.

    Sitefinity\Admin\ControlTemplates\Pages\AllPagesList.ascx


    <asp:GridView ID="GridView1" AllowPaging="true" AllowSorting="true" PageSize="20" AutoGenerateColumns="false" GridLines="none" CssClass="listItems" runat="server">
            <Columns>
                <asp:TemplateField ItemStyle-CssClass="check">
                    <HeaderTemplate><asp:CheckBox ID="checkAll" runat="server"/></HeaderTemplate>
                    <ItemTemplate><asp:CheckBox runat="server" ID="rowCheck"/></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="<%$Resources:Name %>" SortExpression="MenuName">
                    <ItemStyle CssClass="gridContentTitle" />
                    <ItemTemplate>
                        <asp:HyperLink ID="AdminPageLink" runat="server" NavigateUrl='<%# Eval("AdminURL") %>'><%#Eval("MenuName")%></asp:HyperLink>
                        <asp:Label ID="fullNameLabel" runat="server" CssClass="sfFullPageName"><%#Eval("Name")%></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="<%$Resources:Template %>">
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("TemplateUrl") %>'><%# Eval("TemplateName") %></asp:HyperLink>
                    </ItemTemplate>               
                </asp:TemplateField>
                <asp:BoundField DataField="DateModified" SortExpression="DateModified" HeaderText="<%$Resources:Modified %>" HeaderStyle-CssClass="GridHeader_SiteFinity" DataFormatString="<%$Resources:ModifiedDateFormat %>" HtmlEncode="false" />
                <asp:BoundField DataField="Modifier" HeaderText="<%$Resources:ModifiedBy %>" SortExpression="LastModifier" HeaderStyle-CssClass="GridHeader_SiteFinity" />
                <asp:TemplateField HeaderText="<%$Resources:Status %>" SortExpression="Status" HeaderStyle-CssClass="GridHeader_SiteFinity">
                    <ItemTemplate>
                        <asp:Label ID="statusMessage" runat="server" CssClass="stat"><%#Eval("Status")%></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>                   
                    <ItemTemplate>
                        <asp:Label runat="server" ID="noPreview"
                        Visible="false" ToolTip="<%$Resources:NoPreviewForGroupPages %>" Text="<%$Resources:NoPreview %>" />
                        <asp:HyperLink runat="server" ID="preview" NavigateUrl='<%# Eval("DefaultUrl") %>' ToolTip="<%$Resources:PreviewTooltip %>"
                            Target="_blank" Text="<%$Resources:Preview %>">
                        </asp:HyperLink>  
                    </ItemTemplate>
                    <ItemStyle CssClass="gridActions" />
                </asp:TemplateField>
                <asp:TemplateField AccessibleHeaderText="<%$Resources:Delete %>">
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="cmdDelete" CommandName="Delete" Text="<%$Resources:Delete %>" ToolTip="<%$Resources:Delete %>"></asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle CssClass="gridActions delete" />
                </asp:TemplateField>
                 
                <asp:TemplateField AccessibleHeaderText="Unlock">
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="Unlock" CommandArgument='<%# Eval("ID") %>' CommandName="Unlock" Text="Unlock and Save" ToolTip="Unlock and Save"></asp:LinkButton>
                    <asp:LinkButton runat="server" ID="UnlockCancel" CommandArgument='<%# Eval("ID") %>' CommandName="UnlockCancel" Text="Unlock and Cancel" ToolTip="Unlock and Cancel"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>



    public void Page_Load(object sender, EventArgs e)
       {
           GridView1.RowCommand += new GridViewCommandEventHandler(GridView1_RowCommand);
       }
     
       void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
       {
     
           var cmsManager = new Telerik.Cms.CmsManager();
           switch (e.CommandName)
           {
               
               case "Unlock":
               Telerik.Cms.IPage pSave = cmsManager.GetPage(new Guid(e.CommandArgument.ToString()), true);
               pSave.Staged.CheckIn();
               break;
               case "UnlockCancel":
               Telerik.Cms.IPage pCancel = cmsManager.GetPage(new Guid(e.CommandArgument.ToString()), true);
               pCancel.Staged.UndoCheckOut();
               break;
           }
            
       }


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Petr
    Petr avatar
    34 posts
    Registered:
    03 Jan 2011
    08 Mar 2011
    Link to this post
    Hi,

    I've tried to implement it for SF 3.7, but it doesn't work properly.

    It locks/unlocks only pages, which are locked by me (I have admin rights). The next issue is refresh of gridview: if I click to one of these links, grid is not refreshed automatically.

    Any ideas?

    Thanks

    Petr

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    08 Mar 2011
    Link to this post
    Hi Petr,

    This should work in 3.7 SP3 and SP4. Also the Linkbutton causes post back, so the grid should be updated properly.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  5. Petr
    Petr avatar
    34 posts
    Registered:
    03 Jan 2011
    09 Mar 2011
    Link to this post
    Hi,

    thanks for answer. We're using SP4, but it doesn't work.

    Any idea?

    Thanks

    Petr
  6. Chris Rigdon
    Chris Rigdon avatar
    4 posts
    Registered:
    19 Feb 2010
    10 Mar 2011
    Link to this post
    We are using sp3 and this doesn't work for us either.
  7. Petr
    Petr avatar
    34 posts
    Registered:
    03 Jan 2011
    28 Mar 2011
    Link to this post
    Thanks. Have you found any workaround? Any other official help from Telerik?

    Thanks

    Petr
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    31 Mar 2011
    Link to this post
    Hello Chris,

    Have you tried to call GridView1.DataBind(); ?

                    case "Unlock":
                    Telerik.Cms.IPage pSave = cmsManager.GetPage(new Guid(e.CommandArgument.ToString()), true);
                    pSave.Staged.CheckIn();
                    GridView1.DataBind();
                    break;

    I verified the code and it works.

    Greetings,
    Ivan Dimitrov
    the Telerik team
  9. Lisa
    Lisa avatar
    2 posts
    Registered:
    02 Dec 2013
    29 Apr 2015 in reply to Ivan Dimitrov
    Link to this post
    There is a Sitefinity feature request for settings to "Enable non Administrators to unlock content items". You can vote for it here:
    http://feedback.telerik.com/Project/153/Feedback/Details/157038-enable-non-administrators-to-unlock-content-items

Register for webinar
9 posts, 0 answered