共用方式為


IAcl.GetPermissions(IPrincipal) Method

Definition

Returns an enumeration for the set of allowed permissions for the specified principal (representing an entity such as an individual or a group).

[Android.Runtime.Register("getPermissions", "(Ljava/security/Principal;)Ljava/util/Enumeration;", "GetGetPermissions_Ljava_security_Principal_Handler:Java.Security.Acl.IAclInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Java.Util.IEnumeration? GetPermissions (Java.Security.IPrincipal? user);
[<Android.Runtime.Register("getPermissions", "(Ljava/security/Principal;)Ljava/util/Enumeration;", "GetGetPermissions_Ljava_security_Principal_Handler:Java.Security.Acl.IAclInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetPermissions : Java.Security.IPrincipal -> Java.Util.IEnumeration

Parameters

user
IPrincipal

the principal whose permission set is to be returned.

Returns

the permission set specifying the permissions the principal is allowed.

Attributes

Remarks

Returns an enumeration for the set of allowed permissions for the specified principal (representing an entity such as an individual or a group). This set of allowed permissions is calculated as follows:

<ul>

<li>If there is no entry in this Access Control List for the specified principal, an empty permission set is returned.

<li>Otherwise, the principal's group permission sets are determined. (A principal can belong to one or more groups, where a group is a group of principals, represented by the Group interface.) The group positive permission set is the union of all the positive permissions of each group that the principal belongs to. The group negative permission set is the union of all the negative permissions of each group that the principal belongs to. If there is a specific permission that occurs in both the positive permission set and the negative permission set, it is removed from both.

The individual positive and negative permission sets are also determined. The positive permission set contains the permissions specified in the positive ACL entry (if any) for the principal. Similarly, the negative permission set contains the permissions specified in the negative ACL entry (if any) for the principal. The individual positive (or negative) permission set is considered to be null if there is not a positive (negative) ACL entry for the principal in this ACL.

The set of permissions granted to the principal is then calculated using the simple rule that individual permissions always override the group permissions. That is, the principal's individual negative permission set (specific denial of permissions) overrides the group positive permission set, and the principal's individual positive permission set overrides the group negative permission set.

</ul>

Java documentation for java.security.acl.Acl.getPermissions(java.security.Principal).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to