Skip to content

Commit

Permalink
MM-59369: reduce surface area (#708)
Browse files Browse the repository at this point in the history
* rm synthetic users

* really remove synthetic users

* rm ce2e

* wip

* rm embedded support

* gut syncChats and syncLinkedChannels, always enable syncNotifications

* remove remote bot account

* rm shared channels

* deadcode

* inline ah.getReplyFromChannel

* inline ah.getMessageFromChannel

* rm untested certificate-based subscriptions

* simplify activity handler to just chats

* rm channel subscription renewal

* go mod tidy
  • Loading branch information
lieut-data authored Jul 17, 2024
1 parent b5809c8 commit cb17aca
Show file tree
Hide file tree
Showing 49 changed files with 302 additions and 12,283 deletions.
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/enescakir/emoji v1.0.0
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/gosimple/slug v1.14.0
github.com/hashicorp/go-plugin v1.6.1
github.com/jmoiron/sqlx v1.4.0
github.com/lib/pq v1.10.9
Expand All @@ -29,7 +28,6 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/testcontainers/testcontainers-go v0.31.0
github.com/testcontainers/testcontainers-go/modules/mockserver v0.31.0
github.com/testcontainers/testcontainers-go/modules/postgres v0.31.0
gitlab.com/golang-commonmark/markdown v0.0.0-20211110145824-bf3e522c626a
golang.org/x/net v0.26.0
Expand Down Expand Up @@ -119,7 +117,6 @@ require (
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/schema v1.2.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/BraspagDevelopers/mock-server-client v0.2.2 h1:Zro0OonNeaDwkkQGIxeJQfYweNKZ+m+8QIlDZAFRc/4=
github.com/BraspagDevelopers/mock-server-client v0.2.2/go.mod h1:LHulrZSfbCNeS/CoycaWdhE495FnyeI3iXm6+4Zjz5c=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/HdrHistogram/hdrhistogram-go v0.9.0 h1:dpujRju0R4M/QZzcnR1LH1qm+TVG3UzkWdp5tH1WMcg=
github.com/HdrHistogram/hdrhistogram-go v0.9.0/go.mod h1:nxrse8/Tzg2tg3DZcZjm6qEclQKK70g0KxO61gFFZD4=
Expand Down Expand Up @@ -254,10 +252,6 @@ github.com/gorilla/schema v1.2.1 h1:tjDxcmdb+siIqkTNoV+qRH2mjYdr2hHe5MKXbp61ziM=
github.com/gorilla/schema v1.2.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/gosimple/slug v1.14.0 h1:RtTL/71mJNDfpUbCOmnf/XFkzKRtD6wL6Uy+3akm4Es=
github.com/gosimple/slug v1.14.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ=
github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o=
github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc=
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/grpc-ecosystem/grpc-gateway v1.5.0 h1:WcmKMm43DR7RdtlkEXQJyo5ws8iTp98CyhCCbOHMvNI=
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
Expand Down Expand Up @@ -582,8 +576,6 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
github.com/testcontainers/testcontainers-go v0.31.0 h1:W0VwIhcEVhRflwL9as3dhY6jXjVCA27AkmbnZ+UTh3U=
github.com/testcontainers/testcontainers-go v0.31.0/go.mod h1:D2lAoA0zUFiSY+eAflqK5mcUx/A5hrrORaEQrd0SefI=
github.com/testcontainers/testcontainers-go/modules/mockserver v0.31.0 h1:e5D1bRBs47TA0FeF9s3xUAXFOYNz8uTyVFAWrIcu6c0=
github.com/testcontainers/testcontainers-go/modules/mockserver v0.31.0/go.mod h1:BZCUIxWSnTx8riMhTwjjuyyW8IKZSD84ZjqiXeD7FHA=
github.com/testcontainers/testcontainers-go/modules/postgres v0.31.0 h1:isAwFS3KNKRbJMbWv+wolWqOFUECmjYZ+sIRZCIBc/E=
github.com/testcontainers/testcontainers-go/modules/postgres v0.31.0/go.mod h1:ZNYY8vumNCEG9YI59A9d6/YaMY49uwRhmeU563EzFGw=
github.com/throttled/throttled v2.2.5+incompatible h1:65UB52X0qNTYiT0Sohp8qLYVFwZQPDw85uSa65OljjQ=
Expand Down
307 changes: 117 additions & 190 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,193 +1,120 @@
{
"id": "com.mattermost.msteams-sync",
"name": "MS Teams",
"description": "Plugin to sync Mattermost channels with Microsoft Teams channels",
"homepage_url": "https://github.com/mattermost/mattermost-plugin-msteams",
"support_url": "https://github.com/mattermost/mattermost-plugin-msteams/issues",
"icon_path": "assets/icon.svg",
"min_server_version": "9.8.0",
"server": {
"executables": {
"linux-amd64": "server/dist/plugin-linux-amd64",
"linux-arm64": "server/dist/plugin-linux-arm64"
}
},
"webapp": {
"bundle_path": "webapp/dist/main.js"
},
"settings_schema": {
"header": "",
"footer": "",
"settings": [
{
"key": "tenantId",
"display_name": "Tenant ID",
"type": "text",
"help_text": "Microsoft Teams Tenant ID",
"default": ""
},
{
"key": "clientId",
"display_name": "Client ID",
"type": "text",
"help_text": "Microsoft Teams Client ID",
"default": ""
},
{
"key": "clientSecret",
"display_name": "Client Secret",
"type": "text",
"help_text": "Microsoft Teams Client Secret",
"default": ""
},
{
"key": "encryptionKey",
"display_name": "At Rest Encryption Key:",
"type": "generated",
"help_text": "The AES encryption key used to encrypt stored access tokens"
},
{
"key": "webhookSecret",
"display_name": "Webhook secret",
"type": "generated",
"help_text": "Microsoft Teams will use this secret to send messages to Mattermost"
},
{
"key": "evaluationAPI",
"display_name": "Use the evaluation API pay model",
"type": "bool",
"help_text": "The evaluation API pay model only allows you to get a limited number of change notifications. Be sure your system keeps them low if you enable this setting",
"default": false
},
{
"key": "syncUsers",
"display_name": "Sync users",
"type": "number",
"help_text": "Set the number of minutes between users sync (Leave it empty to disable users sync)",
"default": 0
},
{
"key": "syncGuestUsers",
"display_name": "Sync guest users",
"type": "bool",
"help_text": "Set the value to 'true' to sync MS Teams guest users",
"default": false
},
{
"key": "syncNotifications",
"display_name": "Sync notifications",
"type": "bool",
"help_text": "Sync notifications of chat messages for any connected user that enables the feature.",
"default": false
},
{
"key": "syncLinkedChannels",
"display_name": "Sync linked channels",
"type": "bool",
"help_text": "Sync messages from channels linked between Mattermost and MS Teams",
"default": false
},
{
"key": "maxSizeForCompleteDownload",
"display_name": "Maximum size of attachments to support complete one time download (in MB)",
"type": "number",
"help_text": "Set the maximum size for attachments that can be loaded into the memory. Attachments bigger than this size will be streamed from MS Teams to Mattermost",
"default": 20
},
{
"key": "bufferSizeForFileStreaming",
"display_name": "Buffer size for streaming files (in MB)",
"type": "number",
"help_text": "Set the buffer size for streaming files from MS Teams to Mattermost",
"default": 20
},
{
"key": "connectedUsersAllowed",
"display_name": "Max Connected Users",
"type": "number",
"help_text": "The maximum number of users that may connect their MS Teams account. Once connected, users may reconnect at any time. (Set to 0 to disable new connections.)",
"default": 1000
},
{
"key": "connectedUsersMaxPendingInvites",
"display_name": "Max Pending Invitations",
"type": "number",
"help_text": "Invite pool size: the maximum number of connection invites that may be pending at a given time. When specified, connection invite direct messages will be sent to users as they become active, up to the maximum specified here. As invited users connect, spaces in the invite pool will open up and more invites will be sent out. Once invited, users may connect at any time. (Set to 0 or leave empty to disable connection invites.)",
"default": 0
},
{
"key": "connectedUsersRestricted",
"display_name": "New User Connections: Restricted",
"type": "bool",
"help_text": "When true, only whitelisted users may connect their account.",
"default": false
},
{
"key": "connectedUsersWhitelist",
"display_name": "New User Connections: Whitelist",
"type": "custom",
"help_text": "",
"default": ""
},
{
"key": "automaticallyPromoteSyntheticUsers",
"display_name": "Automatically Promote Synthetic Users",
"type": "bool",
"help_text": "When true, synthetic users will be converted to members when they login for the first time.",
"default": false
},
{
"key": "syntheticUserAuthService",
"display_name": "Synthetic User Auth Service",
"type": "dropdown",
"help_text": "Select the authentication service to use when creating synthetic users. This should match the service used for member user access to Mattermost. Default is 'SAML'.",
"default": "saml",
"options": [
{
"display_name": "SAML",
"value": "saml"
},
{
"display_name": "AD/LDAP",
"value": "ldap"
}
]
},
{
"key": "syntheticUserAuthData",
"display_name": "Synthetic User Auth Data",
"type": "dropdown",
"help_text": "Select the MS Teams user property to use as the authentication identifier. For AD/LDAP and SAML, the identifier's value should match the value provided by the ID Attribute. ",
"default": "ID",
"options": [
{
"display_name": "ID",
"value": "ID"
},
{
"display_name": "Mail",
"value": "Mail"
},
{
"display_name": "User Principal Name",
"value": "UserPrincipalName"
}
]
},
{
"key": "appManifestDownload",
"display_name": "Download Manifest",
"type": "custom",
"help_text": "",
"default": ""
},
{
"key": "ConnectedUsersReportDownload",
"display_name": "Download Report",
"type": "custom",
"help_text": "",
"default": ""
}
]
"id": "com.mattermost.msteams-sync",
"name": "MS Teams",
"description": "Plugin to sync Mattermost channels with Microsoft Teams channels",
"homepage_url": "https://github.com/mattermost/mattermost-plugin-msteams",
"support_url": "https://github.com/mattermost/mattermost-plugin-msteams/issues",
"icon_path": "assets/icon.svg",
"min_server_version": "9.8.0",
"server": {
"executables": {
"linux-amd64": "server/dist/plugin-linux-amd64",
"linux-arm64": "server/dist/plugin-linux-arm64"
}
},
"webapp": {
"bundle_path": "webapp/dist/main.js"
},
"settings_schema": {
"header": "",
"footer": "",
"settings": [
{
"key": "tenantId",
"display_name": "Tenant ID",
"type": "text",
"help_text": "Microsoft Teams Tenant ID",
"default": ""
},
{
"key": "clientId",
"display_name": "Client ID",
"type": "text",
"help_text": "Microsoft Teams Client ID",
"default": ""
},
{
"key": "clientSecret",
"display_name": "Client Secret",
"type": "text",
"help_text": "Microsoft Teams Client Secret",
"default": ""
},
{
"key": "encryptionKey",
"display_name": "At Rest Encryption Key:",
"type": "generated",
"help_text": "The AES encryption key used to encrypt stored access tokens"
},
{
"key": "webhookSecret",
"display_name": "Webhook secret",
"type": "generated",
"help_text": "Microsoft Teams will use this secret to send messages to Mattermost"
},
{
"key": "evaluationAPI",
"display_name": "Use the evaluation API pay model",
"type": "bool",
"help_text": "The evaluation API pay model only allows you to get a limited number of change notifications. Be sure your system keeps them low if you enable this setting",
"default": false
},
{
"key": "syncNotifications",
"display_name": "Sync notifications",
"type": "bool",
"help_text": "Sync notifications of chat messages for any connected user that enables the feature.",
"default": false
},
{
"key": "maxSizeForCompleteDownload",
"display_name": "Maximum size of attachments to support complete one time download (in MB)",
"type": "number",
"help_text": "Set the maximum size for attachments that can be loaded into the memory. Attachments bigger than this size will be streamed from MS Teams to Mattermost",
"default": 20
},
{
"key": "bufferSizeForFileStreaming",
"display_name": "Buffer size for streaming files (in MB)",
"type": "number",
"help_text": "Set the buffer size for streaming files from MS Teams to Mattermost",
"default": 20
},
{
"key": "connectedUsersAllowed",
"display_name": "Max Connected Users",
"type": "number",
"help_text": "The maximum number of users that may connect their MS Teams account. Once connected, users may reconnect at any time. (Set to 0 to disable new connections.)",
"default": 1000
},
{
"key": "connectedUsersMaxPendingInvites",
"display_name": "Max Pending Invitations",
"type": "number",
"help_text": "Invite pool size: the maximum number of connection invites that may be pending at a given time. When specified, connection invite direct messages will be sent to users as they become active, up to the maximum specified here. As invited users connect, spaces in the invite pool will open up and more invites will be sent out. Once invited, users may connect at any time. (Set to 0 or leave empty to disable connection invites.)",
"default": 0
},
{
"key": "connectedUsersRestricted",
"display_name": "New User Connections: Restricted",
"type": "bool",
"help_text": "When true, only whitelisted users may connect their account.",
"default": false
},
{
"key": "connectedUsersWhitelist",
"display_name": "New User Connections: Whitelist",
"type": "custom",
"help_text": "",
"default": ""
},
{
"key": "ConnectedUsersReportDownload",
"display_name": "Download Report",
"type": "custom",
"help_text": "",
"default": ""
}
]
}
}
Loading

0 comments on commit cb17aca

Please sign in to comment.