Introduction

Generally, all forums are open for all registered users to participate. That means that any user can see the topics on any forum and comment or vote.

However, a forum owner could want to restrict the participation to a closed group or make the forum entirely private. All that cases are covered with DemocracyOS permission model. So, in DemocracyOS

We distinguish five roles on a forum:

This article is intended to provide you, as a developer, guidelines to understand and extend the permissions approach.

The model

This permission model is represented in the forum model, since we are only applying restrictions at a forum level. You’ll find the following files next to the forum directory (lib/models/forum/):

Middlewares

Some API operations are permission-aware, so when a user tries to perform any of it, the privileges should be checked. It is done by using Express middlewares that are implemented in lib/middlewares/forum-middlewares/index.js.