https://github.com/lldap/lldap logo
Jaiden - I'm still trying to make a discord bot...
# troubleshooting
j
I'm still trying to make a discord bot to manage user subscriptions, this time i'm as far as being able to create a user from discord, but i'm getting stuck on adding the user to the subscribers group. From what i can tell, i'm getting hung up here: modify_request = {"memberUid": [(MODIFY_ADD, [user_dn.split(',')[0].split('=')[1]])]} # Extracts only the username in that the attribute memberUid isn't correct, but i don't know what it's supposed to be (or even what i'm doing because i'm getting chatgpt to do all the work) When i run the command to add a user, i get this output from my script, but it only adds the user and does not add the user to the subscribers group: āœ… Successfully added uid=watlingj,ou=people,dc=example,dc=com to cn=subscribers,ou=groups,dc=example,dc=com
a
message has been deleted
j
here's the entire python script as well: https://pastebin.com/cL9trGfm
n
Don't try to use the LDAP interface to modify data on the server. It's mostly unsupported (apart from creating users as you found out)
The recommended way would be to either use lldap-cli, or the GraphQL interface from python
j
I've tried to figure out anything to do with graphql a hundred times and can't even begin to get anything to work.
even trying to probe what i understand should be the endpoint, i get nothing
from what i understand it should be located at the hostname:17170/graphql
n
Then give lldap-cli a try šŸ™‚
hostname:17170/api/graphql
I believe
j
ah, well that might be why i never made it anywhere. i'll try some more
n
Check out docs/scripting.md
You'll need an authentication header or cookie
j
alright, thanks. i'll try that.
wow, ok i've got it to create a user and add it to the group, but it seems that setting a password isn't supported through graphql, can i use the interface i was previously using for that? i just want to set a temp password when an account is created
n
For setting the password, you can use either LDAP or directly invoke the lldap_set_user_password binary provided in the docker container (or compiled from source)
j

https://i.imgur.com/HImiolb.pngā–¾

šŸ™‚
n
Nice! Maybe you can share your script as an example of discord integration?
j
Yea, i will be sure to once i get it more polished.
n
Really neat! So, people buy a subscription, that grants them a discord role (that you could also grant manually as the discord admin, I guess), and the bot syncs that to an LLDAP membership? And then any service you use can use LDAP filters to check for access?
That's really cool šŸ™‚ I'm sure some people will complain that there's discord in the middle (it's a bit controversial in the OSS community), but I can really see the use case. Do you want to add that as a link, in the discord integration?
j
Yea, using any already existing means of obtaining a subscriber role, automated or manual, this allows self serve sign ups. What do you mean add it as a link?
do you mean under example configs?
did a PR to add it to the readme if that's what you meant