def add_permission(self, permitted_object, include_members=False,
                       view_only=True):
        """
        Add permission for the specified permitted object(s) to this User Role,
        thereby granting that permission to all users that have this User Role.

        The granted permission depends on the resource class of the permitted
        object(s):

        * For Task resources, the granted permission is task permission for
          that task.

        * For Group resources, the granted permission is object access
          permission for the group resource, and optionally also for the
          group members.

        * For any other resources, the granted permission is object access
          permission for these resources.

        The User Role must be user-defined.

        Authorization requirements:

        * Task permission to the "Manage User Roles" task.

        Parameters:

          permitted_object (:class:`~zhmcclient.BaseResource` or :term:`string`):
            Permitted object(s), either as a Python resource object (e.g.
            :class:`~zhmcclient.Partition`), or as a resource class string (e.g.
            'partition').

            Must not be `None`.

          include_members (bool): Controls whether for Group resources, the
            operation applies additionally to its group member resources.

            This parameter will be ignored when the permitted object does not
            specify Group resources.

          view_only (bool): Controls whether for Task resources, the operation
            aplies to the view-only version of the task (if `True`), or to
            the full version of the task (if `False`). Only certain tasks
            support a view-only version.

            This parameter will be ignored when the permitted object does not
            specify Task resources.

        Raises:

          :exc:`~zhmcclient.HTTPError`
          :exc:`~zhmcclient.ParseError`
          :exc:`~zhmcclient.AuthError`
          :exc:`~zhmcclient.ConnectionError`
        """  # noqa: E501
        if isinstance(permitted_object, BaseResource):
            perm_obj = permitted_object.uri
            perm_type = 'object'
        elif isinstance(permitted_object, six.string_types):
            perm_obj = permitted_object
            perm_type = 'object-class'
        else:
            raise TypeError(
                "permitted_object must be a string or BaseResource, but is: "
                "{}".format(type(permitted_object)))
        body = {
            'permitted-object': perm_obj,
            'permitted-object-type': perm_type,
            'include-members': include_members,
            'view-only-mode': view_only,
        }
        self.manager.session.post(
            self.uri + '/operations/add-permission',
            body=body)