If you have to work relational databases, hierarchical data, workflows or complex security requirements Kotti is your friend. It uses well know Python libraries.
In this post we'll try to turn our Kotti CMS public site into a private intranet/extranet service.
I know, there are other solutions keen on building intranet or collaboration portals like Plone (I've been working 8 years on large and complex intranets, big public administration customers with thousands of active users and several editor teams, multiple migrations, etc) or the KARL project. But let's pretend that in our use case we have simpler requirements and we don't need too complex solutions, features like communities, email subscriptions or similar things.
Thanks to the Pyramid and Kotti's architectural design, you can turn your public website into an intranet without having to fork the Kotti code: no forks!
How to turn your site into an intranetThis could be an hard task if you use other CMS solutions, but with Kotti (or the heavier Plone) it will requires you just 4 steps:
- define a custom intranet workflow
- apply your custom worklows to images and files (by default they are not associated to any workflow, so once added they are immediatly public)
- set a default fallback permission for all views
- override the default root ACL (populators)
1 - define a custom intranet workflowIntranet workflows maybe different depending on your organization requirements. It might be very simple or with multiple review steps.
The important thing is: no more granting the view permission for anonymous users, unless you are willing to define an externally published state
With Kotti you can design your workflow just editing an xml file. For further information you can follow the Kotti CMS - workflow reference article.
2 - apply your custom workflow to images and filesBy default they are not associated to any workflow, so once added they are immediately public.
This step will requires you just two additional lines of code in your includeme or kotti_configure function.
Already described here: Kotti CMS - workflow reference, see the "How to enable the custom workflow for images and files" section.
3 - set a default fallback permissionIn your includeme function you just need to tell the configurator to set a default permission even for public views already registered.
I mean that if somewhere into the Kotti code there is any callable view not associated to a permission, it won't be accessible by anonymous after this step.
In your includeme function you'll need to :
def includeme(config):If you want to bypass the default permission for certain views, you can decorate them with a special permission (NO_PERMISSION_REQUIRED from pyramid.security) which indicates that the view should always be executable by entirely anonymous users, regardless of the default permission. See:
# set a default permission even for public views already registered
# without permission
4 - override the default root ACL (populators)The default Kotti's ACL associated with the root of the site
from kotti.security import SITE_ACLgives view privileges to every user, including anonymous.
You can override this configuration to require users to log in before they can view any of your site's pages. To achieve this, you'll have to set your site's ACL as shown on the following url:
ResultsAfter reading this article you should be able to close your Kotti site for anonymous users and obtaining a simple, private intranet-like area.
Off-topic: you can also use Kotti as a content backend-only administration area for public websites, with a complete decoupled frontend solution.
UPDATE 20150623: now you can achieve the same goals described in this article installing kotti_backend. See https://github.com/Kotti/kotti_backend
- karlproject.org (20150228, offline)
All posts about Kotti
- Pyramid, MySQL and Windows: the good, the ugly and the bad
- Kotti CMS events - insert subobject automatically
- Kotti CMS - how to turn your Kotti CMS into an intranet
- Kotti CMS - how to store arbitrary data with annotations
- How to install Kotti CMS on Windows
- Kotti CMS - avoid types addable in content root
- Kotti CMS - how to create a new content type with an image
- Kotti CMS - workflow reference