GW2RegisterPoliciesFile
GW2RegisterPoliciesFile は、コンテンツ管理 policy XML ファイルをセッションに登録します。
GW2RegisterPoliciesFile と GW2RegisterPoliciesMemory のいずれもセッションに登録されていない場合、そのセッションにはデフォルトの policy が適用されます。デフォルトの policy では、すべてのコンテンツ管理スイッチが Sanitise に設定されます。
- C++
- C#
- Java
- Python
- JavaScript
概要
GW2RegisterPoliciesFile 関数は、session が filename. が指す文字列名のファイルで指定された policy を使用するよう要求します。policy の形式は、format で指定された形式です。policy は、そのセッションに対して Glasswall が実行するすべての処理に適用されます。
#include "glasswall.core2.api.h"
int GW2RegisterPoliciesFile(Session session, const char *filename, Policy_format format);
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
例
#include "glasswall.core2.api.h"
HANDLE session = GW2OpenSession();
if (!session)
/* deal with error */
else
if (GW2RegisterPoliciesFile(session, "Office_Binary_Policies.xml", PF_XML) < 0)
/* deal with error */
else
/* the file has been successfully registered */
...
/* later */
if (GW2CloseSession(session) < 0)
/* error closing session */
概要
session が参照するセッションに対して、policiesFilePath が指すファイルを、policiesFormat で指定された形式で登録します
/// <param name="session">ID number for the session</param>
/// <param name="policiesFilePath">The file path to the file to be processed</param>
/// <param name="policiesFormat">Format of the policy file</param>
public int RegisterPoliciesFile(
int session,
string policiesFilePath,
int policiesFormat
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。
概要
import com.glasswall.core2javabridge.*;
public int GW2RegisterPoliciesFile(int session, String policiesFilePath, int format) throws GlasswallException, NullPointerException
(Deprecated)
public int GW2RegisterPoliciesFile(int session, byte[] policiesFilePath, int format) throws GlasswallException, NullPointerException
説明
format の有効な列挙子については、API Overview/Return types を参照してください。
The GW2RegisterPoliciesFile function parameters have been updated to use String in place of byte[]. The original function has been deprecated.
戻り値
GW2RegisterPoliciesFile 関数は、GW2_RetStatus 列挙型を int に変換して返します。エラーが発生した場合、値は負になります。0 は成功を示します。詳細については、API Overview/Return types を参照してください。
NullPointerException 例外は、policiesFilePath が null または空の場合にスローされます。
A GlasswallException exception will be thrown if session is invalid, if the policiesFilePath could not be retrieved, or if the policiesFilePath could not be converted to UTF-8.
概要
コンテンツ管理 policy 設定を設定します。input_file が None の場合は、デフォルト設定(sanitise)が適用されます。
def set_content_management_policy(self, session: int, input_file: Union[None, str, bytes, bytearray, io.BytesIO, "glasswall.content_management.policies.policy.Policy"] = None, policy_format=0):
""" Sets the content management policy configuration. If input_file is None then default settings (sanitise) are applied.
Args:
session (int): The session integer.
input_file (Union[None, str, bytes, bytearray, io.BytesIO, glasswall.content_management.policies.policy.Policy], optional): Default None (sanitise). The content management policy to apply.
policy_format (int): The format of the content management policy. 0=XML.
Returns:
- result (glasswall.GwReturnObj): Depending on the input 'input_file':
- If input_file is a str file path:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'input_file', 'policy_format', 'status'.
- If input_file is a file in memory:
- gw_return_object (glasswall.GwReturnObj): A GwReturnObj instance with the attributes 'session', 'buffer', 'buffer_length', 'policy_format', 'status'.
"""
戻り値
input_file の種類に応じて異なる属性を持つオブジェクト。
-
input_file が str のファイルパスの場合:
- gw_return_object (glasswall.GwReturnObj): 'session'、'input_file'、'policy_format'、'status' の属性を持つ GwReturnObj インスタンス。
-
input_file がメモリ内のファイルの場合:
- gw_return_object (glasswall.GwReturnObj): 'session'、'buffer'、'buffer_length'、'policy_format'、'status' の属性を持つ GwReturnObj インスタンス。
status 属性は整数の GW2_RetStatus enum 値です。負の数は失敗を示します。
概要
この関数は、指定されたセッションが指定されたファイル内の policy を使用するよう要求します。
/**
* @param {number} session The ID of the session.
* @param {string} filename The filename from which to load policy settings.
* @param {number} format - The format of the policy to be registered.
*/
GW2RegisterPoliciesFile(
session,
filename,
format)
戻り値
整数の GW2_RetStatus 列挙値を返します。負の数は失敗を示します。