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
Jan 21, 2008 22:30
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
Jan 22, 2008 17:29
Vote:
 
man, this really sux (to be frank) this should be pretty basic.
#16720
Jan 24, 2008 1: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
Jan 24, 2008 6:49
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
Jan 24, 2008 6:49
Vote:
 
Whats up with all those questionmarks?
#16723
Jan 24, 2008 10:52
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.
* 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.