(Quick Reference)

userHasAllRoles(roleList)

Available in Controllers, Domains, Taglibs and Services

This method returns true if the current user has all of the roles listed.

The implementation of this method is provided by the security provider you have installed.

Usage

class PurchaseService {
    void updatePurchase(Purchase p) {
        if (userHasAllRoles(['ROLE_CUSTOMER', 'ROLE_MANAGER'])) {
            …
        }
    }
    …
}

Arguments

NameDescription
roleListThe list of roles to test for