ability.rb revision f1304db188bff0f7c40172819863ffe54401b400
# Define abilities for the passed in user here.
if user.admin?
can { true }
elsif user.id
# Repositories
can [:write], Repository do |subject|
end
can [:edit, :update, :destroy, :permissions], Repository do |subject|
end
# Ontology
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