We're Hiring!

Mattermost, Inc.

Plugin function to get all users

I am trying to write a plugin which will require me to check each of the users of the Mattermost server.
Currently I am using this command
users, err := p.API.GetUsers(&model.UserGetOptions{Page: 0, PerPage: 100})
as an attempt to get all users on the system, without the page and per page values nothing gets returned.
This will not however work to get all users if there are more pages and I can’t figure out a method which will return the total number of users signed up to the system. Does this capability exist or will I have to get users in a team for each team and create a unique set from those users which are likely to contain duplicates. From the models it appears that server stats are available to functions in the server itself.

I would suggest using a PHP script that queries the database tables for the users and returns the information you are looking for. By using this method, you can password protect the program, as well as enable yourself to return the data in whatever format you desire.

That seems like an odd way around if the rest of the backend is in Go and the right functions appear to be in the server. Ill look into previous ways in which people have exposed server functions to the plugins.

It’s certainly doable in Go as well, I said PHP just out of thought since my own experience lies in PHP development and I’m 100% sure that it would be able to be done in PHP. I apologize for any confusion.