Need guidance on best practice for implementing a simple quota system
I’d like to limit the number of times a Member can add a custom content type (called Token) to their Member Folder (I’ve also created a custom Member Folder).
Use Case (limit number of tokens addable by a Member):
Let’s assume that our custom content type is called a ‘Token’. It should be possible to set a limit on the number of tokens that can be added. E.g. the limit is set to 2.
After adding two tokens to their Member Area they no longer have permission to add
further tokens.
What I’m considering
I’m looking into DCWorkflow and wondering if some kind of guard condition may be an option. I also looked at the source code for an addon called ‘quota’ which uses a class/require zcml directive (code is here: http://svn.plone.org/svn/collective/quota/trunk/configure.zcml).
It seems that I may need to customize the Member Folder and not the workflow on the ‘Token’ itself. I would appreciate any pointers/guidance on this.
I don’t believe this can be achieved with workflow, as adding content is not a workflow action. I would use a custom add form for your token type, and disallow content creation when the user already has two or more tokens.