Skip to content

mxm, IT's mad science

Sections
Personal tools
You are here: Home » Products » Open Source » mxm Content Rules
Downloads
You can download mxm products here.

Due to it's technical and international nature, this section is in english.

Max M Has a blog too.

og er glad for mad

 

mxm Content Rules

In Plone you often need to restrict the types of content that a member can add to a part of the site. The usual way to do it is to creates a new content type based on a folder, and then restrict what content can be put into that content type. This tool solves the same problem in another way. You define some rules describing what content can go where.

It does not overrule the permission you set in the portal_types tool. It only limits what content types that appear in the dropdowns.

This approach also has the (dis)advantage that it is not a permission issue. It is entirely an interface tool, for making the site simpler to use for members.

Basic rules

You can "allow" or "deny" content by path and content type. The general syntax is:

        RULE COLON PATHS SEMICOLON PORTALTYPES

  • RULE is either "allow" or "deny" (case does not matter)
  • PATHS is one or more paths relative to the portal. "/" is portal root. "/Members" is the member folder. Paths are seperated by commas.
  • PORTALTYPES is either a valid portal_type like "Document" or "Folder", or a wildcard meaning any type.
  • A line with a "#" anywhere in it, is a comment. Not only in the beginning.

The default rule is to allow all content anywhere. It looks like:

        allow: /; *

If you write nothing in the "content_rules" property, this will be the effective rule. So if you are ever in doubt, just delete all rules, and the site will works af if the tool was not installed.

If you want a site where it is only possible to add Folders and Documents in member folders, you can use these rules:

        # first deny all portal types in the member folders
        deny: /Members; *

        # then allow some types for all members
        allow: /Members; Document, Folder

        # and also allow news articles and images for the members "maxm" and "bob"
        allow: /Members/maxm, /Members/bob; News Item, Image

The rules are checked sequentially.

License:

GPL

Contact:

maxm@mxm.dk

Download:

Download from the download section here

Created by maxm
Last modified 2005-01-26 12:21 AM

After installation...

Posted by Anonymous User at 2005-02-19 06:28 PM
Just a quick addition to the docs that might help the newbies (like me!).

Once you install, go to the mxm_contentrules_tool. To setup content access rules, on the Properties tab, edit the content_rules property. Let's say you want to only allow Document types to be added to your tps_reports folder. You would setup your content_rules like so:

# first deny all content types to tps_reports
deny: /tps_reports; *

# next allow only Documents in tps_reports
allow: /tps_reports; Document

It works like this because rules are checked sequentially. You first deny all content types to your tps_reports folder. Then, you allow only the Document type in a subsequent rule.

Hope this helps! Thanks, maxm, for a handy product! The other way of accomplishing this in Plone is a pain.

-tjstankus

taking roles in account

Posted by Anonymous User at 2005-04-04 10:59 AM
Hi, I like your tool. Wouldn't it be lovely if it could also take the role of a user in account? In practice the role of the user is also something that very often determines if a certain (specialized) content-type should be available. I think being able to define per folder what content is available for what group of user would be very powerfull.

inheritance

Posted by Anonymous User at 2005-07-14 08:04 PM
Hi,
it's a nice and easy to use tool. Thank you. I was wondering: is there a way to keep a folder from inheriting the rule of its container? I have a folderish type in which I would like the users to be able to add types that they are not allowed to add in the container...

At any rate: great job. Thanks