Esempio n. 1
0
 /// <summary>
 /// Se eu quiser desabilitar algo na view razor, por exemplo desabilitar um botao
 /// </summary>
 /// <param name="page"></param>
 /// <param name="claimName"></param>
 /// <param name="claimValue"></param>
 /// <returns></returns>
 public static string IfClaimShow(this RazorPage page, string claimName, string claimValue)
 {
     return(CustomAuthorization.ValidarClaimsUsuario(page.Context, claimName, claimValue) ? "" : "disabled");
 }
Esempio n. 2
0
 /// <summary>
 /// se eu quiser esconder algo,por exempllo se eu quiser mostrar o link se o usuario tiver determinada claim
 /// </summary>
 /// <param name="page"></param>
 /// <param name="context"></param>
 /// <param name="claimName"></param>
 /// <param name="claimValue"></param>
 /// <returns></returns>
 public static IHtmlContent IfClaimShow(this IHtmlContent page, HttpContext context, string claimName, string claimValue)
 {
     return(CustomAuthorization.ValidarClaimsUsuario(context, claimName, claimValue) ? page : null);
 }
Esempio n. 3
0
 /// <summary>
 /// se quiser validar algo na view do razor, baseado em uma claim
 /// </summary>
 /// <param name="page"></param>
 /// <param name="claimName"></param>
 /// <param name="claimValue"></param>
 /// <returns></returns>
 public static bool IfClaim(this RazorPage page, string claimName, string claimValue)
 {
     return(CustomAuthorization.ValidarClaimsUsuario(page.Context, claimName, claimValue));
 }