Skip to content

Commit ed0e54c

Browse files
committedAug 8, 2015
Allow preventing user editing
On per-UID basis in conf.py, for demo environments only! Signed-off-by: Chris Warrick <kwpolska@gmail.com>
1 parent f75f305 commit ed0e54c

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed
 

‎coil/web.py

+3
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def configure_site():
123123
app.config['COIL_LOGIN_CAPTCHA'] = _site.config.get(
124124
'COIL_LOGIN_CAPTCHA',
125125
{'enabled': False, 'site_key': '', 'secret_key': ''})
126+
app.config['COIL_USERS_PREVENT_EDITING'] = _site.config.get('COIL_USERS_PREVENT_EDITING', [])
126127
app.config['COIL_LIMITED'] = _site.config.get('COIL_LIMITED', False)
127128
app.config['REDIS_URL'] = _site.config.get('COIL_REDIS_URL',
128129
'redis://localhost:6379/0')
@@ -955,6 +956,8 @@ def acp_account():
955956
action = 'edit'
956957
form = AccountForm()
957958
if request.method == 'POST':
959+
if int(current_user.uid) in app.config['COIL_USERS_PREVENT_EDITING']:
960+
return error("Cannot edit data for this user.", 403)
958961
if not form.validate():
959962
return error("Bad Request", 400)
960963
action = 'save'

‎docs/admin/setup.rst

+12-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ Then, you must make some changes to the config:
5353
**Store it in a safe place** — git is not one! You can use
5454
``os.urandom(24)`` to generate something good.
5555
* ``COIL_URL`` — the URL under which Coil can be accessed.
56-
* ``COIL_LOGIN_CAPTCHA`` — if you want reCAPTCHA to appear on the login page
57-
(aimed at plugic environments, eg. the demo site), set this to a dict of
58-
``{'enabled': True, 'site_key': '', 'secret_key': ''}`` and fill in your data.
59-
If you don’t want a CAPTCHA, don’t set this setting.
6056
* ``_MAKO_DISABLE_CACHING = True``
6157
* Modify ``POSTS`` and ``PAGES``, replacing ``.txt`` with ``.html``.
6258
* You must set the mode (Limited vs Full) and configure it accordingly — see
@@ -70,6 +66,18 @@ is by downloading the raw ``.css`` file and saving it as ``files/assets/css/cust
7066

7167
__ https://github.com/Voog/wysihtml/blob/master/examples/css/stylesheet.css
7268

69+
Special config for demo sites
70+
-----------------------------
71+
72+
The `demo site <https://coildemo-admin.getnikola.com/>`_ uses the following two
73+
settings, which might also be useful for some environments:
74+
75+
* ``COIL_LOGIN_CAPTCHA`` — if you want reCAPTCHA to appear on the login page
76+
(aimed at plugic environments, eg. the demo site), set this to a dict of
77+
``{'enabled': True, 'site_key': '', 'secret_key': ''}`` and fill in your data.
78+
If you don’t want a CAPTCHA, don’t set this setting.
79+
* ``COIL_USERS_PREVENT_EDITING`` — list of user IDs (integers) that cannot edit their
80+
profiles.
7381

7482
Limited Mode vs. Full Mode
7583
==========================

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
dependencies = [l.strip() for l in fh]
88

99
setup(name='coil',
10-
version='1.3.4-alpha.1',
10+
version='1.3.4-alpha.2',
1111
description='A user-friendly CMS frontend for Nikola.',
1212
keywords='coil,nikola,cms',
1313
author='Chris Warrick, Roberto Alsina, Henry Hirsch et al.',

0 commit comments

Comments
 (0)
Please sign in to comment.