Introduce new enabled option for CodeHarbor

* Fix tests to ensure they work independent of config option
This commit is contained in:
Sebastian Serth
2021-02-16 14:24:35 +01:00
parent bcaa3244f4
commit 293bcccc80
8 changed files with 125 additions and 62 deletions

View File

@ -8,23 +8,27 @@ class CodeharborLinkPolicy < ApplicationPolicy
end
def new?
teacher? || admin?
enabled? && (teacher? || admin?)
end
def create?
teacher? || admin?
enabled? && (teacher? || admin?)
end
def edit?
owner?
enabled? && owner?
end
def update?
owner?
enabled? && owner?
end
def destroy?
owner?
enabled? && owner?
end
def enabled?
CodeOcean::Config.new(:code_ocean).read[:codeharbor][:enabled]
end
private