GW2RegisterPoliciesFile
Ang GW2RegisterPoliciesFile ay nagrerehistro ng XML file ng content management policy sa isang session.
Kung alinman sa GW2RegisterPoliciesFile o GW2RegisterPoliciesMemory ay hindi nairehistro sa isang session, ang mga default policy ay ilalapat sa session na iyon. Itinatakda ng default policy ang lahat ng content management switch sa Sanitise.
- C++
- C#
- Java
- Python
- JavaScript
Buod
Ang function na GW2RegisterPoliciesFile ay humihiling na ang session ay gumamit ng mga policy na tinukoy sa file na ang pangalan ay ang string na tinutukoy ng filename. Ang format ng mga policy ay nasa format na tinukoy ng format. Ang mga policy ay ilalapat sa lahat ng processing na isinasagawa ng Glasswall para sa session na iyon.
#include "glasswall.core2.api.h"
int GW2RegisterPoliciesFile(Session session, const char *filename, Policy_format format);
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Halimbawa
#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 */
Buod
Inirerehistro sa session na tinutukoy ng session ang file na tinutukoy ng policiesFilePath, na may format na tinukoy ng 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
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.
Buod
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
Paglalarawan
Sumangguni sa API Overview/Return types para sa mga wastong enumerator para sa format.
Ang mga parameter ng function na GW2RegisterPoliciesFile ay na-update upang gumamit ng String kapalit ng byte[]. Ang orihinal na function ay deprecated na.
Ibinabalik
Ang function na GW2RegisterPoliciesFile ay nagbabalik ng isang GW2_RetStatus enumeration na kino-convert sa int. Magiging negatibo ang value kung may naganap na error. Ang 0 ay nagpapahiwatig ng tagumpay. Sumangguni sa API Overview/Return types para sa mga detalye.
Isang NullPointerException exception ang ita-throw kung ang policiesFilePath ay null o walang laman.
Isang GlasswallException exception ang ita-throw kung invalid ang session, kung hindi makuha ang policiesFilePath, o kung hindi ma-convert ang policiesFilePath sa UTF-8.
Buod
Itinatakda ang configuration ng content management policy. Kung ang input_file ay None, ilalapat ang mga default na setting (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'.
"""
Ibinabalik
Isang object na may iba't ibang attribute depende sa uri ng input_file.
-
Kung ang input_file ay isang str file path:
- gw_return_object (glasswall.GwReturnObj): Isang instance ng GwReturnObj na may mga attribute na 'session', 'input_file', 'policy_format', 'status'.
-
Kung ang input_file ay isang file sa memory:
- gw_return_object (glasswall.GwReturnObj): Isang instance ng GwReturnObj na may mga attribute na 'session', 'buffer', 'buffer_length', 'policy_format', 'status'.
Ang status attribute ay isang integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng failure.
Buod
Humihiling ang function na ito na gamitin ng tinukoy na session ang mga policy sa tinukoy na file.
/**
* @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)
Ibinabalik
Nagbabalik ng integer na GW2_RetStatus enum value. Ang mga negatibong numero ay nagpapahiwatig ng pagkabigo.