Need an action to create and delete roles

Events happening in the community are now at Drupal community events on www.drupal.org.
jaochoo's picture

I need an action which creates a new role with default permissions and a customized name as well as an action to delete a role to make Rules like the following:
- When a new node of content type "company" is created, create a new role with name "role_companyname"
- When a new node of content type "department" is created, populate the referenced company node and create a new role with name "role_companyname_departmentname"
- When a node of content type "department" is created, delete the role with name "role_departmentname"
- etc.

Question:
1) Where can I add custom code to make custom actions available?
2) What code do I need to a) create new roles, b) delete existing roles?

Rules

Group organizers

Group categories

Categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week