Hey, me again. I mentioned a while ago i was tryin...
# troubleshooting
j
Hey, me again. I mentioned a while ago i was trying to work out a way to manage account subscriptions to LDAP accounts, If i understand correctly, the best way i can do that is to add members to a "subscribed" group, when they are subbed, and remove them from that group when they're not. I've tested that functionality & i believe i can make it work as desired. With the help of chatgpt, i was able to write a python discord bot which currently can connect to the LLDAP server, and can clearly search for users, because if i specify an invalid user, it can tell me, however, when i attempt to link a discord user to an LLDAP user, it claims success, though i don't seem to see so much as a connection on the LLDAP server, however, as i mentioned, if i specify an invalid user, it knows. My question boils down to, is querying LLDAP to assign a user to a group and then later, remove that user from the group with another query even a supported function, other than from the web ui? I can post the python script i'm using if that helps as well, it's really just for a proof of concept, and not at all finished.
n
Here's a brand new thread for you! Please keep the discussion for this problem in this thread.
j
here's the python as well, it's also very possible it just seems like it's working and isn't at all, like i mentioned, i basically just got chatgpt to write this for me https://pastebin.com/aA1iNskH
x
for modifying user lldap use graphql
j
i have zero experience with graphql
j
in the top section of that, it indicates to me that the types of queries i'm trying to make are not supported anyways
x
in simple term, get token auth, and you can trigger query over curl
j
i understand that, but in the top section of that document you linked me to, it says modification queries are mostly not supported, Would adding and removing users from groups not be a modification query?
or essentially you want to check the queries.
j
are these just examples? or are those all the currently available queries?
i see one for add user to group, but not remove user from group, i suppose i could delete the user, but then if they resubscribe they have to redo the linking process
i probably could make "add user to group" and "delete user" work, but since the apps i'm using LDAP to authenticate users on, create their own profiles for users, that could create a situation where a user has their subscription deactivated, and then another user with the same name, intentionally or unintentionally takes access to their old profile, though in my case there's not a whole lot of incentive to do that intentionally, but it could still be an issue
x
all of it a working queries. And that schema link also show the queries you can do.
Copy code
createUser(user: CreateUserInput!): User!
  createGroup(name: String!): Group!
  updateUser(user: UpdateUserInput!): Success!
  updateGroup(group: UpdateGroupInput!): Success!
  addUserToGroup(userId: String!, groupId: Int!): Success!
  removeUserFromGroup(userId: String!, groupId: Int!): Success!
  deleteUser(userId: String!): Success!
  deleteGroup(groupId: Int!): Success!
j
I don't see one for "Remove user from group" though, do you know if that's something i can do with a query?
x
Looking on add user sample
Copy code
mutation AddUserToGroup($user: String!, $group: Int!) {
  addUserToGroup(userId: $user, groupId: $group) {
    ok
  }
}
Maybe just like this
Copy code
mutation RemoveUserToGroup($user: String!, $group: Int!) {
  removeUserToGroup(userId: $user, groupId: $group) {
    ok
  }
}
there is playground to test the queries, and docs related to it
j
alright, i'll look into that. thanks.
n
Nothing to add, those are great answers . If you need more help, feel free to ask! And i wouldn't mind a contribution with a sample python script using graphql to query LLDAP If you have time!
j
yea, if i can crack it, i'll share with the class. 😉