2019-06-26 10:13:11 +02:00
|
|
|
|
/*
|
2024-03-05 18:37:42 +01:00
|
|
|
|
* Copyright (c) 2024 ETH Zürich, IT Services
|
2019-06-26 10:13:11 +02:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.Serialization;
|
2019-08-30 09:55:26 +02:00
|
|
|
|
using SafeExamBrowser.Lockdown.Contracts;
|
|
|
|
|
using SafeExamBrowser.Logging.Contracts;
|
2019-06-26 10:13:11 +02:00
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.Lockdown.FeatureConfigurations
|
|
|
|
|
{
|
|
|
|
|
[Serializable]
|
|
|
|
|
internal abstract class FeatureConfiguration : IFeatureConfiguration
|
|
|
|
|
{
|
|
|
|
|
[NonSerialized]
|
|
|
|
|
protected ILogger logger;
|
|
|
|
|
|
|
|
|
|
public Guid Id { get; }
|
|
|
|
|
public Guid GroupId { get; }
|
|
|
|
|
|
|
|
|
|
public FeatureConfiguration(Guid groupId, ILogger logger)
|
|
|
|
|
{
|
|
|
|
|
this.GroupId = groupId;
|
|
|
|
|
this.Id = Guid.NewGuid();
|
|
|
|
|
this.logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-27 08:32:37 +02:00
|
|
|
|
public abstract bool DisableFeature();
|
|
|
|
|
public abstract bool EnableFeature();
|
2019-07-05 12:28:42 +02:00
|
|
|
|
public abstract FeatureConfigurationStatus GetStatus();
|
2019-07-02 10:35:40 +02:00
|
|
|
|
public abstract void Initialize();
|
2019-07-19 10:07:45 +02:00
|
|
|
|
public abstract bool Reset();
|
2019-06-27 08:32:37 +02:00
|
|
|
|
public abstract bool Restore();
|
2019-06-26 10:13:11 +02:00
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return $"{GetType().Name} ({Id})";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[OnDeserialized]
|
|
|
|
|
private void OnDeserializedMethod(StreamingContext context)
|
|
|
|
|
{
|
|
|
|
|
logger = (context.Context as IModuleLogger).CloneFor(GetType().Name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|