Limit access to archived conferences
This commit is contained in:
parent
89dd1890fd
commit
71e8ab74da
@ -8,7 +8,11 @@ module Management
|
||||
private
|
||||
|
||||
def authorize_user!
|
||||
head :forbidden unless current_user.admin?
|
||||
if params[:conference_id] && params[:conference_id].to_i < Conference.last.id
|
||||
head :forbidden unless current_user.admin? && current_user.owner?
|
||||
else
|
||||
head :forbidden unless current_user.admin?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
5
db/migrate/20241001115434_add_owner_field_to_users.rb
Normal file
5
db/migrate/20241001115434_add_owner_field_to_users.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class AddOwnerFieldToUsers < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
add_column :users, :owner, :boolean, null: false, default: false
|
||||
end
|
||||
end
|
@ -11,4 +11,5 @@ User.create(
|
||||
password_confirmation: "123qweASD",
|
||||
confirmed_at: Time.current,
|
||||
admin: true
|
||||
owner: true
|
||||
)
|
||||
|
1997
db/structure.sql
Normal file
1997
db/structure.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@ FactoryBot.define do
|
||||
|
||||
factory :administrator do
|
||||
admin { true }
|
||||
owner { true }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user