NamedPermissionSet 類別

定義

定義具有與其相關的名稱和說明的使用權限集合。Defines a permission set that has a name and description associated with it. 這個類別無法被繼承。This class cannot be inherited.

public ref class NamedPermissionSet sealed : System::Security::PermissionSet
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class NamedPermissionSet : System.Security.PermissionSet
type NamedPermissionSet = class
    inherit PermissionSet
Public NotInheritable Class NamedPermissionSet
Inherits PermissionSet
繼承
NamedPermissionSet
屬性

範例

下列程式碼範例示範如何使用NamedPermissionSet類別的成員。The following code example shows the use of members of the NamedPermissionSet class.

備註

在安全性原則管理中,會使用命名許可權集合,指定要授與屬於特定程式碼群組之程式碼的許可權。Named permission sets are used in security policy administration to specify the permissions to be granted to code that belongs to certain code groups. 名稱是英數位元的字串。Names are strings of alphanumeric characters. 描述字串可以包含任何可列印的字元。Description strings can consist of any printable characters.

建構函式

NamedPermissionSet(NamedPermissionSet)

從其他具名使用權限集合中初始化 NamedPermissionSet 類別的新執行個體。Initializes a new instance of the NamedPermissionSet class from another named permission set.

NamedPermissionSet(String)

使用指定的名稱來初始化 NamedPermissionSet 類別的全新執行個體。Initializes a new, empty instance of the NamedPermissionSet class with the specified name.

NamedPermissionSet(String, PermissionSet)

使用來自使用權限集合的指定名稱來初始化 NamedPermissionSet 類別的新執行個體。Initializes a new instance of the NamedPermissionSet class with the specified name from a permission set.

NamedPermissionSet(String, PermissionState)

使用不受限制或完全限制狀態中的指定名稱來初始化 NamedPermissionSet 類別的新執行個體。Initializes a new instance of the NamedPermissionSet class with the specified name in either an unrestricted or a fully restricted state.

屬性

Count

取得權限集合所包含的權限物件數目。Gets the number of permission objects contained in the permission set.

(繼承來源 PermissionSet)
Description

取得或設定目前具名使用權限集合的文字描述。Gets or sets the text description of the current named permission set.

IsReadOnly

取得值,表示集合是否為唯讀。Gets a value indicating whether the collection is read-only.

(繼承來源 PermissionSet)
IsSynchronized

取得值,指出是否保證集合為安全執行緒。Gets a value indicating whether the collection is guaranteed to be thread safe.

(繼承來源 PermissionSet)
Name

取得或設定目前具名使用權限集合的名稱。Gets or sets the name of the current named permission set.

SyncRoot

取得目前集合的根物件。Gets the root object of the current collection.

(繼承來源 PermissionSet)

方法

AddPermission(IPermission)

將指定的權限加入 PermissionSetAdds a specified permission to the PermissionSet.

(繼承來源 PermissionSet)
AddPermissionImpl(IPermission)

將指定的權限加入 PermissionSetAdds a specified permission to the PermissionSet.

(繼承來源 PermissionSet)
Assert()

宣告即使堆疊中較高層的呼叫端未獲得資源存取權限,呼叫程式碼仍可透過呼叫這個方法的程式碼要求權限,來存取受保護的資源。Declares that the calling code can access the resource protected by a permission demand through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. 使用 Assert() 會造成安全性弱點。Using Assert() can create security vulnerabilities.

(繼承來源 PermissionSet)
ContainsNonCodeAccessPermissions()

取得值,表示 PermissionSet 是否包含非衍生自 CodeAccessPermission 的權限。Gets a value indicating whether the PermissionSet contains permissions that are not derived from CodeAccessPermission.

(繼承來源 PermissionSet)
Copy()

從具名使用權限集合中建立使用權限集合複本。Creates a permission set copy from a named permission set.

Copy(String)

使用不同的名稱但相同的使用權限建立具名使用權限集合的複本。Creates a copy of the named permission set with a different name but the same permissions.

CopyTo(Array, Int32)

將集合的權限物件複製到 Array 中的指定位置。Copies the permission objects of the set to the indicated location in an Array.

(繼承來源 PermissionSet)
Demand()

如果在呼叫堆疊中較高的所有呼叫端都尚未被授與由目前執行個體所指定之權限,則會在執行階段強制執行 SecurityExceptionForces a SecurityException at run time if all callers higher in the call stack have not been granted the permissions specified by the current instance.

(繼承來源 PermissionSet)
Deny()

會讓任何通過權限呼叫程式碼的 Demand() 失敗,該權限與目前 PermissionSet 中包含的權限類型有交集。Causes any Demand() that passes through the calling code for a permission that has an intersection with a permission of a type contained in the current PermissionSet to fail.

(繼承來源 PermissionSet)
Equals(Object)

判斷指定的 NamedPermissionSet 物件是否等於目前的 NamedPermissionSetDetermines whether the specified NamedPermissionSet object is equal to the current NamedPermissionSet.

FromXml(SecurityElement)

使用 XML 編碼方式重建具有指定狀態的具名使用權限集合。Reconstructs a named permission set with a specified state from an XML encoding.

GetEnumerator()

傳回此集合權限的列舉值。Returns an enumerator for the permissions of the set.

(繼承來源 PermissionSet)
GetEnumeratorImpl()

傳回此集合權限的列舉值。Returns an enumerator for the permissions of the set.

(繼承來源 PermissionSet)
GetHashCode()

取得 NamedPermissionSet 物件的雜湊碼,其適合用於雜湊表這類的雜湊演算法和資料結構。Gets a hash code for the NamedPermissionSet object that is suitable for use in hashing algorithms and data structures such as a hash table.

GetPermission(Type)

如果它存在此集合中,則取得指定類型的使用權限物件。Gets a permission object of the specified type, if it exists in the set.

(繼承來源 PermissionSet)
GetPermissionImpl(Type)

如果它存在此集合中,則取得指定類型的使用權限物件。Gets a permission object of the specified type, if it exists in the set.

(繼承來源 PermissionSet)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
Intersect(PermissionSet)

建立並傳回目前 PermissionSet 與指定 PermissionSet 交集的權限集。Creates and returns a permission set that is the intersection of the current PermissionSet and the specified PermissionSet.

(繼承來源 PermissionSet)
IsEmpty()

取得值,指出 PermissionSet 是否為空的。Gets a value indicating whether the PermissionSet is empty.

(繼承來源 PermissionSet)
IsSubsetOf(PermissionSet)

判斷目前的 PermissionSet 是否為指定 PermissionSet 的子集。Determines whether the current PermissionSet is a subset of the specified PermissionSet.

(繼承來源 PermissionSet)
IsUnrestricted()

判斷 PermissionSet 是否為 UnrestrictedDetermines whether the PermissionSet is Unrestricted.

(繼承來源 PermissionSet)
MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
PermitOnly()

會讓透過非目前 PermissionSet 子集的任何 PermissionSet 呼叫程式碼傳遞之任何 Demand() 失敗。Causes any Demand() that passes through the calling code for any PermissionSet that is not a subset of the current PermissionSet to fail.

(繼承來源 PermissionSet)
RemovePermission(Type)

從集合中移除特定類型的權限。Removes a permission of a certain type from the set.

(繼承來源 PermissionSet)
RemovePermissionImpl(Type)

從集合中移除特定類型的權限。Removes a permission of a certain type from the set.

(繼承來源 PermissionSet)
SetPermission(IPermission)

將權限設定為 PermissionSet,以取代任何相同類型的現有權限。Sets a permission to the PermissionSet, replacing any existing permission of the same type.

(繼承來源 PermissionSet)
SetPermissionImpl(IPermission)

將權限設定為 PermissionSet,以取代任何相同類型的現有權限。Sets a permission to the PermissionSet, replacing any existing permission of the same type.

(繼承來源 PermissionSet)
ToString()

傳回 PermissionSet 的字串表示法。Returns a string representation of the PermissionSet.

(繼承來源 PermissionSet)
ToXml()

建立具名使用權限集合的 XML 項目描述。Creates an XML element description of the named permission set.

Union(PermissionSet)

建立目前 PermissionSet 與指定 PermissionSet 聯集的 PermissionSetCreates a PermissionSet that is the union of the current PermissionSet and the specified PermissionSet.

(繼承來源 PermissionSet)

明確介面實作

IDeserializationCallback.OnDeserialization(Object)

執行於整個物件 Graph 已經還原序列化時。Runs when the entire object graph has been deserialized.

(繼承來源 PermissionSet)

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於