using EPiServer.Security;
namespace development
{
public class EditDynPropEditAccess : EPiServer.Edit.EditDynProp
{
public override AccessLevel RequiredAccess()
{
return AccessLevel.Edit;
}
}
}
2. Ändra i EditDynProp.aspx så att den ärver från din klass, dvs
<%@ Page language="c#" Codebehind="EditDynPropEditAccess.cs" AutoEventWireup="false" Inherits="development.EditDynPropEditAccess" %>
Och det är allt.
"Det är en god idé, har lagt in det som önskemål. Vi får titta närmare på det i en framtida version och se vad vi kan göra."
Vad hände? Vilken framtida version gäller det?
And as John asks, is it possible to do in 6 R2??
I have done it. My solution is no better than the one for episerver 4 althought it doesnt quite work to do exactly the same. I used this post: http://www.markeverard.com/blog/2010/08/12/editor-access-to-episerver-admin-functionality/ but ran into a problem with the icon for dynamic properties always being grayed out dispite setting it to "publishers". This was enough in EPiServer 4 but not anymore - unless I missed something. Either way I got to to work by copying the icon code and duplicating it. Then I used javascript to show or hide the icons depending which permissions the user has. It works perfectly except you start to get errors about tampering... so to solve that i added httpcookie as described in this post: http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=59034.
problem solved. and yes, where is episervers solution? which should be far simpler than this!
I do question the need to allow publishers access to this feature but in my customers case it was necessary as the user(s) who needed access to the dynamic property are support personell who are not regular editors. They also needed to set the dynamic property on different places in the site for different reasons. It has been done this way for many years and it worked perfectly well - I think EPiServer just forgot.
I guess that it wouldn't be so much work to do your own dynamic property manager pagetype. But such a solutionen shouldnt be necessary.
/Per
Just for clarification:
This is the code that EPiServer provides:
<EPiServerUI:ToolButton runat="server" ID="DynPropCommandTool" GeneratesPostBack="false" RequiredAccess="Publish" SkinID="Property" ToolTip="<%$ Resources: EPiServer, edit.editcommand.editdynprophelp %>" />
<EPiServerScript:ScriptCommandEvent ID="ScriptCommandEvent4" runat="server" CommandTypeName="DynamicProperties" EventType="Click" NavigateUrl="EditDynProp.aspx" EventTargetID="DynPropCommandTool" />
and changing requiredAccess to publish didnt seem to be enough (it was for episerver 4).
So I added another button:
<EPiServerUI:ToolButton runat="server" ID="DynPropCommandTool2" GeneratesPostBack="false" RequiredAccess="Publish" SkinID="Property" ToolTip="<%$ Resources: EPiServer, edit.editcommand.editdynprophelp %>" />
<EPiServerScript:ScriptCommandEvent ID="ScriptCommandEvent4b" runat="server" CommandTypeName="DynamicProperties" EventType="Click" NavigateUrl="EditDynProp.aspx" EventTargetID="DynPropCommandTool2" />
and some script:
$(function(){
var mypublishaccess = "<%= CurrentPage.ACL.QueryDistinctAccess(EPiServer.Security.AccessLevel.Publish) %>";
var myadminaccess = "<%= CurrentPage.ACL.QueryDistinctAccess(EPiServer.Security.AccessLevel.Administer) %>";
if (mypublishaccess == "True" && myadminaccess == "False")
{
$('#ctl00_FullRegion_Commands_DynPropCommandTool').parent().hide();
$('#ctl00_FullRegion_Commands_DynPropCommandTool2').show();
}
else
{
$('#ctl00_FullRegion_Commands_DynPropCommandTool').show();
$('#ctl00_FullRegion_Commands_DynPropCommandTool2').parent().hide();
}
});
its bizzare but it works.