def allowed_for_roles(roles: List[UserRole]) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]:
    """Decorator function to check the role of the user calling the function, to restrict
    access to certain Argilla functions for users with certain roles. Note that the method
    inside the class to be decorated must contain the `_client` attribute with the active
    client at the class initialization time; otherwise, the current active client will be
    used instead, which in most of the cases won't match the client used during the class
    initialization.

    Args:
        roles: List of roles that are allowed to call the function.

    Example:
        >>> @allowed_for_roles(["owner"])
        >>> def delete_user(user_id: UUID) -> None:
        >>>     ...
    """

    def decorator(func: Callable[_P, _R]) -> Callable[_P, _R]:
        @functools.wraps(func)
        def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
            client = args[0]._client if hasattr(args[0], "_client") else active_client().http_client.httpx
            user = users_api.whoami_httpx(client).parsed
            if user.role not in roles:
                raise PermissionError(
                    f"User with role={user.role} is not allowed to call `{func.__name__}`."
                    f" Only users with role={roles} are allowed to call this function."
                )
            return func(*args, **kwargs)

        return wrapper

    return decorator
Decorator function to check the role of the user calling the function, to restrict
    access to certain Argilla functions for users with certain roles. Note that the method
    inside the class to be decorated must contain the `_client` attribute with the active
    client at the class initialization time; otherwise, the current active client will be
    used instead, which in most of the cases won't match the client used during the class
    initialization.

    Args:
        roles: List of roles that are allowed to call the function.

    Example:
        >>> @allowed_for_roles(["owner"])
        >>> def delete_user(user_id: UUID) -> None:
        >>>     ...
    
argilla-v1/src/argilla_v1/client/utils.py