From 5586abfbed9b49c8e5cd456fa2b55932f8f684d2 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sat, 13 Aug 2016 00:00:37 +0200 Subject: [PATCH] Fixed getting started. --- .../app/controllers/getting_started.coffee | 6 +++--- app/assets/javascripts/app/lib/app_post/auth.coffee | 2 +- .../javascripts/app/models/_application_model.coffee | 11 +++++------ app/models/user.rb | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/app/controllers/getting_started.coffee b/app/assets/javascripts/app/controllers/getting_started.coffee index 76909cda7..31f369656 100644 --- a/app/assets/javascripts/app/controllers/getting_started.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.coffee @@ -2,7 +2,7 @@ class Index extends App.WizardFullScreen constructor: -> super - if !@permissionCheck('admin.wizard') + if @authenticateCheck() && !@permissionCheck('admin.wizard') @navigate '#' return @@ -63,7 +63,7 @@ class AutoWizard extends App.WizardFullScreen super # if already logged in, got to # - if !@permissionCheck('admin.wizard') + if @authenticateCheck() && !@permissionCheck('admin.wizard') @navigate '#' return @@ -139,7 +139,7 @@ class Admin extends App.WizardFullScreen constructor: -> super - if !@permissionCheck('admin.wizard') + if @authenticateCheck() && !@permissionCheck('admin.wizard') @navigate '#' return diff --git a/app/assets/javascripts/app/lib/app_post/auth.coffee b/app/assets/javascripts/app/lib/app_post/auth.coffee index bd526fb98..6205d46bd 100644 --- a/app/assets/javascripts/app/lib/app_post/auth.coffee +++ b/app/assets/javascripts/app/lib/app_post/auth.coffee @@ -72,7 +72,7 @@ class App.Auth # empty session App.Session.init() - # update model definition + # update model definition (needed for not authenticated areas like wizard) if data.models for model, attributes of data.models for attribute in attributes diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee index 62f2fd297..d6639a4da 100644 --- a/app/assets/javascripts/app/models/_application_model.coffee +++ b/app/assets/javascripts/app/models/_application_model.coffee @@ -192,16 +192,15 @@ class App.Model extends Spine.Model # in case if no configure_attributes exist return {} if !attributes - attributesNew = {} # check params of screen if screen is requested + attributesNew = {} if screen for attribute in attributes - if attribute.screen - if attribute && attribute.screen && attribute.screen[ screen ] && !_.isEmpty(attribute.screen[ screen ]) - for item, value of attribute.screen[ screen ] - attribute[item] = value - attributesNew[ attribute.name ] = attribute + if attribute && attribute.screen && attribute.screen[ screen ] && !_.isEmpty(attribute.screen[ screen ]) + for item, value of attribute.screen[ screen ] + attribute[item] = value + attributesNew[ attribute.name ] = attribute # if no screen is given or no attribute has this screen - use default attributes if !screen || _.isEmpty(attributesNew) diff --git a/app/models/user.rb b/app/models/user.rb index 30f32c482..510307fb5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -775,7 +775,7 @@ returns role_ids.each { |role_id| role = Role.lookup(id: role_id) raise "Unable to find role for id #{role_id}" if !role - next unless role.preferences[:not] + next if !role.preferences[:not] role.preferences[:not].each { |local_role_name| local_role = Role.lookup(name: local_role_name) next if !local_role