mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
defined ability for user with roles -organizer and cfp's, and some improvements in controller
This commit is contained in:
parent
5cdedbf9a6
commit
3bcdbe7469
2 changed files with 5 additions and 11 deletions
|
|
@ -1,9 +1,8 @@
|
|||
module Admin
|
||||
class VenueCommercialsController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :venue, through: :conference, singelton: true
|
||||
before_action :set_venue
|
||||
before_action :set_commercial, only: [:update, :destroy]
|
||||
load_and_authorize_resource :venue, through: :conference, singleton: true
|
||||
load_and_authorize_resource :commercial, through: :venue, singleton: true
|
||||
|
||||
def create
|
||||
@commercial = @venue.build_commercial(commercial_params)
|
||||
|
|
@ -50,13 +49,5 @@ module Admin
|
|||
def commercial_params
|
||||
params.require(:commercial).permit(:url)
|
||||
end
|
||||
|
||||
def set_venue
|
||||
@venue = @conference.venue
|
||||
end
|
||||
|
||||
def set_commercial
|
||||
@commercial = Commercial.find params[:id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ class Ability
|
|||
can :manage, Commercial, commercialable_type: 'Event',
|
||||
commercialable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id)
|
||||
can :manage, Venue, conference_id: conf_ids_for_organizer
|
||||
can :manage, Commercial, commercialable_type: 'Venue',
|
||||
commercialable_id: Venue.where(conference_id: conf_ids_for_organizer).pluck(:id)
|
||||
can :manage, Lodging, conference_id: conf_ids_for_organizer
|
||||
can :manage, Room, venue: { conference_id: conf_ids_for_organizer}
|
||||
can :manage, Sponsor, conference_id: conf_ids_for_organizer
|
||||
|
|
@ -188,6 +190,7 @@ class Ability
|
|||
can :manage, EmailSettings, conference_id: conf_ids_for_cfp
|
||||
can :manage, Room, venue: { conference_id: conf_ids_for_cfp }
|
||||
can :show, Venue, conference_id: conf_ids_for_cfp
|
||||
can :show, Commercial, commercialable_type: 'Venue', commercialable_id: Venue.where(conference_id: conf_ids_for_cfp).pluck(:id)
|
||||
can :manage, Cfp, program: { conference_id: conf_ids_for_cfp }
|
||||
can :manage, Program, conference_id: conf_ids_for_cfp
|
||||
can :manage, Commercial, commercialable_type: 'Event',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue