ruby - How do I stop users from editing other user posts in Omniauth (rails) -
i have network people can write posts, , have personal feed of own posts, , network feed of everyone's.
the problem is, omniauth'ed user can edit user typing in /edit or delete on url.
cannot have live site!
does have quick answer how can blocked? have:
before_filter :authenticate_user!, :except => [:index, :show]
but can't figure out without errors how lock down edit user created post.
model- user.rb
class user has_many :posts end
model - post.rb
class post belongs_to :user end
let me know if want see more- help! -d
if read correctly, users authenticated via omniauth, you're looking way 'authorize' them specific resources/actions based on permissions or ownership.
the popular gem authorization of resources/actions users, groups, roles, , in-between cancan.
there railscast video helped me understand application of gem in applications.
once know how write abilities in cancan, take here ability solves original question on post editing based on parent user.
Comments
Post a Comment