def assert_user_is_admin_if_user_query_param_is_provided(
        user_db, user, require_rbac=False
    ):
        """
        Function which asserts that the request user is administator if "user" query parameter is
        provided and doesn't match the current user.
        """
        # To avoid potential security issues when RBAC is disabled, we don't support ?user=foo
        # query param when RBAC is disabled
        is_rbac_enabled = bool(cfg.CONF.rbac.enable)

        if user != user_db.name and require_rbac and not is_rbac_enabled:
            msg = '"user" attribute can only be provided by admins when RBAC is enabled'
            raise AccessDeniedError(message=msg, user_db=user_db)

        Function which asserts that the request user is administator if "user" query parameter is
        provided and doesn't match the current user.
        
st2common/st2common/rbac/backends/noop.py