robe-auth/src/main/java/io/robe/auth/token/TokenAuthenticator.java
private void getAllRolePermissions(RoleEntry parent, Set<PermissionEntry> rolePermissions) {
        rolePermissions.addAll(permissionStore.findByRoleId(parent.getId()));
        Set<RoleGroupEntry> roleGroupEntries = (Set<RoleGroupEntry>) roleGroupStore.findByGroupId(parent.getId());
        for (RoleGroupEntry entry : roleGroupEntries) {
            Optional<RoleEntry> role = (Optional<RoleEntry>) roleStore.findByRoleId(entry.getRoleId());
            getAllRolePermissions(role.get(), rolePermissions);
        }
    }
private void getAllRolePermissions(RoleEntry parent, Set<PermissionEntry> rolePermissions) {
        rolePermissions.addAll(permissionStore.findByRoleId(parent.getId()));
        Set<RoleGroupEntry> roleGroupEntries = (Set<RoleGroupEntry>) roleGroupStore.findByGroupId(parent.getId());
        for (RoleGroupEntry entry : roleGroupEntries) {
            Optional<RoleEntry> role = (Optional<RoleEntry>) roleStore.findByRoleId(entry.getRoleId());
            getAllRolePermissions(role.get(), rolePermissions);
        }
    }
Fill  permission list  with role and sub-role permissions recursively.

@param parent          Role to traverse.
@param rolePermissions list of all permissions of the given role.