2017-01-30 104 views
2

我有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;

相關問題