Hello, i'm building a site to sell images (this is the concept, the reality is different...). All the images are in a directory mapped through LocalFS product. For every image i have a record in a SQL table with all the basic informations: author, name of the file, cost. What i haven't understood is how to block users from getting images if they have not enough credit to buy them. I need to control the view method, but i don't know if this idea is the right one or there are better solutions. Any hints? Thanks, Bruno
Bruno Grampa wrote:
Hello, i'm building a site to sell images (this is the concept, the reality is different...). All the images are in a directory mapped through LocalFS product. For every image i have a record in a SQL table with all the basic informations: author, name of the file, cost.
What i haven't understood is how to block users from getting images if they have not enough credit to buy them. I need to control the view method, but i don't know if this idea is the right one or there are better solutions.
Any hints?
Thanks, Bruno
____
Bruno, Maybe you can better explain your question. Im not at all sure the following will help: Seems like you can check a users credit at login, store the credit score in SESSION and use that for branching logic. You could also update the creditScore as it changes. Then you can develope your pages with stuff like this: (syntax not checked) in TAL <a hRef="somewhere" tal:condition="python: request.SESSION['hasCredit'];">This link only shows up if session's 'hasCredit' is true.</a> In DTML <dtml-if "SESSION['hasCredit']"> <a hRef="somewhere ... <dtml-else> < hRef="somewhereelse"> In Python: (and TAL macros) if context.REQUEST.SESSION['hasCredit']: return container.Images.macros['allImages'] else return container.Images.macros['someImages'] David
Bruno Grampa wrote at 2006-1-9 23:39 +0100:
i'm building a site to sell images (this is the concept, the reality is different...). All the images are in a directory mapped through LocalFS product. For every image i have a record in a SQL table with all the basic informations: author, name of the file, cost.
What i haven't understood is how to block users from getting images if they have not enough credit to buy them.
You drastically restrict access to the "LocalFS" content (e.g. by granting the "Access contents information" and "View" permissions only for "Manager") and provide access to it via a Python Script with proxy role "Manager". This script can check any conditions you would like to be fulfilled before it grants access. -- Dieter
participants (4)
-
Andreas Jung -
Bruno Grampa -
David H -
Dieter Maurer