13 Hierarchical Roles - Reference Documentation
Authors: Burt Beckwith, Beverley Talbott
Version: 2.0.0
13 Hierarchical Roles
Hierarchical roles are a convenient way to reduce clutter in your request mappings.Property | Default Value | Meaning |
---|---|---|
roleHierarchy | none | Hierarchical role definition. |
package com.mycompany.myappimport grails.plugin.springsecurity.annotation.Securedclass SomeController { @Secured(['ROLE_ADMIN', 'ROLE_FINANCE_ADMIN', 'ROLE_SUPERADMIN']) def someAction() { … } }
ROLE_FINANCE_ADMIN
implies being granted ROLE_ADMIN
, and that ROLE_SUPERADMIN
implies being granted ROLE_FINANCE_ADMIN
, you can express that hierarchy as:grails.plugin.springsecurity.roleHierarchy = ''' ROLE_SUPERADMIN > ROLE_FINANCE_ADMIN ROLE_FINANCE_ADMIN > ROLE_ADMIN '''
package com.mycompany.myappimport grails.plugin.springsecurity.annotation.Securedclass SomeController { @Secured(['ROLE_ADMIN']) def someAction() { … } }
ROLE_SUPERADMIN
, ROLE_FINANCE_ADMIN
, and ROLE_ADMIN
, now you only need to grant ROLE_SUPERADMIN
.