diff --git a/LICENSE b/LICENSE index 1fed2a1..fde009c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,11 @@ -## License +“The Mattermost Source Available License (the “Source Available License”) (c) Mattermost, Inc. 2015-present. -This repository is licensed under the [Mattermost Source Available License](LICENSE) and requires a valid Enterprise E20 - license. See Mattermost Source Available License to learn more. +With regard to the Mattermost Software: + +This software and associated documentation files (the “Software”) may only be used in production, if you (and any entity that you represent) have agreed to, and are in compliance with all of the following: (a) the Mattermost Terms of Use, available at https://mattermost.com/terms-of-use/ (the “TOU”), (b) and the Mattermost Software License Agreement, available at https://mattermost.com/enterprise-edition-terms/ (the “SLA”) or other licensing agreement governing your use of the Software, as agreed by you and Mattermost, and otherwise have a valid Mattermost Enterprise for the correct number of Registered Authorized Users the Software. Subject to the foregoing, you are free to modify this Software and publish patches to the Software. You agree that Mattermost and/or its licensors (as applicable) retain all right, title and interest in and to all such modifications and/or patches, and all such modifications and/or patches may only be used, copied, modified, displayed, distributed, or otherwise exploited with a valid license or Subscription for the correct number of Registered Authorized Users of the Software. Notwithstanding the foregoing, you may copy and modify the Software for development and testing purposes, without requiring a valid license or Subscription. You agree that Mattermost and/or its licensors (as applicable) retain all right, title and interest in and to all such modifications. You are not granted any other rights beyond what is expressly stated herein. Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense, and/or sell the Software. + +The full text of this Source Available License shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +For all third party components incorporated into the Mattermost Software, those components are licensed under the original license provided by the owner of the applicable component.” diff --git a/README.md b/README.md index 3b8b91e..77cd72b 100644 --- a/README.md +++ b/README.md @@ -1,140 +1,15 @@ -# Plugin Starter Template [![CircleCI branch](https://img.shields.io/circleci/project/github/mattermost/mattermost-plugin-starter-template/master.svg)](https://circleci.com/gh/mattermost/mattermost-plugin-starter-template) +# Legal Hold Mattermost Plugin -This plugin serves as a starting point for writing a Mattermost plugin. Feel free to base your own plugin off this repository. +> **Not recommended for production use without Mattermost guidance. Please reach out to your Customer Success Manager to learn more.** -To learn more about plugins, see [our plugin documentation](https://developers.mattermost.com/extend/plugins/). +This plugin allows administrators to place one or more users on legal hold for a set period of time. -This template requires node v16 and npm v8. You can download and install nvm to manage your node versions by following the instructions [here](https://github.com/nvm-sh/nvm). Once you've setup the project simply run `nvm i` within the root folder to use the suggested version of node. +More documentation will be provided at a later date. -## Getting Started -Use GitHub's template feature to make a copy of this repository by clicking the "Use this template" button. +## License -Alternatively shallow clone the repository matching your plugin name: -``` -git clone --depth 1 https://github.com/mattermost/mattermost-plugin-starter-template com.example.my-plugin -``` +This repository is licensed under the [Mattermost Source Available License](LICENSE) and requires a valid Enterprise Edition License when used for production. See [frequently asked questions](https://docs.mattermost.com/overview/faq.html#mattermost-source-available-license) to learn more. -Note that this project uses [Go modules](https://github.com/golang/go/wiki/Modules). Be sure to locate the project outside of `$GOPATH`. +Although a valid Mattermost Enterprise Edition License is required if using this plugin in production, the [Mattermost Source Available License](LICENSE) allows you to compile and test this plugin in development and testing environments without a Mattermost Enterprise Edition License. As such, we welcome community contributions to this plugin. -Edit the following files: -1. `plugin.json` with your `id`, `name`, and `description`: -```json -{ - "id": "com.example.my-plugin", - "name": "My Plugin", - "description": "A plugin to enhance Mattermost." -} -``` - -2. `go.mod` with your Go module path, following the `//` convention: -``` -module github.com/example/my-plugin -``` - -3. `.golangci.yml` with your Go module path: -```yml -linters-settings: - # [...] - goimports: - local-prefixes: github.com/example/my-plugin -``` - -Build your plugin: -``` -make -``` - -This will produce a single plugin file (with support for multiple architectures) for upload to your Mattermost server: - -``` -dist/com.example.my-plugin.tar.gz -``` - -## Development - -To avoid having to manually install your plugin, build and deploy your plugin using one of the following options. In order for the below options to work, you must first enable plugin uploads via your config.json or API and restart Mattermost. - -```json - "PluginSettings" : { - ... - "EnableUploads" : true - } -``` - -### Deploying with Local Mode - -If your Mattermost server is running locally, you can enable [local mode](https://docs.mattermost.com/administration/mmctl-cli-tool.html#local-mode) to streamline deploying your plugin. Edit your server configuration as follows: - -```json -{ - "ServiceSettings": { - ... - "EnableLocalMode": true, - "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket" - }, -} -``` - -and then deploy your plugin: -``` -make deploy -``` - -You may also customize the Unix socket path: -```bash -export MM_LOCALSOCKETPATH=/var/tmp/alternate_local.socket -make deploy -``` - -If developing a plugin with a webapp, watch for changes and deploy those automatically: -```bash -export MM_SERVICESETTINGS_SITEURL=http://localhost:8065 -export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr -make watch -``` - -### Deploying with credentials - -Alternatively, you can authenticate with the server's API with credentials: -```bash -export MM_SERVICESETTINGS_SITEURL=http://localhost:8065 -export MM_ADMIN_USERNAME=admin -export MM_ADMIN_PASSWORD=password -make deploy -``` - -or with a [personal access token](https://docs.mattermost.com/developer/personal-access-tokens.html): -```bash -export MM_SERVICESETTINGS_SITEURL=http://localhost:8065 -export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr -make deploy -``` - -## Q&A - -### How do I make a server-only or web app-only plugin? - -Simply delete the `server` or `webapp` folders and remove the corresponding sections from `plugin.json`. The build scripts will skip the missing portions automatically. - -### How do I include assets in the plugin bundle? - -Place them into the `assets` directory. To use an asset at runtime, build the path to your asset and open as a regular file: - -```go -bundlePath, err := p.API.GetBundlePath() -if err != nil { - return errors.Wrap(err, "failed to get bundle path") -} - -profileImage, err := ioutil.ReadFile(filepath.Join(bundlePath, "assets", "profile_image.png")) -if err != nil { - return errors.Wrap(err, "failed to read profile image") -} - -if appErr := p.API.SetProfileImage(userID, profileImage); appErr != nil { - return errors.Wrap(err, "failed to set profile image") -} -``` - -### How do I build the plugin with unminified JavaScript? -Setting the `MM_DEBUG` environment variable will invoke the debug builds. The simplist way to do this is to simply include this variable in your calls to `make` (e.g. `make dist MM_DEBUG=1`). +If you're running an Enterprise Edition of Mattermost and don't already have a valid license, you can obtain a trial license from **System Console > Edition and License**. If you're running the Team Edition of Mattermost, including when you run the server directly from source, you may instead configure your server to enable both testing (`ServiceSettings.EnableTesting`) and developer mode (`ServiceSettings.EnableDeveloper`). These settings are not recommended in production environments.