WIP: cancan permissions; it breaks stuff!

This commit is contained in:
John N. Milner
2013-04-07 20:44:53 -04:00
parent ff708d940b
commit 6a29eda8d9
5 changed files with 24 additions and 19 deletions
+2 -2
View File
@@ -17,7 +17,7 @@ class AppTabPanel < Netzke::Basepack::TabPanel
]
#for users
if controller.current_user.user?
if controller.current_user.role?(:user)
# (had to use hash for borders to get the title to display properly)
@@app_tab_panel_items.concat [{ layout: :fit,
wrappedComponent: :user_profile_border,
@@ -28,7 +28,7 @@ class AppTabPanel < Netzke::Basepack::TabPanel
]
end
#for admins
if controller.current_user.admin?
if controller.current_user.role?(:admin)
# (had to use hash for borders to get the title to display properly)
@@app_tab_panel_items.concat [{ layout: :fit,
wrappedComponent: :users_and_profiles_border,
+6 -5
View File
@@ -30,11 +30,12 @@ class BikeLogs < Netzke::Basepack::Grid
}
}
]
if controller.current_user.user?
c.prohibit_update = true
c.prohibit_create = true
c.prohibit_delete = true
#TODO: fix GUI so it actually respects this
current_bike = Bike.find_by_id(session[:selected_bike_id])
if cannot? :update, current_bike
# 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
end
end