Skip to content

Commit

Permalink
Merge pull request dotnet#9114 from erozenfeld/SecurityPermissionAttr…
Browse files Browse the repository at this point in the history
…ibute

Remove System.Security.Permissions.SecurityPermissionAttribute from System.Private.CoreLib.
  • Loading branch information
erozenfeld authored Jan 26, 2017
2 parents b0e0168 + b6c8522 commit 4f1be93
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 108 deletions.
2 changes: 0 additions & 2 deletions src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ public void DisableComObjectEagerCleanup()
** thread is not currently blocked in that manner, it will be interrupted
** when it next begins to block.
=========================================================================*/
#pragma warning disable 618 // obsolete types: SecurityPermissionAttribute, SecurityAction
#pragma warning restore 618 // obsolete types: SecurityPermissionAttribute, SecurityAction
public void Interrupt() => InterruptInternal();

// Internal helper (since we can't place security demands on
Expand Down
103 changes: 0 additions & 103 deletions src/mscorlib/src/System/Security/Permissions/PermissionAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,109 +502,6 @@ public override IPermission CreatePermission()
}
}

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
// The csharp compiler requires these types to be public, but they are not used elsewhere.
[Obsolete("SecurityPermissionAttribute is no longer accessible to application code.")]
sealed public class SecurityPermissionAttribute : CodeAccessSecurityAttribute
{
private SecurityPermissionFlag m_flag = SecurityPermissionFlag.NoFlags;

public SecurityPermissionAttribute( SecurityAction action )
: base( action )
{
}

public SecurityPermissionFlag Flags {
get { return m_flag; }
set { m_flag = value; }
}

public bool Assertion {
get { return (m_flag & SecurityPermissionFlag.Assertion) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.Assertion : m_flag & ~SecurityPermissionFlag.Assertion; }
}

public bool UnmanagedCode {
get { return (m_flag & SecurityPermissionFlag.UnmanagedCode) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.UnmanagedCode : m_flag & ~SecurityPermissionFlag.UnmanagedCode; }
}

public bool SkipVerification {
get { return (m_flag & SecurityPermissionFlag.SkipVerification) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.SkipVerification : m_flag & ~SecurityPermissionFlag.SkipVerification; }
}

public bool Execution {
get { return (m_flag & SecurityPermissionFlag.Execution) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.Execution : m_flag & ~SecurityPermissionFlag.Execution; }
}

public bool ControlThread {
get { return (m_flag & SecurityPermissionFlag.ControlThread) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.ControlThread : m_flag & ~SecurityPermissionFlag.ControlThread; }
}

public bool ControlEvidence {
get { return (m_flag & SecurityPermissionFlag.ControlEvidence) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.ControlEvidence : m_flag & ~SecurityPermissionFlag.ControlEvidence; }
}

public bool ControlPolicy {
get { return (m_flag & SecurityPermissionFlag.ControlPolicy) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.ControlPolicy : m_flag & ~SecurityPermissionFlag.ControlPolicy; }
}

public bool SerializationFormatter {
get { return (m_flag & SecurityPermissionFlag.SerializationFormatter) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.SerializationFormatter : m_flag & ~SecurityPermissionFlag.SerializationFormatter; }
}

public bool ControlDomainPolicy {
get { return (m_flag & SecurityPermissionFlag.ControlDomainPolicy) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.ControlDomainPolicy : m_flag & ~SecurityPermissionFlag.ControlDomainPolicy; }
}

public bool ControlPrincipal {
get { return (m_flag & SecurityPermissionFlag.ControlPrincipal) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.ControlPrincipal : m_flag & ~SecurityPermissionFlag.ControlPrincipal; }
}

public bool ControlAppDomain {
get { return (m_flag & SecurityPermissionFlag.ControlAppDomain) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.ControlAppDomain : m_flag & ~SecurityPermissionFlag.ControlAppDomain; }
}

public bool RemotingConfiguration {
get { return (m_flag & SecurityPermissionFlag.RemotingConfiguration) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.RemotingConfiguration : m_flag & ~SecurityPermissionFlag.RemotingConfiguration; }
}

[System.Runtime.InteropServices.ComVisible(true)]
public bool Infrastructure {
get { return (m_flag & SecurityPermissionFlag.Infrastructure) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.Infrastructure : m_flag & ~SecurityPermissionFlag.Infrastructure; }
}

public bool BindingRedirects {
get { return (m_flag & SecurityPermissionFlag.BindingRedirects) != 0; }
set { m_flag = value ? m_flag | SecurityPermissionFlag.BindingRedirects : m_flag & ~SecurityPermissionFlag.BindingRedirects; }
}

public override IPermission CreatePermission()
{
if (m_unrestricted)
{
return new SecurityPermission( PermissionState.Unrestricted );
}
else
{
return new SecurityPermission( m_flag );
}
}
}

[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
Expand Down
3 changes: 0 additions & 3 deletions src/mscorlib/src/System/Threading/Thread.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,6 @@ internal SynchronizationContext SynchronizationContext
** If Abort is called twice on the same thread, a DuplicateThreadAbort
** exception is thrown.
=========================================================================*/
#pragma warning disable 618
[SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)]
#pragma warning restore 618
public void Abort()
{
AbortInternal();
Expand Down

0 comments on commit 4f1be93

Please sign in to comment.