(slug, **assignment)
return decorate
A version of the requires_privilege decorator which requires
    the specified privilege only for CommCareUsers.
A version of the requires_privilege decorator which requires
    the specified privilege only for CommCareUsers.
A version of the requires_privilege decorator which requires the specified privilege only for CommCareUsers .
def requires_privilege_for_commcare_user(slug, **assignment):
    """
    A version of the requires_privilege decorator which requires
    the specified privilege only for CommCareUsers.
    """
    def decorate(fn):
        @wraps(fn)
        def wrapped(request, *args, **kwargs):
            if (hasattr(request, 'couch_user')
                    and request.couch_user.is_web_user()):
                return fn(request, *args, **kwargs)
            return requires_privilege_with_fallback(slug, **assignment)(fn)(
                request, *args, **kwargs
            )
        return wrapped
    return decorate
def requires_privilege_for_commcare_user ( slug , * * assignment ) : def decorate ( fn ) : @ wraps ( fn ) def wrapped ( request , * args , * * kwargs ) : if ( hasattr ( request , 'couch_user' ) and request . couch_user . is_web_user ( ) ) : return fn ( request , * args , * * kwargs ) return requires_privilege_with_fallback ( slug , * * assignment ) ( fn ) ( request , * args , * * kwargs ) return wrapped return decorate