I have created a content type called "XXX" via api.content.create() . I want only particular user to add contents to that page say "A", particular users to edit "B". I want to provide this using the api.user.grant_roles(). But I am unable to take the current page Which is loaded in the browser. I have tried "self.context" to that particular user but dont get any result.
Please take a look at https://training.plone.org/5/mastering-plone/export_code.html#protect-fields-with-permissions.
It can also be done in a schema definition, e.g.:
from plone.autoform import directives
from plone.supermodel import model
class IMySchema(model.Schema):
email = schema.TextLine(
required=True,
title=u'Email',
)
directives.write_permission(
email='your.custom.permission.ID',
)
If that's done you have to grant your permissions to roles/groups and than grant your users those roles or better add the users to the different groups.
I am creating a new content type like folder with some fields, i need to provide the permissions in sharing tab using the python code