code: public Collection<Permission> getAggregatePermissions() {
          if (aggregatePermissions == null) {
              Set<Permission> perms = new LinkedHashSet<>();
              perms.addAll(permissions);
              for (Role role : roles) {
                  perms.addAll(role.getPermissions());
              }
  
              if (perms.isEmpty()) {
                  aggregatePermissions = Collections.emptySet();
              } else {
                  aggregatePermissions = Collections.unmodifiableSet(perms);
              }
          }
  
          return aggregatePermissions;
      }
docs: Gets the collection of permissions including the role permissions and discrete permissions.
  
  @return a collection of aggregate permissions