changed #signed_in_with_roles(user) in ability.rb model
This commit is contained in:
parent
df29484317
commit
52a503afd2
4 changed files with 7 additions and 9 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
module Admin
|
module Admin
|
||||||
class CommentsController < Admin::BaseController
|
class CommentsController < Admin::BaseController
|
||||||
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ordered_events = Event.order(:title).all
|
@ordered_events = Event.order(:title).all
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -263,10 +263,6 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_manage_comments(conference)
|
|
||||||
(current_user.has_role? :organizer, conference) || (current_user.has_role? :cfp, conference)
|
|
||||||
end
|
|
||||||
|
|
||||||
def sign_in_path
|
def sign_in_path
|
||||||
if CONFIG['authentication']['ichain']['enabled']
|
if CONFIG['authentication']['ichain']['enabled']
|
||||||
new_user_ichain_session_path
|
new_user_ichain_session_path
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,10 @@ class Ability
|
||||||
# Abilities from not_signed_in and signed_in are also inherited
|
# Abilities from not_signed_in and signed_in are also inherited
|
||||||
signed_in(user)
|
signed_in(user)
|
||||||
|
|
||||||
signed_in_with_organizer_role(user)
|
signed_in_with_organizer_role(user) if user.has_role? :organizer, :any
|
||||||
signed_in_with_cfp_role(user)
|
signed_in_with_cfp_role(user) if user.has_role? :cfp, :any
|
||||||
signed_in_with_info_desk_role(user)
|
signed_in_with_info_desk_role(user) if user.has_role? :info_desk, :any
|
||||||
signed_in_with_volunteers_coordinator_role(user)
|
signed_in_with_volunteers_coordinator_role(user) if user.has_role? :volunteer_coordinator, :any
|
||||||
|
|
||||||
# for users with any role
|
# for users with any role
|
||||||
can [:show], Conference
|
can [:show], Conference
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
%b.caret
|
%b.caret
|
||||||
%ul.dropdown-menu
|
%ul.dropdown-menu
|
||||||
= render 'layouts/user_menu'
|
= render 'layouts/user_menu'
|
||||||
- if can_manage_comments(@conference)
|
- if can? :index, Comment
|
||||||
%ul.nav.navbar-nav.navbar-right
|
%ul.nav.navbar-nav.navbar-right
|
||||||
%li.dropdown
|
%li.dropdown
|
||||||
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "unread-comments-preview"}
|
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#", id: "unread-comments-preview"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue