diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-09-11 14:24:48 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-09-19 15:22:47 +0200 |
commit | 66c6b9c809b974a33415184e38ee63384b572fc1 (patch) | |
tree | 91c73cd683b17babe34904cda983764e852fed78 | |
parent | Updated core (diff) | |
download | core-66c6b9c809b974a33415184e38ee63384b572fc1.tar.gz core-66c6b9c809b974a33415184e38ee63384b572fc1.zip |
TSCP: Extend the BAF policy with marking and IP parts
Change-Id: I0a30cd4eb31aefc778f4d14547a8c50c375217c3
-rw-r--r-- | include/sfx2/classificationhelper.hxx | 4 | ||||
-rw-r--r-- | sfx2/classification/baf.xsd | 36 | ||||
-rw-r--r-- | sfx2/classification/baf_loext.xsd | 14 | ||||
-rw-r--r-- | sfx2/classification/example.xml | 4 | ||||
-rw-r--r-- | sfx2/classification/example_sl-SI.xml | 2 | ||||
-rw-r--r-- | sfx2/source/view/classificationhelper.cxx | 27 |
6 files changed, 65 insertions, 22 deletions
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx index 3ad53c620259..f43fa07ed6c0 100644 --- a/include/sfx2/classificationhelper.hxx +++ b/include/sfx2/classificationhelper.hxx @@ -78,6 +78,10 @@ public: /// The selected category has some content for the document footer. bool HasDocumentFooter(); void UpdateInfobar(SfxViewFrame& rViewFrame); + + const std::vector<OUString> GetMarkings(); + const std::vector<OUString> GetIntellectualPropertyParts(); + /// Does a best-effort conversion of rType to SfxClassificationPolicyType. static SfxClassificationPolicyType stringToPolicyType(const OUString& rType); /// Returns the string representation of a SfxClassificationPolicyType element. diff --git a/sfx2/classification/baf.xsd b/sfx2/classification/baf.xsd index 778cfbec6036..02796eb29265 100644 --- a/sfx2/classification/baf.xsd +++ b/sfx2/classification/baf.xsd @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xal="urn:oasis:names:tc:ciq:xal:3" xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3" xmlns="urn:tscp:names:baf:1.1" targetNamespace="urn:tscp:names:baf:1.1"> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:xal="urn:oasis:names:tc:ciq:xal:3" xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3" xmlns="urn:tscp:names:baf:1.1" targetNamespace="urn:tscp:names:baf:1.1"> <xs:import namespace="urn:oasis:names:tc:ciq:xal:3" schemaLocation="xAL.xsd"/> <xs:import namespace="urn:oasis:names:tc:ciq:xnl:3" schemaLocation="xNL.xsd"/> - <!-- -Business Authorization ---> + <xs:import namespace="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" schemaLocation="baf_loext.xsd"/> + + <!-- Business Authorization --> <xs:complexType name="BusinessAuthorization"> <xs:sequence> <xs:element ref="PolicyAuthorityName"/> @@ -31,6 +31,8 @@ Business Authorization <xs:complexType> <xs:sequence> <xs:element ref="BusinessAuthorizationCategory" maxOccurs="unbounded"/> + <xs:element ref="loext:Marking" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="loext:IntellectualPropertyPart" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> @@ -38,6 +40,8 @@ Business Authorization <xs:complexType> <xs:sequence> <xs:element ref="BusinessAuthorizationCategory" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="loext:Marking" minOccurs="0" maxOccurs="unbounded"/> + <xs:element ref="loext:IntellectualPropertyPart" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> @@ -51,24 +55,20 @@ Business Authorization <xs:restriction base="xs:date"/> </xs:simpleType> </xs:element> - <!-- -Business Authorization Category ---> + <!-- Business Authorization Category --> <xs:element name="BusinessAuthorizationCategory"> <xs:complexType> <xs:sequence> <xs:element ref="AccessRules" minOccurs="0" maxOccurs="1"/> <xs:element ref="HandlingRules" minOccurs="0" maxOccurs="1"/> - <xs:element ref="LabelingRules"/> - <xs:element ref="ImpactLevel"/> + <xs:element ref="LabelingRules"/> + <xs:element ref="ImpactLevel"/> </xs:sequence> <xs:attribute name="Identifier" type="xs:anyURI" use="required"/> <xs:attribute name="Name" type="xs:string" use="optional"/> </xs:complexType> </xs:element> - <!-- -Impact Level ---> + <!-- Impact Level --> <xs:element name="ImpactLevel"> <xs:complexType> <xs:sequence> @@ -83,9 +83,7 @@ Impact Level <xs:element name="ConfidentalityValue" type="xs:string"/> <xs:element name="IntegrityValue" type="xs:string"/> <xs:element name="AvailabilityValue" type="xs:string"/> - <!-- -Handling Rule ---> + <!-- Handling Rule --> <xs:complexType name="HandlingRule" abstract="true"/> <xs:complexType name="SecureWEBTransmission"> <xs:complexContent> @@ -127,9 +125,7 @@ Handling Rule <xs:extension base="HandlingRule"/> </xs:complexContent> </xs:complexType> - <!-- -Labeling Rule ---> + <!-- Labeling Rule --> <xs:element name="VisualMarkingPart"> <xs:complexType> <xs:sequence> @@ -141,9 +137,7 @@ Labeling Rule </xs:element> <xs:element name="Identifier"/> <xs:element name="Value"/> - <!-- -Others ---> + <!-- Others --> <xs:element name="WorkEffortsScope"> <xs:complexType> <xs:sequence> diff --git a/sfx2/classification/baf_loext.xsd b/sfx2/classification/baf_loext.xsd new file mode 100644 index 000000000000..2d4ee5bb21a8 --- /dev/null +++ b/sfx2/classification/baf_loext.xsd @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" targetNamespace="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"> + <!-- Markings --> + <xs:element name="Marking"> + <xs:complexType> + <xs:attribute name="Name" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> + <xs:element name="IntellectualPropertyPart"> + <xs:complexType> + <xs:attribute name="Name" type="xs:string" use="optional"/> + </xs:complexType> + </xs:element> +</xs:schema> diff --git a/sfx2/classification/example.xml b/sfx2/classification/example.xml index f2647f903a8c..5df86f9a9005 100644 --- a/sfx2/classification/example.xml +++ b/sfx2/classification/example.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<baf:BusinessAuthorization xmlns:baf="urn:tscp:names:baf:1.1"> +<baf:BusinessAuthorization xmlns:baf="urn:tscp:names:baf:1.1" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"> <!-- Translators: this string can be localized --> <baf:PolicyAuthorityName>TSCP Example Policy Authority</baf:PolicyAuthorityName> <!-- Translators: this string can be localized --> @@ -78,6 +78,8 @@ <baf:ConfidentalityValue>3</baf:ConfidentalityValue> </baf:ImpactLevel> </baf:BusinessAuthorizationCategory> + <loext:Marking Name="Example Marking" /> + <loext:IntellectualPropertyPart Name="Example IP Part" /> </baf:Included> </baf:BusinessAuthorization> <!-- vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sfx2/classification/example_sl-SI.xml b/sfx2/classification/example_sl-SI.xml index 1d1983679d83..89bb5c5f6f8f 100644 --- a/sfx2/classification/example_sl-SI.xml +++ b/sfx2/classification/example_sl-SI.xml @@ -65,6 +65,8 @@ <baf:ConfidentalityValue>3</baf:ConfidentalityValue> </baf:ImpactLevel> </baf:BusinessAuthorizationCategory> + <loext:Marking Name="Example Marking" /> + <loext:IntellectualPropertyPart Name="Example IP Part" /> </baf:Included> </baf:BusinessAuthorization> <!-- vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index 2fc02c79b80b..eb9de5f9a3ff 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -98,6 +98,8 @@ class SfxClassificationParser : public cppu::WeakImplHelper<xml::sax::XDocumentH { public: std::vector<SfxClassificationCategory> m_aCategories; + std::vector<OUString> m_aMarkings; + std::vector<OUString> m_aIPParts; OUString m_aPolicyAuthorityName; bool m_bInPolicyAuthorityName = false; @@ -210,6 +212,16 @@ void SAL_CALL SfxClassificationParser::startElement(const OUString& rName, const m_pCategory = &rCategory; } } + else if (rName == "loext:Marking") + { + OUString aName = xAttribs->getValueByName("Name"); + m_aMarkings.push_back(aName); + } + else if (rName == "loext:IntellectualPropertyPart") + { + OUString aName = xAttribs->getValueByName("Name"); + m_aIPParts.push_back(aName); + } else if (rName == "baf:Scale") { m_aScale.clear(); @@ -319,6 +331,9 @@ public: std::map<SfxClassificationPolicyType, SfxClassificationCategory> m_aCategory; /// Possible categories of a policy to choose from. std::vector<SfxClassificationCategory> m_aCategories; + std::vector<OUString> m_aMarkings; + std::vector<OUString> m_aIPParts; + uno::Reference<document::XDocumentProperties> m_xDocumentProperties; explicit Impl(uno::Reference<document::XDocumentProperties> xDocumentProperties); @@ -370,6 +385,8 @@ void SfxClassificationHelper::Impl::parsePolicy() SAL_WARN("sfx.view", "parsePolicy() failed: " << rException.Message); } m_aCategories = xClassificationParser->m_aCategories; + m_aMarkings = xClassificationParser->m_aMarkings; + m_aIPParts = xClassificationParser->m_aIPParts; } bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, const OUString& rName) @@ -537,6 +554,16 @@ SfxClassificationHelper::SfxClassificationHelper(const uno::Reference<document:: SfxClassificationHelper::~SfxClassificationHelper() = default; +const std::vector<OUString> SfxClassificationHelper::GetMarkings() +{ + return m_pImpl->m_aMarkings; +} + +const std::vector<OUString> SfxClassificationHelper::GetIntellectualPropertyParts() +{ + return m_pImpl->m_aMarkings; +} + const OUString& SfxClassificationHelper::GetBACName(SfxClassificationPolicyType eType) { return m_pImpl->m_aCategory[eType].m_aName; |