Grants a permission for a capability on an existing role. This changes the central definition of the role. It does not create a local override.
ADD CAPABILITY <capabilityname> TO <roleidentifier> HAVING permisssion: <permission>
Minimal instruction:
ADD CAPABILITY <capablityname> IN <roleidentifier>
ADD CAPABILITY moodle/course:manageactivities IN shortname:teacher2 HAVING permission: allow