Using Nextcloud from within Discourse

Hello everyone,

I have a new Discourse installation V.3.5.0 on a virtual machine with Ubuntu. Standard installation. This is accessible via a public https://discourse.domain.de.
Next to it, I have a Nextcloud installation in a Docker system, which is also publicly accessible. https://cloud.domain.de.
Everything works wonderfully on its own.

Now I would like to give members of certain groups in Discourse the ability to upload files to a folder in Nextcloud, possibly edit them with Onlyoffice, and collect them there.

I would prefer not to create a public link for the Nextcloud folder with a password. While this works, I cannot control who uses the combination of link and password outside the forum.
Furthermore, the use of Onlyoffice is not possible this way.

Creating all Discourse users in Nextcloud as well is too much work.

Additionally, setting up an Authelia instance with its own login interface, group management for Discourse, and database creation is honestly too much work for me.

btw.:
There is a NAS, in whose Docker system I host Redis, Postgresql behind pgbouncer, postfix, Nextcloud, and Onlyoffice and monitor them via clamav. The NAS also hosts the VM with Ubuntu, in which Discourse runs. Everything together is behind an NGINX as a reverse proxy.

Therefore, the question:
How can Nextcloud be used from Discourse?

Thank you for any ideas

Doc

2 Likes

GitHub - discourse/discourse-auth-proxy: An http proxy that uses the DiscourseConnect protocol to authenticate users might suit your needs.

2 Likes

If you want to authorize users on one website by checking the rights on the other website, you just have to integrate them. It’s a lot of work. I did it once and had to develop an interface using DiscourseConnect. I think this is actually the easiest. A few hours of development. Not sure about how easy it is to plug-in something to NextCloud though, seems to be possible.

1 Like

Oh, I did not know about this. But it does not allow you to say who can access what, right? It allows you to secure the whole website so that only the forum’s users can see it. But when they see it, they can see all of it.

You can specify a list of allowed groups when starting it up.

Right, so you wouldn’t necessarily put the ENTIRE website behind it, maybe only a certain path or a magic hostname.

It would definitely require some jiggery pokery to get working, but it might be a suitable building block to start from.

1 Like

I enjoy using webhooks and automation platforms, so here is how I’d do it on the quick!

  1. Set up webhooks, one for joining a group in Discourse, and one for leaving the group
  2. Catch the webhooks on an automation platform and format them for Nextcloud; I use huginn for this :black_bird:
  3. Create users/add to groups via Nextcloud API

This way you invite or remove users from the Discourse group to manage the corresponding Nextcloud group. There are some decisions to make regarding user accounts, passwords, etc. This is a quick way to get folks access to an external site from Discourse. :slight_smile:

1 Like

Nice! I’ve always wished for more seamless integration between discourse and nextcloud, which I use for my family site. What I really miss is the ability to easily talk in discourse about files on nextcloud, e.g. a photo or pdf.

I set up single sign on using the social login nextcloud app. This lets me map discourse groups to nextcloud groups to give different classes of people access to different nexcloud folders. If the account doesn’t already exist in nextcloud it is added automatically when they first sign in via my discourse site.

2 Likes

This is the path I have now decided on. Discourse with SSO in the “foreground” and Nextcloud and its group permissions in the “background”. Nextcloud must manage without actual user permissions.
I will report on how it goes. I’ll look at the app again!

Thank you very much!

1 Like