determine edit mode?????????????????????????????????????

Vote:
 
Using the episerver api how do you determine if you are in edit mode if not? And no I do not want to determine this by looking at querystring. The reason I am wanting this is because I want to assign role permissions to property types, not just at page type level.
#15971
Mar 25, 2008 19:07
Vote:
 
There is currently no other way to determine if a page is in episervers edit mode than looking at the request. You can always investigate if the current page is read only or not to see if the page is beeing edited though. Another aproach is to use a control adapter to hide certain properties for a user. Here is some code to get started. You also have to register the control adapter in the app_browsers\adaptermappings.browser file by adding the following row: Here the sample adapter that hides the property for all users not beeing member of the group "nonexistingrole": using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using EPiServer.Web.PropertyControls.Adapters; using EPiServer.Security; namespace EPiServer.Test { public class PropertyControlSecurityAdapter : PropertyDataControlAdapter { public override bool DisplayEditUI { get { return EPiServer.Security.PrincipalInfo.Current.Principal.IsInRole("nonexistingrole"); } } } } Good luck! Linus Ekström EPiServer Development Team
#16719
Mar 25, 2008 19:15
Vote:
 
man, this really sux (to be frank) this should be pretty basic.
#16720
Mar 25, 2008 19:15
Vote:
 
Hi Sam, have you tried checking the url? e.g. if (HttpContext.Current.Request.UrlReferrer != null) { mode = Regex.IsMatch(HttpContext.Current.Request.UrlReferrer.LocalPath, "/admin/|/edit/", RegexOptions.IgnoreCase); } return mode;
#16721
Mar 25, 2008 19:15
Vote:
 
Hi Sam, have you tried checking the url? e.g. if (HttpContext.Current.Request.UrlReferrer != null) { mode = Regex.IsMatch(HttpContext.Current.Request.UrlReferrer.LocalPath, "/admin/|/edit/", RegexOptions.IgnoreCase); } return mode;
#16722
Mar 25, 2008 19:15
Vote:
 
Whats up with all those questionmarks?
#16723
Mar 25, 2008 19:15
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.