mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/provisioning: add option to skip identifier validation in create group
This commit is contained in:
parent
bea28c1381
commit
76cb8ee7d3
2 changed files with 8 additions and 2 deletions
|
|
@ -826,6 +826,10 @@ type GroupFieldCapability struct {
|
|||
|
||||
// Only for the disappear field: allowed disappearing settings
|
||||
DisappearSettings *event.DisappearingTimerCapability `json:"settings,omitempty"`
|
||||
|
||||
// This can be used to tell provisionutil not to call ValidateUserID on each participant.
|
||||
// It only meant to allow hacks where ResolveIdentifier returns a fake ID that isn't actually valid for MXIDs.
|
||||
SkipIdentifierValidation bool `json:"-"`
|
||||
}
|
||||
|
||||
type GroupCreateParams struct {
|
||||
|
|
|
|||
|
|
@ -47,8 +47,10 @@ func CreateGroup(ctx context.Context, login *bridgev2.UserLogin, params *bridgev
|
|||
participant = parsedParticipant
|
||||
params.Participants[i] = participant
|
||||
}
|
||||
if uidValOK && !userIDValidatingNetwork.ValidateUserID(participant) {
|
||||
return nil, bridgev2.RespError(mautrix.MInvalidParam.WithMessage("User ID %q is not valid on this network", participant))
|
||||
if !typeSpec.Participants.SkipIdentifierValidation {
|
||||
if uidValOK && !userIDValidatingNetwork.ValidateUserID(participant) {
|
||||
return nil, bridgev2.RespError(mautrix.MInvalidParam.WithMessage("User ID %q is not valid on this network", participant))
|
||||
}
|
||||
}
|
||||
if api.IsThisUser(ctx, participant) {
|
||||
return nil, bridgev2.RespError(mautrix.MInvalidParam.WithMessage("You can't include yourself in the participants list", participant))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue