protected internal override void OnInit(IDotvvmRequestContext context) { var user = context.HttpContext.User; var isAuthenticated = user?.Identity?.IsAuthenticated == true; if (!HideForAnonymousUsers || isAuthenticated) { if (isAuthenticated && IsMember(user)) { IsMemberTemplate?.BuildContent(context, this); } else { IsNotMemberTemplate?.BuildContent(context, this); } } }
protected internal override void OnInit(IDotvvmRequestContext context) { var isAuthenticated = context.OwinContext.Request?.User?.Identity?.IsAuthenticated; if (isAuthenticated == true || !HideNonAuthenticatedUsers) { var isMember = Roles? .Where(r => !string.IsNullOrWhiteSpace(r)) .Any(r => context.OwinContext.Request?.User?.IsInRole(r.Trim()) == true); if (isMember == true) { IsMemberTemplate?.BuildContent(context, this); } else { IsNotMemberTemplate?.BuildContent(context, this); } } }