MDL-24339 improved coding style and fixed id duplicates in get_roles_with_capability()