각 사용자에 대해보기에서 다른 콘텐츠를 렌더링하고 싶습니다. Asp.net mbc4 에서 적절한 방법은 무엇 입니까 ?
스프링 보안에서 뷰를 보호하는 것과 비슷한 것을 찾고 있습니다.
<sec:authorize access="hasRole('supervisor')">
This content will only be visible to users who have
the "supervisor" authority in their list of <tt>GrantedAuthority</tt>s.
</sec:authorize>
지금까지는 컨트롤러에 대한 액세스 만 보호 할 수 있습니다.
[Authorize(Roles = "supervisor")]
public ActionResult Index()
{
return View("");
}
귀하의 관점에서 귀하의 User
자산 에 대한 점검을 수행 할 수 있어야 합니다.
@if(User.IsInRole("supervisor"))
{
//Markup here...
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다