MM-67398 Added checks for instance and webhooks commands#635
Open
avasconcelos114 wants to merge 3 commits intomasterfrom
Open
MM-67398 Added checks for instance and webhooks commands#635avasconcelos114 wants to merge 3 commits intomasterfrom
avasconcelos114 wants to merge 3 commits intomasterfrom
Conversation
nevyangelova
reviewed
Feb 3, 2026
nevyangelova
left a comment
There was a problem hiding this comment.
Thanks @avasconcelos114 a couple of comments
server/command.go
Outdated
|
|
||
| if !isSysAdmin { | ||
| p.postCommandResponse(args, "Only System Admins are allowed to manage instances.", true) | ||
| return &model.CommandResponse{}, nil |
There was a problem hiding this comment.
Nit: Use return p.getCommandResponse(args, ...) here to match the pattern in handleWebhookHandler
server/command_test.go
Outdated
|
|
||
| _, _ = p.handleInstallInstance(args, []string{}) | ||
|
|
||
| assert.Contains(t, capturedMessage, "Only System Admins are allowed to set up the plugin.") |
There was a problem hiding this comment.
this calls handleInstallInstance directly but the new permission check is in handleInstance. Is the existing check in handleInstallInstance now redundant?
Contributor
Author
There was a problem hiding this comment.
Great point, this PR moved the sysadmin check higher up the chain which renders the additional checks that exist solely in handleInstallInstance unnecessary, I'll remove that and update tests to reflect this
nevyangelova
approved these changes
Feb 3, 2026
marianunez
approved these changes
Feb 5, 2026
Member
marianunez
left a comment
There was a problem hiding this comment.
LGTM - thanks @avasconcelos114!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds extra checks when processing slash commands
Ticket Link
Closes https://mattermost.atlassian.net/browse/MM-67398