claudioc / jingo

Node.js based Wiki
MIT License
1.02k stars 184 forks source link

Add ability limit write access to a subset of users #208

Open ScreamingHawk opened 7 years ago

ScreamingHawk commented 7 years ago

This wiki has been perfect for my use case sans the ability to supply a list of moderators who are the only people able to edit the wiki pages. So I added it.

This pull requests adds another configuration parameter authorization.moderatorsFile which takes a path to a YAML file. The YAML file can contain a list of usernames and/or emails of moderators. When this configuration parameter is supplied, users can only edit the wiki if they are on this list.

Example moderators file:

usernames:
  - 'developer'
  - 'moderator'
emails:
  - 'jingouser'

Related to #67. I agree with the "could blow out of scope" comment, so this implementation is an all or nothing solution when used.

This is an update to my previous pull request #205 using a branch so I can develop other enhancements without affecting this isolated pull request.

claudioc commented 7 years ago

Hi,

this is very interesting indeed. I just need to think for a moment about it before merging.

Thanks :)

ScreamingHawk commented 7 years ago

Small addition for users using LDAP that allows moderators to be configured via LDAP roles.

This change does not require my other pull request for LDAP and works with or without it, and is ignore for users not using LDAP.

Updated README with example YAML file.