Skip to content

Instantly share code, notes, and snippets.

@ratnikov
Forked from anonymous/feedback please?
Created June 15, 2009 20:10
Show Gist options
  • Save ratnikov/130301 to your computer and use it in GitHub Desktop.
Save ratnikov/130301 to your computer and use it in GitHub Desktop.
def can_edit?(this_user)
=begin
if can_delete(this_user)
return true
end
if this_user.isadmin
return true
end
if user == this_user
return true
end
if self.locked
return false
end
return true
=end
can_delete(this_user) || this_user.isadmin || (user == this_user) && (!self.locked)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment