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
Updated Discord Authentication Module to allow optionally filtering based on Server Roles. #6323
base: main
Are you sure you want to change the base?
Conversation
…ased on Server Roles. Updated Discord Authentication Module to allow optionally filtering based on Server Roles. Added custom authentication error message. Added Discord-Oauth2 to package. Discord-Oauth2 is used to fetch role data from the specified server.
Still getting familiar with vs dev containers and working with git. Discovered that some of my changes were reverted at some point, so I need to recover them and retest. |
Hey @TomDakan, thank you for opening this PR! ❤️ If you're still interested in this change, are you planning to finish this draft? I'm willing to use this feature and I'm interested in finishing those changes if it's not possible for you to finish it at the moment 🙏 |
@tboba hey, i've been using it for the last few months and it's been working fine, but I had to do a few things that wouldn't be best practice for the actual PR to get the dependencies included that I needed. I'll try to look at my repo in the next few days and see if I can clean it up to produce a finalized PR. |
@TomDakan sure! If you would like to I can do a code review for you in about an hour 👍 Also, how are you using this change right now? Are you making your own patch and building Wiki.js from source with it, or doing it in other way? I'm just asking, because I can't find any guide how to build Wiki.js from source 🥲 |
@tboba the "simplest" way I found to do it was to create another volume and bind it into the authentication module directory as a new custom module. I remember trying to figure out how to build a fresh production droplet with my changes to the generic discord auth module, and not being able to figure it out in a reasonable amount of time. I found the dev environment very complicated. There is info on how to build a production build at the bottom of this article: https://docs.requarks.io/dev that you might find useful if you haven't read it yet. So your docker command would be something like: |
Also, I think all of my changes are committed now. I don't have time to test it today, but hopefully it will get you going. |
Thanks! 😄 Also, let me leave a couple of comments about proposed changes, so it could land on the main successfully ✌️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said, just a couple of comments from me. Again, great job with this! ❤️
cleaner refactoring of authentication logic. Co-authored-by: Tymoteusz Boba <[email protected]>
Co-authored-by: Tymoteusz Boba <[email protected]>
@tboba also, I think I got all your changes integrated correctly. Let me know if i screwed something up. Particularly moving the intitialization of the DiscorOauth2 object outside of the initialization of the passport strategy. |
Also, thanks for the review. I don't spend much time working in javascript. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for cleanup purposes, I've just left a couple of comments what you should also remove 👍
Co-authored-by: Tymoteusz Boba <[email protected]>
Co-authored-by: Tymoteusz Boba <[email protected]>
Co-authored-by: Tymoteusz Boba <[email protected]>
Co-authored-by: Tymoteusz Boba <[email protected]>
You shouldn't have a package.json in the discord module folder, as you're submitting a PR to make it part of the official repo. The per-module package.json is only for custom modules that are not part of Wiki.js itself. |
@NGPixel ok, I'll remove it. Does that mean I should modify the main package.json to include the dependency? |
Updated Discord Authentication Module to allow optionally filtering based on Server Roles. Added custom authentication error message. Added Discord-Oauth2 to package.json. Discord-Oauth2 is used to fetch role data from the specified server in module/discord/authentication.js