Groovy get user penrmission

I need to get all permissions by User. I’m tried to using
def admin = userSession.getPermissionsByType(), and get it from params
def admin = userSession.getAttribute(), but it all show MissingMethodException

Hi,
Please move topic to Support. Community How Tos is for tutorials only.

This should work (Groovy code):

Map<String, Integer> permissions = new HashMap<>()
PermissionType.values().each {
    permissions.putAll(userSession.getPermissionsByType(it))
}