Categories access based on custom fields

Hi,
Thanks for your amazing work. Discourse is a very great forum.

Long story :
We have a mobile application were users are required to login. Onced logged, they may access to a forum, and are automatically logged in throught SSO. If user do not exists on discourse, it will be created, else, its profile will be updated with current user data. We have several special fields that describe our users, such as company, department, etc…
We are transfering them to discourse.

That was the easy part, now, we want to grant access to forum categories based on these metadata. If there a way to achieve that ? We may create groups for each metadata value, but it will be a mess to configure. So, is there something like that in discourse ? Should we develop a plugin allowing us to determine categories access based on users custom fields ?

TLDR : I want to know if there is a built-in way to grant categories access based on user custom fields.

Thanks for your help.

Regards

1 Like

No, but you can:

  • Create a simple script that reads from your database and setup all the groups on Discourse using the API

  • Pass group membership along on the SSO payload.

SSO is easier, the only problem is that membership is only updated on login.

1 Like

Can you tell me more about group membership on SSO ?
This means that I have to create group first, then affect groups to categories and finally, through SSO Payload, add groups information (add_groups / remove_groups?

1 Like

Exactly!

Groups SSO info are here:

https://github.com/discourse/discourse/commit/3d76ce14219a168bdf85769c5474420951c14253

3 Likes

Thanks a lot for your help.