code: def post(method, hmc, uri, uri_parms, body, logon_required,
               wait_for_completion):
          
          assert wait_for_completion is True  # synchronous operation
          user_role_oid = uri_parms[0]
          user_role_uri = '/api/user-roles/' + user_role_oid
          try:
              user_role = hmc.lookup_by_uri(user_role_uri)
          except KeyError:
              raise InvalidResourceError(method, uri)
          check_required_fields(method, uri, body,
                                ['permitted-object', 'permitted-object-type'])
          # Reject if User Role is system-defined:
          if user_role.properties['type'] == 'system-defined':
              raise BadRequestError(
                  method, uri, reason=314, message="Cannot add permission to "
                  "system-defined user role: {}".format(user_role_uri))
          # Apply defaults, so our internally stored copy has all fields:
          permission = copy.deepcopy(body)
          if 'include-members' not in permission:
              permission['include-members'] = False
          if 'view-only-mode' not in permission:
              permission['view-only-mode'] = True
          # Add the permission to its store (the faked User Role object):
          if user_role.properties.get('permissions', None) is None:
              user_role.properties['permissions'] = []
          user_role.properties['permissions'].append(permission)
docs: Operation: Add Permission to User Role.