fix interpretation approve

This commit is contained in:
SvyatoslavArtymovych 2023-06-01 15:05:01 +03:00
parent a8f9d765d6
commit bb685b14fe
3 changed files with 23 additions and 16 deletions

View File

@ -46,9 +46,8 @@ def check_permissions(
if not entity or not entity.access_groups:
log(
log.INFO,
"User [%s] dont have permission to [%s] [%s]",
"Entity [%s] of entity.access_groups [%s] not found",
access,
current_user,
entity,
)
flash("You do not have permission", "warning")
@ -91,7 +90,7 @@ def check_permissions(
log(
log.INFO,
"User [%s] has permission to [%s] [%s]",
access.name,
access,
current_user,
entity,
)
@ -100,8 +99,8 @@ def check_permissions(
log(
log.INFO,
"User [%s] dont have permission to [%s] [%s]",
access.name,
current_user,
access,
entity,
)
flash("You do not have permission", "danger")

View File

@ -66,6 +66,7 @@
{% set access_to_create_collections = has_permission(collection, Access.C) %}
{% set access_to_update_collections = has_permission(collection, Access.U) %}
{% set access_to_delete_collections = has_permission(collection, Access.D) %}
{% set access_to_create_section = has_permission(collection, Access.C, EntityType.SECTION) %}
{% if access_to_create_collections or access_to_update_collections %}
<ul class="py-2 text-sm text-gray-700 dark:text-gray-200">
@ -79,7 +80,7 @@
</li>
{% endif %}
{% endif %}
{% if access_to_update_collections %}
{% if access_to_create_section %}
{% if collection.children|length ==0 or collection.children|length ==0 and collection.is_leaf %}
<li>
<button type="button" id="callAddSectionModal" data-modal-target="add-section-modal" data-modal-toggle="add-section-modal" data-collection-id="{{collection.id}}" data-sub-collection-id="_" class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">New Section</button>

View File

@ -34,25 +34,32 @@
{% set access_to_create_collections = has_permission(sub_collection, Access.C) %}
{% set access_to_update_collections = has_permission(sub_collection, Access.U) %}
{% set access_to_delete_collections = has_permission(sub_collection, Access.D) %}
{% set access_to_create_section = has_permission(collection, Access.C, EntityType.SECTION) %}
{% if access_to_create_collections or access_to_update_collections %}
{% if access_to_create_collections or access_to_update_collections or access_to_create_section %}
<ul class="py-2 text-sm text-gray-700 dark:text-gray-200">
{% if sub_collection.is_leaf and not sub_collection.children %}
{% if access_to_create_section and sub_collection.is_leaf and not sub_collection.children %}
<li>
<button type="button" id="callAddSectionModal" data-modal-target="add-section-modal" data-modal-toggle="add-section-modal" data-collection-id="{{collection.id}}" data-sub-collection-id="{{sub_collection.id}}" class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"> New Section </button>
</li>
{% elif not sub_collection.is_leaf and not sub_collection.children %}
{% if access_to_create_section %}
<li>
<button type="button" id="callAddSectionModal" data-modal-target="add-section-modal" data-modal-toggle="add-section-modal" data-collection-id="{{collection.id}}" data-sub-collection-id="{{sub_collection.id}}" class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"> New Section </button>
</li>
{% endif %}
{% if access_to_create_collections %}
<li>
<button type="button" id="callAddSubCollectionModal" data-modal-target="add-sub-collection-modal" data-modal-toggle="add-sub-collection-modal" data-collection-id="{{sub_collection.id}}" class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"> New Subcollection </button>
</li>
{% endif %}
{% else %}
{% if access_to_create_collections %}
<li>
<button type="button" id="callAddSubCollectionModal" data-modal-target="add-sub-collection-modal" data-modal-toggle="add-sub-collection-modal" data-collection-id="{{sub_collection.id}}" class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"> New Subcollection </button>
</li>
{% endif %}
{% endif %}
</ul>
{% endif %}