-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
IsapiCgiRestrictionItem.cs
54 lines (43 loc) · 1.5 KB
/
IsapiCgiRestrictionItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) Lex Li. All rights reserved.
//
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace JexusManager.Features.IsapiCgiRestriction
{
using Microsoft.Web.Administration;
internal class IsapiCgiRestrictionItem : IItem<IsapiCgiRestrictionItem>
{
public IsapiCgiRestrictionItem(ConfigurationElement element)
{
Element = element;
Flag = element == null || element.IsLocallyStored ? "Local" : "Inhertied";
if (element == null)
{
return;
}
Description = (string)element["description"];
Path = (string)element["path"];
Allowed = (bool)element["allowed"];
}
public bool Allowed { get; set; }
public string Path { get; set; }
public string Description { get; set; }
public ConfigurationElement Element { get; set; }
public string Flag { get; set; }
public bool Equals(IsapiCgiRestrictionItem other)
{
// all properties
return Match(other) && other.Description == Description;
}
public void Apply()
{
Element["description"] = Description;
Element["path"] = Path;
Element["allowed"] = Allowed;
}
public bool Match(IsapiCgiRestrictionItem other)
{
// match combined keys.
return other != null && other.Path == Path;
}
}
}