I'm trying to find out how to programmatically create a Sharing Access Rule for a custom object when an event occurs.
For example, I have a Community active with some Portal users. Whenever one of the portal users is enabled for a specific internal procedure (an Assignment__c is created), I need to share with that specific user the rules of the parent object of the Assignment__c created previously (Project__c).
To do so, I manually open the Project__c mask, click on "Sharing" button, "Add new" and select the portal user I want to share the Project settings with.
I'm trying to find a way to automate this process, more specifically I was trying to understand what kind of data, object, string or whatever is created when a new Sharing Access rule is created, to simulate it with some APEX code.
I hope I've explained my issue clearly, I've already worked on automating more complex processes that included Permission Sets and Licenses.
I'm here because I can't find proper documentation online about this specific type of Sharing rule.