Hi Chept,
Please go through below program , you will understand how to grant and remove roles in ALM User Site.
Regarding Automation:
You can call the methods of OTAClient.dll or SAClient.dll from a C#.Net webprogram or VBScript or VB or VB.NET
Site Admin API functionality DLL can be found here: C:\Users\<<<USER ID>>>\AppData\Local\HP\ALM-Client\almdev\SAClient.dll
OTA API functionality DLL can be found here: C:\Users\<<<USER ID>>>\AppData\Local\HP\ALM-Client\almdev\OTAClient.dll
Regards,
Srihari