ability.rb revision 7c5e9db9a07461d92c007563a2a27ca42ce93bae
# 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
# LanguageMappings
can [:edit, :update], LanguageMapping do |subject|
end
can [:destroy, :permissions], LanguageMapping do |subject|
end
can [:new, :create], LanguageMapping
# LogicAdjoints
can [:edit, :update], LogicAdjoint do |subject|
end
can [:destroy, :permissions], LogicAdjoint do |subject|
end
can [:new, :create], LogicAdjoint
# LanguageAdjoints
can [:edit, :update], LanguageAdjoint do |subject|
end
can [:destroy, :permissions], LanguageAdjoint do |subject|
end
can [:new, :create], LanguageAdjoint
# Languages
end
can [:destroy, :permissions], Language do |subject|
end
# Serializations
# 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