Hide navigation elements in the UI based on policies

This commit is contained in:
Sebastian Serth
2018-11-22 19:11:40 +01:00
parent 4b251599ff
commit 7a63a9c1c1
3 changed files with 22 additions and 13 deletions

View File

@ -4,6 +4,14 @@ module CodeOcean
@user == @record.context.author
end
def show?
if @record.context.is_a?(Exercise)
admin? || author? || !@record.hidden
else
admin? || author?
end
end
def create?
if @record.context.is_a?(Exercise)
admin? || author?