protected void MyPartManager_AuthorizeWebPart(object sender, WebPartAuthorizationEventArgs e) { // Ignore authorization in Visual Studio Design Mode if (this.DesignMode) { return; } // Authorize a web part or not Type PartType = e.Type; if (PartType == typeof(CustomerNotesPart)) { if (User.Identity.IsAuthenticated) { if (User.IsInRole("BUILTIN\\Administrators")) { e.IsAuthorized = true; } else { e.IsAuthorized = false; } } else { e.IsAuthorized = false; } } }
protected void wpmManager_AuthorizeWebPart(object sender, WebPartAuthorizationEventArgs e) { // Hide the Unallocated Orders web part if allocation is not enabled if (e.Path.EndsWith("wpUnallocatedOrders.ascx", StringComparison.CurrentCultureIgnoreCase)) { e.IsAuthorized = Orchestrator.WebUI.Utilities.IsAllocationEnabled(); } }
protected override void OnAuthorizeWebPart(WebPartAuthorizationEventArgs e) { if (PEContext.Current.Admin.Identity.IsAuthenticated) { if (!string.IsNullOrEmpty(e.AuthorizationFilter) && Enum.IsDefined(typeof(OperateCode), e.AuthorizationFilter)) { OperateCode operateCode = (OperateCode)Enum.Parse(typeof(OperateCode), e.AuthorizationFilter); if (operateCode == OperateCode.None) { e.IsAuthorized = true; } else { e.IsAuthorized = RolePermissions.AccessCheck(operateCode); } } } else { e.IsAuthorized = false; } }
protected void MyPartManager_AuthorizeWebPart(object sender, WebPartAuthorizationEventArgs e) { // Ignore authorization in Visual Studio Design Mode if (this.DesignMode) return; // Authorize a web part or not Type PartType = e.Type; if (PartType == typeof(CustomerNotesPart)) { if (User.Identity.IsAuthenticated) { if (!User.IsInRole("BUILTIN\\Administrators")) e.IsAuthorized = true; else e.IsAuthorized = false; } else { e.IsAuthorized = false; } } }