Skip to content

Conversation

@hairmare
Copy link

@hairmare hairmare commented Jun 3, 2019

This PR allows specifying a list of email domains that are still allowed to send DMs if their email is on a specific domain.

This helped us reach some of the requirements needed in a large(ish) edu installation.

I'm opening this PR to elicit some feedback on the implementation. Would you be interested in adding such a feature to the disable-dm plugin? I'm sure the implementation needs some cleanup which I would take care of should you be interested in landing the feature.

RejectDMs bool `json:"RejectDMs"`
RejectGroupChats bool `json:"RejectGroupChats"`
RejectionMessage string `json:"RejectionMessage"`
AllowedDomains string `json:"AllowedDomains"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could add some validations for AllowedDomains in IsValid method below.

config.Mattermost.LogInfo("Got User: " + user.Email)
}

for _, domain := range strings.Split(conf.AllowedDomains, "\n") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you also want to trim spaces here.


if user.Email != "" {
config.Mattermost.LogInfo("Got User: " + user.Email)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Any particular reason for not adding a log if the users email is an empty string?

  2. In the loop below, you have checked for email being in allowed domains even if it is an empty string. So, what would happen if the AllowedDomains has a blank line or is empty and the user's email is also empty?

@hairmare
Copy link
Author

Hey @chetanyakan Thanks for your feedback, I'll look into it and try to address your inputs.

@FITZKRAWALLDO
Copy link

I recommend to whitelist different art of taxometries. examples: Teams, Domains, User

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants