changed #signed_in_with_roles(user) in ability.rb model

This commit is contained in:
raluka 2015-09-01 13:01:57 +02:00
parent df29484317
commit 52a503afd2
4 changed files with 7 additions and 9 deletions

View file

@ -1,7 +1,9 @@
module Admin
class CommentsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource
def index
@ordered_events = Event.order(:title).all
end

View file

@ -263,10 +263,6 @@ module ApplicationHelper
end
end
def can_manage_comments(conference)
(current_user.has_role? :organizer, conference) || (current_user.has_role? :cfp, conference)
end
def sign_in_path
if CONFIG['authentication']['ichain']['enabled']
new_user_ichain_session_path

View file

@ -88,10 +88,10 @@ class Ability
# Abilities from not_signed_in and signed_in are also inherited
signed_in(user)
signed_in_with_organizer_role(user)
signed_in_with_cfp_role(user)
signed_in_with_info_desk_role(user)
signed_in_with_volunteers_coordinator_role(user)
signed_in_with_organizer_role(user) if user.has_role? :organizer, :any
signed_in_with_cfp_role(user) if user.has_role? :cfp, :any
signed_in_with_info_desk_role(user) if user.has_role? :info_desk, :any
signed_in_with_volunteers_coordinator_role(user) if user.has_role? :volunteer_coordinator, :any
# for users with any role
can [:show], Conference

View file

@ -25,7 +25,7 @@
%b.caret
%ul.dropdown-menu
= render 'layouts/user_menu'
- if can_manage_comments(@conference)
- if can? :index, Comment
%ul.nav.navbar-nav.navbar-right
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "unread-comments-preview"}