My question: with Rules, how attribute a new user role, when the product was bought, and when this product is a premium content ? So that, when a user bought the product, that user can have access to full content.
Refer to the tutorial Selling Content with Drupal Commerce using Content Access and Roles for granting access to premium content to users who have a "premium" role.
Here is a summary of the steps required (= quote from that link):
- Enable Content Access and the ACL (optional) module.
- Create a role called "premium".
- Create a content type called "Premium Content" and put some great content in it.
- Verify that users can only access the premium content if they have the premium role.
- Create a product representing the premium role.
- Create a rule that grants the premium role on order completion:
- After updating an order.
- If the order state is Completed.
- And the order contains our premium product.
- Add a role to the user who is the owner of the order.