Fix group creation bug. Add builds_list to layout menu. Change login error notification. Refs #2162

This commit is contained in:
Pavel Chipiga 2011-10-29 13:56:26 +03:00
parent 05595c7ce6
commit 3cb8d5c4c7
5 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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")

View File

@ -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|

View File

@ -41,6 +41,7 @@ ru:
containers: Контейнеры
downloads: Статистика
event_logs: Лог событий
build_lists: Мониторинг задач
groups: Группы
platforms: Платформы
products: Продукты

View File

@ -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