code: def post(method, hmc, uri, uri_parms, body, logon_required,
               wait_for_completion):
          
          assert wait_for_completion is True  # synchronous operation
          user_oid = uri_parms[0]
          user_uri = '/api/users/' + user_oid
          try:
              user = hmc.lookup_by_uri(user_uri)
          except KeyError:
              raise InvalidResourceError(method, uri)
          check_required_fields(method, uri, body, ['user-role-uri'])
          user_type = user.properties['type']
          if user_type in ('pattern-based', 'system-defined'):
              raise BadRequestError(
                  method, uri, reason=314,
                  message="Cannot add user role to user of type {}: {}".
                  format(user_type, user_uri))
          user_role_uri = body['user-role-uri']
          try:
              hmc.lookup_by_uri(user_role_uri)
          except KeyError:
              raise InvalidResourceError(method, user_role_uri, reason=2)
          if user.properties.get('user-roles', None) is None:
              user.properties['user-roles'] = []
          user.properties['user-roles'].append(user_role_uri)
docs: Operation: Add User Role to User.