Is there a way from the server to get a list of all accounts? Even if this is limited with a cursor like all other list functions, that’s fine. We’re building a system where some accounts are admins and can add/edit/delete accounts through our client interface. But I don’t see any way to list accounts unless you already have the ids.
Alternatively, is there a way to list the ids just on the server?
What are the exposed console APIs for getting all the user ids or all the accounts? I have only been able to find methods for getting account information once I have user ids, but not how to find all the user ids in the system currently.
In our case, using the Nakama Console is not an option, we want the admin users to be able to go through our client interface.
Account listing functions are not exposed in the runtimes or the client facing APIs, listing accounts should be done infrequently and as such is only available via the API that is exposed to power the console for admin purposes.
Sure, I can certainly try. We’re trying to build a web tool in the vein of Roll20 where all the players are collaboratively playing a tabletop RPG or wargame where some players are creating the scenarios and deciding what the other players can or can’t see (like a GM) and then players can chat with each other, see a shared view of a map based on those given view limitations.
One key difference is that in Roll20, everyone makes their own account separate from the game itself, but in this case, we want the scenario creators/runners to be the one making all the player accounts for the particular scenario. We’d like to keep these tools all in the same interface so the creators only have to learn our tool and not also learn the Nakama Console. Also, we want to restrict what specifically they can do, so giving them access to the Nakama Console is too powerful.
So for now I’ve made some RPCs in a server module to add, delete, update, get a user, and list all users (probably will change to use limits and cursors to match everything else in Nakama). I’ve been able to implement all of the functionality in the RPCs except for listing users. The scenario creators will need to be able to see the list of players in the game so that they can update and delete them.
Is there some way a server module can make calls to the console API?
Thanks for your time and reading my long-winded explanation. Let me know if you need more information.
@eheine how many players are you expecting to be part of a scenario? Will each player have an account per scenario? Will the GM have an account per multiple scenarios?
From my understanding I don’t think you need an RPC to list all accounts, but just to keep track of which accounts are part of a given scenario which, depending on the answers to the above, you could do using storage objects or groups.
I also find it a bit awkward that the GMs will create the accounts for the users, wouldn’t it be best for players to create accounts and having the GM simply create a group per scenario with a certain number of slots and perhaps have some concept of roles which can be attributed to the players when joining the scenario (group)?
There will be a hundred or so players per scenario and we’re hoping for the GM to set everything up ahead of time so players are just given the login information and can start playing because trying to get that many people to go through any registration process is quite an ordeal in my experience. Each player would have an account per scenario and I believe the same goes for the GM.
I think I’ve decided to do basically what you’re suggesting. In the RPC when I add/delete users, I just modify a storage object that only the server can access of the user ids that it can use when listing them for the GM. Can an account be a part of multiple groups? If so, I could have a group for each scenario and that might be a little be easier to deal with.
Yes an account can be part of multiple groups, and if you create them as closed groups they’ll require the group admin to accept any requests to join. Have a look at our docs: Heroic Labs Documentation | Groups.