From 3cb8d5c4c7cbdd6fd56c772e5084997d597b5f60 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Sat, 29 Oct 2011 13:56:26 +0300 Subject: [PATCH] Fix group creation bug. Add builds_list to layout menu. Change login error notification. Refs #2162 --- app/models/group.rb | 3 --- app/views/layouts/application.html.haml | 3 +++ config/initializers/notifications.rb | 3 ++- config/locales/ru.yml | 1 + lib/ext/active_record/base.rb | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/models/group.rb b/app/models/group.rb index 47df35a69..703476676 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -27,9 +27,6 @@ class Group < ActiveRecord::Base include PersonalRepository -# before_save :create_dir -# after_destroy :remove_dir - before_create :add_default_role before_save :add_owner_rel diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 982fa3102..64d00b639 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -34,6 +34,9 @@ -if current_user.can_perform?('event_logs', 'index') %li{:class => controller.controller_path == 'event_logs' ? 'active' : '' } %a{:href => event_logs_path}= t("layout.menu.event_logs") + -if current_user.can_perform?('build_lists', 'index') + %li{:class => controller.controller_path == 'build_lists' ? 'active' : '' } + %a{:href => all_build_lists_path}= t("layout.menu.build_lists") -if current_user.can_perform?('categories', 'index') %li{:class => controller.controller_path == 'categories' ? 'active' : '' } %a{:href => categories_path}= t("layout.menu.categories") diff --git a/config/initializers/notifications.rb b/config/initializers/notifications.rb index 201bfffe0..456c12001 100644 --- a/config/initializers/notifications.rb +++ b/config/initializers/notifications.rb @@ -4,7 +4,8 @@ end Warden::Manager.before_failure do |env, opts| # raise env.inspect - ActiveSupport::Notifications.instrument("event_log.observer", :kind => 'error', :message => env['action_dispatch.request.request_parameters']['user'].inspect) + ActiveSupport::Notifications.instrument("event_log.observer", :kind => 'error', + :message => env['action_dispatch.request.request_parameters']['user'].delete_if{|k,v| k == 'password'}.inspect) end Warden::Manager.before_logout do |user,auth,opts| diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 77c87f5c3..e48df7820 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -41,6 +41,7 @@ ru: containers: Контейнеры downloads: Статистика event_logs: Лог событий + build_lists: Мониторинг задач groups: Группы platforms: Платформы products: Продукты diff --git a/lib/ext/active_record/base.rb b/lib/ext/active_record/base.rb index 1f9424ca8..30e6386a9 100644 --- a/lib/ext/active_record/base.rb +++ b/lib/ext/active_record/base.rb @@ -106,14 +106,14 @@ class ActiveRecord::Base def add_owner owner return false unless ActiveRecord::Base.relation_acter? owner.class return false unless ActiveRecord::Base.relation_target? self.class - roles = Role.by_acter(owner).by_target(self).owner_default + roles = Role.by_acter(owner.class).by_target(self.class).owner_default add_roles_to owner, roles end def remove_owner owner return false unless ActiveRecord::Base.relation_acter? owner.class return false unless ActiveRecord::Base.relation_target? self.class - roles = Role.by_acter(owner).by_target(self).owner_default + roles = Role.by_acter(owner.class).by_target(self.class).owner_default remove_roles_form_acter owner, roles end