ability.rb revision f4f335875509867dd238df7c92b0b8f4fe101705
7b025f9d9726413eb3f50ca2b39826e7eed816fbJulian Kornberger # Define abilities for the passed in user here.
7b025f9d9726413eb3f50ca2b39826e7eed816fbJulian Kornberger user ||= User.new # guest user (not logged in)
be6eb5d7ea1888f2f835fe0fff358f72572afeb4henning mueller can [:destroy, :permissions], Ontology do |subject|
7b025f9d9726413eb3f50ca2b39826e7eed816fbJulian Kornberger can [:edit, :update, :destroy], Team do |subject|
8566aec18eff0f0d248d73d2f44f9df16cc41456Julian Kornberger subject.user == user || subject.commentable.permission?(:owner, user)
f4f335875509867dd238df7c92b0b8f4fe101705Julian Kornberger can [:create, :destroy], Metadatum do |subject|
f4f335875509867dd238df7c92b0b8f4fe101705Julian Kornberger subject.user == user || subject.metadatable.permission?(:editor, user)
7b025f9d9726413eb3f50ca2b39826e7eed816fbJulian Kornberger # See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities