def requires_rw(f):
@wraps(f)<EOL>def decorated(*args, **kwargs):<EOL><INDENT>auth = args[<NUM_LIT:1>]<EOL>if auth.readonly:<EOL><INDENT>logger = logging.getLogger()<EOL>logger.info("<STR_LIT>" % (auth.username, f.__name__))<EOL>raise authlib.AuthorizationFailed("<STR_LIT>" % (auth.username, f.__name__))<EOL><DEDENT>return f(*args, **kwargs)<EOL><DEDENT>return decorated<EOL>
Adds readwrite authorization

        This will check if the user is a readonly user and if so reject the
        query. Apply this decorator to readwrite functions.