blob: f93f26daa98047ec80191d820cda61976f833e85 (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Security.Permissions
{
using System;
using System.Globalization;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
#pragma warning disable 618
sealed public class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute
#pragma warning restore 618
{
#pragma warning disable 618
public GacIdentityPermissionAttribute( SecurityAction action )
#pragma warning restore 618
: base( action )
{
}
public override IPermission CreatePermission()
{
return new GacIdentityPermission();
}
}
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
sealed public class GacIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
//------------------------------------------------------
//
// PUBLIC CONSTRUCTORS
//
//------------------------------------------------------
public GacIdentityPermission(PermissionState state)
{
if (state != PermissionState.Unrestricted && state != PermissionState.None)
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState"));
}
}
public GacIdentityPermission()
{
}
//------------------------------------------------------
//
// IPERMISSION IMPLEMENTATION
//
//------------------------------------------------------
public override IPermission Copy()
{
return new GacIdentityPermission();
}
public override bool IsSubsetOf(IPermission target)
{
if (target == null)
return false;
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return true;
}
public override IPermission Intersect(IPermission target)
{
if (target == null)
return null;
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return this.Copy();
}
public override IPermission Union(IPermission target)
{
if (target == null)
return this.Copy();
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return this.Copy();
}
/// <internalonly/>
int IBuiltInPermission.GetTokenIndex()
{
return GacIdentityPermission.GetTokenIndex();
}
internal static int GetTokenIndex()
{
return BuiltInPermissionIndex.GacIdentityPermissionIndex;
}
}
}
|