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 .