System.Security.PermissionToken.IsTokenProperlyAssigned C# (CSharp) Method

IsTokenProperlyAssigned() public static method

public static IsTokenProperlyAssigned ( IPermission perm, PermissionToken token ) : bool
perm IPermission
token PermissionToken
return bool
        public static bool IsTokenProperlyAssigned( IPermission perm, PermissionToken token )
        {
            PermissionToken heldToken = GetToken( perm );
            if (heldToken.m_index != token.m_index)
                return false;

            if (token.m_type != heldToken.m_type)
                return false;

            if (perm.GetType().Module.Assembly == Assembly.GetExecutingAssembly() &&
                heldToken.m_index >= BuiltInPermissionIndex.NUM_BUILTIN_NORMAL + BuiltInPermissionIndex.NUM_BUILTIN_UNRESTRICTED)
                return false;

            return true;
        }