def METHOD_NAME(role_id):
    edits = request.get_json()
    role = Role.query.filter(Role.id == role_id).first_or_404()
    server = role.server
    for key, value in edits.items():
        if key == "id":
            current_app.logger.warning("Cannot change role ID; ignoring")
            continue
        elif key == "users":
            value = [User.query.filter(User.id == uid).first() for uid in value]
        elif key == "scopes":
            value = [Scope.query.filter(Scope.id == sid).first() for sid in value]
            for scope in value:
                _validate_scope_server(scope, server)
        elif key == "latest_token_expiry":
            value = datetime.datetime.strptime(value, "%Y-%m-%dT%H:%M:%S.%fZ")
            if value > server.latest_token_expiry:
                raise InvalidUsage("Role cannot exist past latest token in server")
        elif key == "longest_token_life_minutes":
            value = int(value)
            if value > server.longest_token_life_minutes:
                raise InvalidUsage(
                    "Role cannot have a maximum lifetime greater than server"
                )
        elif key not in ["name"]:
            current_app.logger.warning(f"Invalid key {key} in PATCH roles/{role_id}")
            raise InvalidUsage(f"Invalid key {key} in PATCH request.")
        setattr(role, key, value)
    db.session.add(role)
    try:
        db.session.commit()
    except IntegrityError as err:
        db.session.rollback()
        raise err
    current_app.logger.info(f"Role {role_id} updated with {edits}")
    # TODO: Add audit log here
    return list_roles()