-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read Discord Groups #390
Comments
I would be interested in this feature for my organization, but I am aware that doing it properly could be a bit complicated. Such functionality would need some kind of mapping configuration (which Discord role should be mapped to which NC group) |
Some notes towards a patch!The existing call to
reads the user object, which is global across Discord (API docs!), but roles are attached to servers (aka guilds) (API docs!). Which means a couple of things:
Here's some code that should do the trick, if I could figure out how to read the guild ID and could get the permissions to work
|
My half-finished patch above doesn't do any mapping. Looking ahead, the Custom OpenID Connect and Custom Discourse providers have this mapping button in the UI: which seem to be implemented like this: nextcloud-social-login/lib/Provider/CustomOpenIDConnect.php Lines 47 to 52 in 8859c14
nextcloud-social-login/lib/Provider/CustomDiscourse.php Lines 208 to 213 in 8859c14
I think for my first draft I would be happy if I could just get the groups read in at all! |
I have a patch in ^. Do you think you're brave enough to try it out, @pktiuk ? |
IDK how to run this kind of patch. (I am not an advanced NC user). |
I'm not 100% sure how to collaborate with this sort of thing. I am guessing my way through as well. What I know is that the contents of this repo seem to have been installed directly (including even non-functional files like CHANGELOG.md) to my nextcloud's
So in theory you should be able to replace it just by cloning this repo into the right place:
and to downgrade again it looks like this works:
I would really appreciate some feedback on this if you are willing to help. The more feedback the faster it's going to be working and the sooner @zorn-v will see that there's both a need and a solution. |
I will try to launch it tomorrow. |
|
Thank you so much for testing. That's definitely an oversight on my end. Have you filled in the allowed guilds on your settings page with the ID of your group's Discord server?
I don't really know how to make this work without that. But it shouldn't crash either way. I'll try to fix that ^^
Le 18 février 2023 19 h 49 min 10 s UTC, "Paweł Kotiuk" ***@***.***> a écrit :
…I got Error:
![obraz](https://user-images.githubusercontent.com/45544416/219885172-ac84d933-3b83-4d24-80dd-0909c44977c2.png)
```
[index] Error: Exception: Undefined constant "OCA\SocialLogin\Service\allowedGuilds" in file '/var/www/html/custom_apps/sociallogin/lib/Service/ProviderService.php' line 419 at <<closure>>
0. /var/www/html/lib/private/AppFramework/App.php line 172
OC\AppFramework\Http\Dispatcher->dispatch(OCA\SocialLogin\ ... {}, "oauth")
1. /var/www/html/lib/private/Route/Router.php line 298
OC\AppFramework\App::main("OCA\\SocialLogi ... r", "oauth", OC\AppFramework\ ... {}, ["discord","sociallogin.login.oauth"])
2. /var/www/html/lib/base.php line 1047
OC\Route\Router->match("/apps/sociallogin/oauth/discord")
3. /var/www/html/index.php line 36
OC::handleRequest()
GET /apps/sociallogin/oauth/discord?code=pDdWS6wcbjpOOFV0JQDXG30jv5V7qm&state=HA-UOV31RMWBCTXL8YJQIFA2KH74EZ6ND90PG5S
from 37.225.92.137 at 2023-02-18T19:45:32+00:00
```
--
Reply to this email directly or view it on GitHub:
#390 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
You just missed |
Right. Obviously. 😰 I don't write PHP that often. fixed: ac5d3df I'm a little confused how I didn't catch this. I have this code deployed on my server and I went to meetings and saw people logging in with it. Anyway it's updated. Sorry for the trouble @pktiuk, would you run |
I also got an error, but it could be caused by not restarting NC correctly (after restarting container I could log in)
|
I get this one too, I think it's an unrelated problem. I think it's triggered by one of the skeleton files; NextCloud is trying to scan its metadata tags but failing:
So
is the only interesting log, and it doesn't say much. 🤔 I was thinking about this and I realized that on mine I have enabled a bot user on my OAuth app, and I invited that bot user to my guild, with, well, probably too many permissions: But I tried removing it, and it still behaves itself for me So I don't think that's the issue. What version of PHP are you on? I'm using 7.4 (old, I know, but it's what my distro happens to have at the moment). You have been very helpful @pktiuk. I do not know what's wrong. I won't bother you any more if you just want to delete and reinstall the basic |
I use docker from: https://github.com/nextcloud/all-in-one It has version: 8.0.26 |
I can still help you with this functionality. Helping you is in my best interest. I think this feature will be incredibly useful in my organization :) |
I am also really interested in mapping roles in a specific Discord guild directly to a group for a group I'm belonging to. |
I think this issue can be closed now. |
This plugin is really useful! Really got my team onboard with using NextCloud, fast.
It doesn't seem to be able to read Discord Roles though. This seems to be the code that does that:
nextcloud-social-login/3rdparty/hybridauth/hybridauth/src/Provider/Discord.php
Lines 65 to 83 in 3c69bf5
Is there interest in mapping Roles to NextCloud Groups?
The text was updated successfully, but these errors were encountered: