Provide permissions for content types in programming -Plone 5

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

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(

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