| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/horilla_api/api_decorators/employee/ |
Upload File : |
from functools import wraps
from django.http import HttpResponseForbidden
from django.utils.decorators import method_decorator
def or_condition(*decorators):
"""
Combines multiple decorators with OR logic.
"""
def decorator(view_func):
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
# Check if any of the decorators allow access
for dec in decorators:
if dec(view_func)(request, *args, **kwargs):
return view_func(request, *args, **kwargs)
# If none of the decorators allow access, return forbidden response
return HttpResponseForbidden(
"You don't have permission to access this page."
)
return _wrapped_view
return decorator