2017-01-30 5 views
2

두 그룹 ts_admin 및 ts_users가 있습니다. 로그인 페이지에서 로그인 후 관리자는 곧바로 관리보기로 이동하고 사용자는 사용자보기로 이동해야합니다. 나는 그것에 대해 어떻게 가야할지 모르겠다. 나는 도움이 필요하다. 보안 제약 조건을 포함하는 XML 페이지를로드했을 가능성이 있습니다.보안 제약 조건을 사용하여 사용자를 특정 페이지로 리디렉션하는 방법은 무엇입니까?

<welcome-file-list> 
    <welcome-file>index.html</welcome-file> 
</welcome-file-list> 

<security-constraint> 
    <display-name>timesheet user permission</display-name> 
    <web-resource-collection> 
     <web-resource-name>timesheet_user_resources</web-resource-name> 
     <url-pattern>/index.html</url-pattern> 
     <url-pattern>/</url-pattern> 
     <url-pattern>/rs/*</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>POST</http-method> 
     <http-method>PUT</http-method> 
     <http-method>DELETE</http-method> 
     <http-method>OPTIONS</http-method> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>ts_users</role-name> 
    </auth-constraint> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

<security-role> 
    <role-name>ts_users</role-name> 
</security-role> 
<security-role> 
    <role-name>ts_admins</role-name> 
</security-role> 

<security-constraint> 
    <display-name>timesheet admin permissions</display-name> 
    <web-resource-collection> 
     <web-resource-name>timesheet_admin_resources</web-resource-name> 
     <url-pattern>/rs/*</url-pattern> 

     <url-pattern>/indexAdmin.html</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>POST</http-method> 
     <http-method>PUT</http-method> 
     <http-method>DELETE</http-method> 
     <http-method>OPTIONS</http-method> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>ts_admins</role-name> 
    </auth-constraint> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

<login-config> 
    <auth-method>FORM</auth-method> 
    <realm-name>MyRealm</realm-name> 

    <form-login-config id="FormLoginConfig_1"> 
     <form-login-page>/login.html</form-login-page> 
     <form-error-page>/error.html</form-error-page> 
    </form-login-config> 
</login-config> 

답변

0

로드 된 XML 파일은 잘 설정되고 그것은 어떤 변경이 필요하지 않습니다. 나는 쉽게 교환 할 수 있도록 index와 indexAdmin 페이지에 대한 링크를 만들었고, ng-show를 사용하여 시스템이 관리자로 인증 할 때 링크 만 표시했습니다. JS 페이지에 다음을 추가했습니다. $scope.isAdmin = data.data.admin;