Forum for discussion of mid, final term and final project

How to implement the consumeContent?

How to implement the consumeContent?

by ALESSANDRO PAGIARO -
Number of replies: 2

I don't understand who is responsible for providing the content to consume.

If the catalog have to provide a token that will be checked by the contentX


or if the catalog take the content and send it to the user




In reply to ALESSANDRO PAGIARO

Re: How to implement the consumeContent?

by LUCIO MESSINA -

Maybe we can just wait for the next lesson in which the professor will answer to our question, but I guess that even if the Content is responsible for its consumption, you don't have to use Tokens at all.
The user just contacts the Catalog paying for a content; the Catalog set some variables in its status that indicates that the user has access right to that content (as explained at the beginning of page 2 of the assignment). Later on, the user calls the consume_content function on the requested Content: the Content itself checks if the user has the access rights, contacting the Catalog. If so, it provides the user with the content.

In this way, you obtain:
- decoupling between payment and consumption of a content, and
- the ability to get contents for Premium users.

Hope it helped,
Lucio.

In reply to LUCIO MESSINA

Re: How to implement the consumeContent?

by DAMIANO DI FRANCESCO MAESA -

There should not be any need for tokens. This said each student can choose how to better implement the required functionalities (as long as their choiches are sound and justified properly). Lucio's answer is (in general) in line with what we had in mind when we designed the assignment (and what seeamed to us to be the simplest solution).