piki/pages/access.py

19 lines
647 B
Python
Raw Normal View History

# TODO: Implement access control for pages
2024-10-05 16:22:40 +02:00
def read_page(request, rel_path):
2024-10-07 22:01:01 +02:00
return "private" not in rel_path or write_page(request, rel_path)
2024-10-05 16:22:40 +02:00
def write_page(request, rel_path):
return request.user.is_authenticated and request.user.username in ['root', 'dirk']
def read_attachment(request, rel_path):
2024-10-07 00:44:22 +02:00
# TODO: /!\ rel_path is the filsystem rel_path - caused by the flat folder structure /!\
return True
2024-10-05 16:22:40 +02:00
def modify_attachment(request, rel_path):
2024-10-07 00:44:22 +02:00
# TODO: /!\ rel_path is the filsystem rel_path - caused by the flat folder structure /!\
return request.user.is_authenticated and request.user.username in ['root', 'dirk']