1
0
mirror of https://github.com/fspc/BikeShed-1.git synced 2025-02-28 16:53:23 -05:00

Fixing some bike logs permissions

This commit is contained in:
Jason Denney 2013-06-01 16:32:33 -04:00
parent 88d3160e29
commit 1defca3668
2 changed files with 12 additions and 3 deletions

View File

@ -31,13 +31,18 @@ class BikeLogs < Netzke::Basepack::Grid
} }
] ]
@bike_logs = ::ActsAsLoggable::Log.where(:loggable_type => "Bike").all
c.prohibit_update = true if cannot? :update, @bike_logs
c.prohibit_create = true if cannot? :create, @bike_logs
c.prohibit_delete = true if cannot? :delete, @bike_logs
=begin
#TODO: fix GUI so it actually respects this #TODO: fix GUI so it actually respects this
current_bike = Bike.find_by_id(session[:selected_bike_id]) current_bike = Bike.find_by_id(session[:selected_bike_id])
if cannot? :update, current_bike if cannot? :update, current_bike
# if you can't update the bike, you can't do anything to the log # if you can't update the bike, you can't do anything to the log
c.prohibit_update = c.prohibit_create = c.prohibit_delete = true c.prohibit_update = c.prohibit_create = c.prohibit_delete = true
end end
=end
end end
def default_fields_for_forms def default_fields_for_forms
@ -50,7 +55,7 @@ class BikeLogs < Netzke::Basepack::Grid
] ]
end end
=begin
#override with nil to remove actions #override with nil to remove actions
def default_bbar def default_bbar
bbar = [ :search ] bbar = [ :search ]
@ -58,5 +63,5 @@ class BikeLogs < Netzke::Basepack::Grid
bbar.concat [ :add_in_form ] if can? :create, ::ActsAsLoggable::Log bbar.concat [ :add_in_form ] if can? :create, ::ActsAsLoggable::Log
bbar bbar
end end
=end
end end

View File

@ -30,6 +30,10 @@ class Bikes < Netzke::Basepack::Grid
} }
} }
] ]
@bike = Bike.all
c.prohibit_update = true if cannot? :update, @bike
c.prohibit_create = true if cannot? :create, @bike
c.prohibit_delete = true if cannot? :delete, @bike
end end
def default_fields_for_forms def default_fields_for_forms
# :field_label MUST be defined in order for search to work # :field_label MUST be defined in order for search to work