Grails with SpringSecurity, check if the current user can access controller / action

前端 未结 8 2269
轮回少年
轮回少年 2021-02-15 13:57

I\'m currently developing a menu for my application that should be able to display only the controllers that the current user can access (requestmap defined in the database).

8条回答
  •  鱼传尺愫
    2021-02-15 14:05

    To check roles in view : Spring security plugin provides ifAllGranted, ifAnyGranted, ifNoneGranted etc., tags to check roles

    For example, to check Admin Role of logged in User :

    
        
            Admin resource
         
    
    

    (tested in grails-2.2.2 and springSecurityCorePlugin-1.2.7.3)

提交回复
热议问题