5800f79eec
В /documents/ добавлено дерево департаментов, права view/edit через DocumentAccessGrant и выдача доступа сотрудникам/отделам/группам. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
from django.contrib import admin
|
|
from unfold.admin import ModelAdmin
|
|
|
|
from .models import DocumentAccessGrant, NextcloudSyncLog
|
|
|
|
|
|
@admin.register(DocumentAccessGrant)
|
|
class DocumentAccessGrantAdmin(ModelAdmin):
|
|
list_display = [
|
|
'section_key', 'department', 'path', 'level',
|
|
'employee', 'grant_department', 'group', 'is_active', 'updated_at',
|
|
]
|
|
list_filter = ['section_key', 'level', 'is_active', 'is_folder']
|
|
search_fields = ['path', 'note', 'employee__last_name', 'grant_department__name', 'group__name']
|
|
autocomplete_fields = ['department', 'employee', 'grant_department', 'group']
|
|
|
|
|
|
@admin.register(NextcloudSyncLog)
|
|
class NextcloudSyncLogAdmin(ModelAdmin):
|
|
list_display = ['created_at', 'entity_type', 'entity_ref', 'mountpoint', 'action', 'status']
|
|
list_filter = ['entity_type', 'action', 'status', 'created_at']
|
|
search_fields = ['entity_ref', 'mountpoint', 'message']
|
|
readonly_fields = ['entity_type', 'entity_ref', 'mountpoint', 'action', 'status',
|
|
'message', 'created_at', 'updated_at']
|
|
|
|
def has_add_permission(self, request):
|
|
return False
|