コード例 #1
0
        /// <summary>
        /// Convert an enumerable access rights to a string
        /// </summary>
        /// <param name="granted_access">The granted access mask.</param>
        /// <param name="generic_mapping">Generic mapping for object type.</param>
        /// <param name="enum_type">Enum type to convert to string.</param>
        /// <param name="map_to_generic">True to try and convert to generic rights where possible.</param>
        /// <returns>The string format of the access rights</returns>
        public static string GrantedAccessAsString(AccessMask granted_access, GenericMapping generic_mapping, Type enum_type, bool map_to_generic)
        {
            if (granted_access == 0)
            {
                return("None");
            }

            AccessMask mapped_access = generic_mapping.MapMask(granted_access);

            if (map_to_generic)
            {
                mapped_access = generic_mapping.UnmapMask(mapped_access);
            }
            else if (generic_mapping.HasAll(granted_access))
            {
                return("Full Access");
            }

            return(AccessRightsToString(enum_type, mapped_access));
        }
コード例 #2
0
 /// <summary>
 /// Checks if an access mask represents a full permission on this type
 /// </summary>
 /// <param name="access_mask">The access mask to check</param>
 /// <returns>True if it has full permissions</returns>
 public bool HasFullPermission(AccessMask access_mask)
 {
     return(GenericMapping.HasAll(access_mask));
 }