diff --git a/apps/perms/api/user_permission/common.py b/apps/perms/api/user_permission/common.py index 003e38856..12469d3da 100644 --- a/apps/perms/api/user_permission/common.py +++ b/apps/perms/api/user_permission/common.py @@ -84,6 +84,8 @@ class ValidateUserAssetPermissionApi(UserAssetPermissionMixin, APIView): system_users_actions = self.util.get_asset_system_users_with_actions( asset) actions = system_users_actions.get(system_user) + if actions is None: + return Response({'msg': False}, status=403) if action_name in Action.value_to_choices(actions): return Response({'msg': True}, status=200) return Response({'msg': False}, status=403) diff --git a/apps/perms/templates/perms/asset_permission_create_update.html b/apps/perms/templates/perms/asset_permission_create_update.html index 4cb5928eb..937e7273e 100644 --- a/apps/perms/templates/perms/asset_permission_create_update.html +++ b/apps/perms/templates/perms/asset_permission_create_update.html @@ -4,6 +4,17 @@ {% load bootstrap3 %} {% block custom_head_css_js %} + {% endblock %} {% block content %} @@ -33,20 +44,55 @@ {% endif %} {% csrf_token %} +

{% trans 'Basic' %}

{% bootstrap_field form.name layout="horizontal" %} +

{% trans 'User' %}

{% bootstrap_field form.users layout="horizontal" %} {% bootstrap_field form.user_groups layout="horizontal" %} +

{% trans 'Asset' %}

{% bootstrap_field form.assets layout="horizontal" %} {% bootstrap_field form.nodes layout="horizontal" %} {% bootstrap_field form.system_users layout="horizontal" %} +

{% trans 'Action' %}

- {% bootstrap_field form.actions layout="horizontal" %} +
+ +
+
+
    +
  • +
    {{ form.actions.0}}
    +
      +
    • +
      {{ form.actions.1}}
      +
    • + +
    • +
      {{ form.actions.4}}
      +
        +
      • +
        {{ form.actions.2}}
        +
      • +
      • +
        {{ form.actions.3}}
        +
      • +
      +
    • +
    + +
  • +
+
{{ form.actions.help_text }}
+
+
+
+

{% trans 'Other' %}

@@ -100,6 +146,21 @@ {% endblock %}