Browse Source

Added permission support for auto wizard.

Martin Edenhofer 7 years ago
parent
commit
340fe10d07
2 changed files with 17 additions and 1 deletions
  1. 2 1
      lib/auto_wizard.rb
  2. 15 0
      test/integration/auto_wizard_test.rb

+ 2 - 1
lib/auto_wizard.rb

@@ -88,8 +88,9 @@ returns
       end
     end
 
-    # create EmailAddresses/Channels/Signatures
+    # create Permissions/Organization
     model_map = {
+      'Permissions' => 'Permission',
       'Organizations' => 'Organization',
     }
     model_map.each do |map_name, model|

+ 15 - 0
test/integration/auto_wizard_test.rb

@@ -126,6 +126,16 @@ class AutoWizardTest < ActiveSupport::TestCase
           value: 'Zammad UnitTest02 System'
         },
       ],
+      Permissions: [
+        {
+          name: 'admin.session',
+          active: false,
+        },
+        {
+          name: 'admin.session.new',
+          active: true,
+        },
+      ],
       Channels: [
         {
           id: 1,
@@ -221,6 +231,11 @@ class AutoWizardTest < ActiveSupport::TestCase
       setting_value = Setting.get(local_setting[:name])
       assert_equal(local_setting[:value], setting_value)
     end
+    auto_wizard_data[:Permissions].each do |local_permission|
+      permission = Permission.find_by(name: local_permission[:name])
+      assert_equal(local_permission[:name], permission.name)
+      assert_equal(local_permission[:active], permission.active)
+    end
   end
 
   def auto_wizard_file_write(data)