[UPDT] HORILLA_THEME: Updated the permissions for the theme
This commit is contained in:
@@ -308,5 +308,6 @@ def show_section(context):
|
||||
user.has_perm("horilla_ldap.update_ldapsettings"),
|
||||
user.has_perm("horilla_meet.view_googlecloudcredential"),
|
||||
user.has_perm("whatsapp.add_whatsappcredentials"),
|
||||
user.has_perm("horilla_theme.view_horillacolortheme"),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -3520,7 +3520,7 @@ def get_models_in_app(app_name):
|
||||
try:
|
||||
app_config = apps.get_app_config(app_name)
|
||||
models = app_config.get_models()
|
||||
return models
|
||||
return [model for model in models if model.__name__ != "CompanyTheme"]
|
||||
except LookupError:
|
||||
return []
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ AppConfig for the horilla_theme app
|
||||
"""
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
@@ -23,6 +24,7 @@ class HorillaThemeConfig(AppConfig):
|
||||
|
||||
from horilla.urls import urlpatterns
|
||||
|
||||
settings.APPS.append(("horilla_theme"))
|
||||
# Add app URLs to main urlpatterns
|
||||
urlpatterns.append(
|
||||
path("theme/", include("horilla_theme.urls")),
|
||||
|
||||
@@ -589,7 +589,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if "horilla_theme"|app_installed %}
|
||||
{% if "horilla_theme"|app_installed and perms.horilla_theme.view_horillacolortheme %}
|
||||
<div class="accordion-item border border-primary-300 rounded-md overflow-hidden">
|
||||
<button
|
||||
class="accordion-btn-stng font-medium w-full flex justify-between items-center px-3 py-1 bg-primary-200 text-primary-600 text-[13px] transition-all"
|
||||
@@ -601,14 +601,12 @@
|
||||
class="accordion-panel max-h-0 overflow-hidden transition-all duration-300 bg-white px-4 text-sm text-gray-700">
|
||||
<div class="py-3">
|
||||
<ul>
|
||||
{% if perms.horilla_theme.view_companytheme %}
|
||||
<li class="py-1">
|
||||
<a id="bonusPoint" href="{% url 'horilla_theme:color_theme_view' %}"
|
||||
class="hover:text-primary-600 transition duration-300 text-[13px]">
|
||||
{% trans "Color Theme" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,7 @@ from horilla_views.cbv_methods import login_required, permission_required
|
||||
|
||||
|
||||
@method_decorator(
|
||||
permission_required(["horilla_theme.view_horillacolortheme"]),
|
||||
permission_required("horilla_theme.view_horillacolortheme"),
|
||||
name="dispatch",
|
||||
)
|
||||
class ThemeView(LoginRequiredMixin, TemplateView):
|
||||
@@ -47,9 +47,7 @@ class ThemeView(LoginRequiredMixin, TemplateView):
|
||||
|
||||
|
||||
@method_decorator(
|
||||
permission_required(
|
||||
["horilla_theme.change_companytheme", "horilla_theme.add_companytheme"]
|
||||
),
|
||||
permission_required("horilla_theme.change_horillacolortheme"),
|
||||
name="dispatch",
|
||||
)
|
||||
class ChangeThemeView(LoginRequiredMixin, View):
|
||||
@@ -147,7 +145,7 @@ class ChangeThemeView(LoginRequiredMixin, View):
|
||||
|
||||
|
||||
@method_decorator(
|
||||
permission_required(["horilla_theme.add_horillacolortheme"]),
|
||||
permission_required("horilla_theme.add_horillacolortheme"),
|
||||
name="dispatch",
|
||||
)
|
||||
class SetDefaultThemeView(LoginRequiredMixin, View):
|
||||
|
||||
Reference in New Issue
Block a user