public Mono<ServicePermission> isAllowedToCreateGroup(
            @NotNull Long requesterId,
            @Nullable UserRole auxiliaryUserRole) {
        try {
            Validator.notNull(requesterId, "requesterId");
        } catch (ResponseException e) {
            return Mono.error(e);
        }
        Mono<UserRole> userRoleMono = auxiliaryUserRole == null
                ? userRoleService.queryStoredOrDefaultUserRoleByUserId(requesterId)
                : Mono.just(auxiliaryUserRole);
        return userRoleMono.flatMap(userRole -> {
            Integer ownedGroupLimit = userRole.getOwnedGroupLimit();
            if (ownedGroupLimit == Integer.MAX_VALUE) {
                return Mono.just(ServicePermission.get(ResponseStatusCode.OK));
            }
            return countOwnedGroups(requesterId).map(ownedGroupsNumber -> {
                ResponseStatusCode code;
                String reason = null;
                if (ownedGroupsNumber < ownedGroupLimit) {
                    code = ResponseStatusCode.OK;
                } else {
                    code = ResponseStatusCode.MAX_OWNED_GROUPS_REACHED;
                    reason = "The number of groups owned by the requester has reached the limit "
                            + ownedGroupLimit;
                }
                return ServicePermission.get(code, reason);
            });
        })
                .defaultIfEmpty(
                        ServicePermission.get(ResponseStatusCode.NOT_ACTIVE_USER_TO_CREATE_GROUP));
    }
@return Possible codes: {@link ResponseStatusCode#OK},
        {@link ResponseStatusCode#LOGGING_IN_USER_NOT_ACTIVE},
        {@link ResponseStatusCode#MAX_OWNED_GROUPS_REACHED}
turms-service/src/main/java/im/turms/service/domain/group/service/GroupService.java