code: public List<Permission> getEffectivePermissions(UserPrincipal user) {
          final LinkedHashSet<Permission> permissions = new LinkedHashSet<>();
          if (user.getPermissions() != null) {
              permissions.addAll(user.getPermissions());
          }
          if (user.getTeams() != null) {
              for (final Team team: user.getTeams()) {
                  final List<Permission> teamPermissions = getObjectById(Team.class, team.getId()).getPermissions();
                  if (teamPermissions != null) {
                      permissions.addAll(teamPermissions);
                  }
              }
          }
          return new ArrayList<>(permissions);
      }
docs: Determines the effective permissions for the specified user by collecting
  a List of all permissions assigned to the user either directly, or through
  team membership.
  @param user the user to retrieve permissions for
  @return a List of Permission objects
  @since 1.1.0