ability.rb revision 0ae77dd0f6698fa1948d1c6c973cc64d6df9e8d6
# Define abilities for the passed in user here.
if user.admin?
can { true }
elsif user.id
# Ontologies
end
can [:destroy, :permissions], Ontology do |subject|
end
# Logics
end
can [:destroy, :permissions], Logic do |subject|
end
# LogicMappings
can [:edit, :update], LogicMapping do |subject|
end
can [:destroy, :permissions], LogicMapping do |subject|
end
can [:new, :create], LogicMapping
# LogicMappings
can [:edit, :update], LanguageMapping do |subject|
end
can [:destroy, :permissions], LanguageMapping do |subject|
end
can [:new, :create], LanguageMapping
# Languages
end
can [:destroy, :permissions], Language do |subject|
end
# Team permissions
end
# Comments
subject.user == user || subject.commentable.permission?(:owner, user)
end
# TODO tests written?
subject.user == user || subject.metadatable.permission?(:editor, user)
end
end
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
end
end