GuiPlugin visible only for Administrators?

Vote:
 
Hi, is ther anyone who know how to hide a plugin for non-Administrators in EPiServer? [GuiPlugIn( DisplayName="All Properties", Description="Show all properties for the page", Area=PlugInArea.EditPanel, Url="~/uppsala/plugin/ShowAllProperties.ascx" )] public class ShowAllProperties : EPiServer.UserControlBase { protected System.Web.UI.WebControls.DataGrid propertiesDataGrid; protected System.Web.UI.WebControls.Literal propertiesLiteral; private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { } else { } } }
#12965
Mar 25, 2008 18:35
Vote:
 
Hi Linus! If you implement the ICustomPlugInLoader interface, you get the chance to control wether to load your plugin or not depending of, for example, user having admin access. For example: [GuiPlugIn( DisplayName="All Properties", Description="Show all properties for the page", Area=PlugInArea.EditPanel, Url="~/uppsala/plugin/ShowAllProperties.ascx" )] public class ShowAllProperties : EPiServer.UserControlBase, ICustomPlugInLoader { protected System.Web.UI.WebControls.DataGrid propertiesDataGrid; protected System.Web.UI.WebControls.Literal propertiesLiteral; PlugInDescriptor[] ICustomPlugInLoader.List() { if( !Global.EPConfig.HasAdminAccess ) return new PlugInDescriptor[0]; return new PlugInDescriptor[]{PlugInDescriptor.Load(typeof(ShowAllProperties))}; } private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { } else { } } } Regards, Johan Olofsson
#15175
Mar 25, 2008 18:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.