Introduce new enabled
option for CodeHarbor
* Fix tests to ensure they work independent of config option
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user