mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-27 21:21:37 -04:00
Initial work on permissions with cancan
This commit is contained in:
@@ -3,18 +3,18 @@ class UserProfiles < Netzke::Basepack::Grid
|
||||
def configure(c)
|
||||
super
|
||||
|
||||
if controller.current_user.user?
|
||||
user_profiles_scope = lambda { |rel| rel.where(:user_id => controller.current_user.id);}
|
||||
user_profiles_data_store = { auto_load: true }
|
||||
user_profile_strong_default_attrs = {
|
||||
:user_id => controller.current_user.id
|
||||
}
|
||||
else
|
||||
if can? :manage, UserProfile
|
||||
user_profiles_scope = lambda { |rel| rel.where(:user_id => session[:selected_user_id]);}
|
||||
user_profiles_data_store = { auto_load: false}
|
||||
user_profile_strong_default_attrs = {
|
||||
:user_id => session[:selected_user_id]
|
||||
}
|
||||
else
|
||||
user_profiles_scope = lambda { |rel| rel.where(:user_id => controller.current_user.id);}
|
||||
user_profiles_data_store = { auto_load: true }
|
||||
user_profile_strong_default_attrs = {
|
||||
:user_id => controller.current_user.id
|
||||
}
|
||||
end
|
||||
|
||||
c.model = "UserProfile"
|
||||
|
||||
Reference in New Issue
Block a user