(I'm not a coder, so excuse me if I say some stupid things here)
It would be very useful if the membership system could drive Discourse to automatically promote/demote people from user groups.
Payment collected = Promote to Member. Payment expire = Demote from Member
Laser Permission added = Promote to Laserer
Shutter access = Shutterer
etc.
This can be done entirely via the Discourse API. I've tested the following commands at the command line.
Get list of Groups
curl -X GET https://discourse.southlondonmakerspace.org/admin/groups.json
You want the "id" value. eg 41 for "members"
Get member info based on their email address
curl -X GET -d [email protected] -d api_username=ApiUsernameGoesHere -d api_key=ApiKeyGoesHere https://discourse.southlondonmakerspace.org/admin/users/list/active.json
Note that this will return all users whose email address partly matches the search, so will return [email protected] and [email protected] You need to do your own quick == comparison to make sure you get the right one.
You want the "username" value, eg. "tomnewsom" for this email address
Add member to group
(note that usernames= will accept a comma separated list)
curl -X PUT -d usernames=tomnewsom -d api_key=ApiKeyGoesHere -d api_username=ApiUsernameGoesHere https://discourse.southlondonmakerspace.org/admin/groups/41/members.json
Remove member from group
(note that this is a one-at-a-time operation)
curl -X DELETE -d username=username -d api_key=ApiKeyGoesHere -d api_username=ApiUsernameGoesHere https://discourse.southlondonmakerspace.org/admin/groups/41/members.json
Finally, if someone is joining SLMS and they don't have a Discourse account yet:
Create a new user
curl -X POST -d name=FullName -d username=UserName -d [email protected] -d password=Password -d active=true -d api_key=ApiKeyGoesHere -d api_username=ApiUsernameGoesHere https://discourse.southlondonmakerspace.org/users
I think if you leave active=false, then you can further prod the API to send an "activate this account" email, which is probably more secure.