django-scheduler icon indicating copy to clipboard operation
django-scheduler copied to clipboard

How to protect by login the occurance api?

Open losanki opened this issue 4 years ago • 1 comments

Hello, sorry if it's a naive question but how do I go about protecting the occurrences api? For example this works without login: http://localhost:8000/schedule/api/occurrences?calendar_slug=testcal&start=2019-01-01&end=2020-01-26

Thanks.

losanki avatar Jan 27 '20 06:01 losanki

Based on utils.py

def check_calendar_permissions(function):
    @wraps(function)
    def decorator(request, *args, **kwargs):
        if CALENDAR_VIEW_PERM:
            user = request.user
            if not user:
                return HttpResponseRedirect(settings.LOGIN_URL)

Please add CALENDAR_VIEW_PERM = True in your settings.

xjlin0 avatar Sep 12 '22 13:09 xjlin0