Skip to content

Commit

Permalink
Add UserHasBeenDeactivated hook to disconnect user (#315)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
  • Loading branch information
MatthewDorner and hanzei authored Aug 30, 2023
1 parent 835b440 commit 4697cd7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.0
github.com/mattermost/mattermost/server/public v0.0.8
github.com/mattermost/mattermost/server/public v0.0.9-0.20230830065520-5de1e306de52
github.com/microcosm-cc/bluemonday v1.0.19
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d h1:/RJ/UV7M5c7L2TQ
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
github.com/mattermost/logr/v2 v2.0.16 h1:jnePX4cPskC3WDFvUardh/xZfxNdsFXbEERJQ1kUEDE=
github.com/mattermost/logr/v2 v2.0.16/go.mod h1:1dm/YhTpozsqANXxo5Pi5zYLBsal2xY0pX+JZNbzYJY=
github.com/mattermost/mattermost/server/public v0.0.8 h1:YFgI5zT2U5xOvrYMb7s1YtwuLGNFModi8XJMS1zZHWE=
github.com/mattermost/mattermost/server/public v0.0.8/go.mod h1:sgXQrYzs+IJy51mB8E8OBljagk2u3YwQRoYlBH5goiw=
github.com/mattermost/mattermost/server/public v0.0.9-0.20230830065520-5de1e306de52 h1:MFPVn7arQrF/eioUT2LHf9ERSM9GuHkYjCSboAp3RlI=
github.com/mattermost/mattermost/server/public v0.0.9-0.20230830065520-5de1e306de52/go.mod h1:sgXQrYzs+IJy51mB8E8OBljagk2u3YwQRoYlBH5goiw=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
Expand Down
6 changes: 6 additions & 0 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,12 @@ func (p *Plugin) OnPluginClusterEvent(c *plugin.Context, ev model.PluginClusterE
p.HandleClusterEvent(ev)
}

func (p *Plugin) UserHasBeenDeactivated(c *plugin.Context, user *model.User) {
if info, _ := p.getGitlabUserInfoByMattermostID(user.Id); info != nil {
p.disconnectGitlabAccount(user.Id)
}
}

func (p *Plugin) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) {
// If not enabled in config, ignore.
if p.getConfiguration().EnableCodePreview == "disable" {
Expand Down

0 comments on commit 4697cd7

Please sign in to comment.