|
|
2c83a8 |
From 4d4ddb1005eda2a9ecf49f23d973d784bf6460de Mon Sep 17 00:00:00 2001
|
|
|
2c83a8 |
From: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
2c83a8 |
Date: Tue, 22 Mar 2016 15:07:15 +0100
|
|
|
2c83a8 |
Subject: [PATCH] event config: add support for 'restricted access'
|
|
|
2c83a8 |
|
|
|
2c83a8 |
The xml event definition must hold the information about availability of
|
|
|
2c83a8 |
creating tickets with restricted access.
|
|
|
2c83a8 |
|
|
|
2c83a8 |
The tools like report-gtk and report-cli must use this information to:
|
|
|
2c83a8 |
- offer the users the possibility to open the report with restricted access
|
|
|
2c83a8 |
- tell the users whether the ticket will be private or not based on the
|
|
|
2c83a8 |
configuration of the event
|
|
|
2c83a8 |
|
|
|
2c83a8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
2c83a8 |
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
|
|
|
2c83a8 |
---
|
|
|
2c83a8 |
doc/report_event.conf.txt | 10 ++++
|
|
|
2c83a8 |
src/include/event_config.h | 7 +++
|
|
|
2c83a8 |
src/lib/event_config.c | 34 ++++++++++++
|
|
|
2c83a8 |
src/lib/event_xml_parser.c | 20 ++++++++
|
|
|
2c83a8 |
tests/Makefile.am | 3 +-
|
|
|
2c83a8 |
.../conf/event_implicit_no_support_restricted.xml | 13 +++++
|
|
|
2c83a8 |
tests/conf/event_no_support_restricted.xml | 15 ++++++
|
|
|
2c83a8 |
tests/conf/event_support_restricted_no_option.xml | 15 ++++++
|
|
|
2c83a8 |
.../conf/event_support_restricted_with_option.xml | 15 ++++++
|
|
|
2c83a8 |
tests/event_config.at | 60 ++++++++++++++++++++++
|
|
|
2c83a8 |
tests/testsuite.at | 1 +
|
|
|
2c83a8 |
tests/xml_definition.at | 51 ++++++++++++++++++
|
|
|
2c83a8 |
12 files changed, 243 insertions(+), 1 deletion(-)
|
|
|
2c83a8 |
create mode 100644 tests/conf/event_implicit_no_support_restricted.xml
|
|
|
2c83a8 |
create mode 100644 tests/conf/event_no_support_restricted.xml
|
|
|
2c83a8 |
create mode 100644 tests/conf/event_support_restricted_no_option.xml
|
|
|
2c83a8 |
create mode 100644 tests/conf/event_support_restricted_with_option.xml
|
|
|
2c83a8 |
create mode 100644 tests/event_config.at
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/doc/report_event.conf.txt b/doc/report_event.conf.txt
|
|
|
2c83a8 |
index 887c3e8..c7e736e 100644
|
|
|
2c83a8 |
--- a/doc/report_event.conf.txt
|
|
|
2c83a8 |
+++ b/doc/report_event.conf.txt
|
|
|
2c83a8 |
@@ -71,6 +71,8 @@ Each file has XML formatting with the following DTD:
|
|
|
2c83a8 |
|
|
|
2c83a8 |
|
|
|
2c83a8 |
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
|
|
|
2c83a8 |
|
|
|
2c83a8 |
|
|
|
2c83a8 |
@@ -117,6 +119,14 @@ gui-review-elements::
|
|
|
2c83a8 |
can be published. If "no", the event is executed automatically. If not
|
|
|
2c83a8 |
provided, "yes" is expected.
|
|
|
2c83a8 |
|
|
|
2c83a8 |
+support-restricted-access::
|
|
|
2c83a8 |
+ If "yes", the UI tools will offer the users to enter the new report with
|
|
|
2c83a8 |
+ restricted access. If "no", the UI tools will never offer the users to
|
|
|
2c83a8 |
+ enter the report with restricted access. "no" is the default value. The
|
|
|
2c83a8 |
+ element should have one argument named 'optionname' which defines name of
|
|
|
2c83a8 |
+ an option holding configuration of the restricted access feature. The
|
|
|
2c83a8 |
+ option must of 'bool' type.
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
advanced-options::
|
|
|
2c83a8 |
List of options which are hidden in the default view.
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/src/include/event_config.h b/src/include/event_config.h
|
|
|
2c83a8 |
index e2fcc23..7d137c1 100644
|
|
|
2c83a8 |
--- a/src/include/event_config.h
|
|
|
2c83a8 |
+++ b/src/include/event_config.h
|
|
|
2c83a8 |
@@ -80,6 +80,8 @@ typedef struct
|
|
|
2c83a8 |
long ec_minimal_rating;
|
|
|
2c83a8 |
bool ec_skip_review;
|
|
|
2c83a8 |
bool ec_sending_sensitive_data;
|
|
|
2c83a8 |
+ bool ec_supports_restricted_access;
|
|
|
2c83a8 |
+ char *ec_restricted_access_option;
|
|
|
2c83a8 |
|
|
|
2c83a8 |
GList *ec_imported_event_names;
|
|
|
2c83a8 |
GList *options;
|
|
|
2c83a8 |
@@ -98,6 +100,11 @@ const char *ec_get_long_desc(event_config_t *ec);
|
|
|
2c83a8 |
void ec_set_long_desc(event_config_t *ec, const char *long_desc);
|
|
|
2c83a8 |
bool ec_is_configurable(event_config_t* ec);
|
|
|
2c83a8 |
|
|
|
2c83a8 |
+/* Returns True if the event is configured to create ticket with restricted
|
|
|
2c83a8 |
+ * access.
|
|
|
2c83a8 |
+ */
|
|
|
2c83a8 |
+bool ec_restricted_access_enabled(event_config_t *ec);
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
void free_event_config(event_config_t *p);
|
|
|
2c83a8 |
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/src/lib/event_config.c b/src/lib/event_config.c
|
|
|
2c83a8 |
index 30b94d3..4155938 100644
|
|
|
2c83a8 |
--- a/src/lib/event_config.c
|
|
|
2c83a8 |
+++ b/src/lib/event_config.c
|
|
|
2c83a8 |
@@ -88,6 +88,39 @@ void ec_print(event_config_t *ec)
|
|
|
2c83a8 |
);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
|
|
|
2c83a8 |
+bool ec_restricted_access_enabled(event_config_t *ec)
|
|
|
2c83a8 |
+{
|
|
|
2c83a8 |
+ if (!ec->ec_supports_restricted_access)
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ if (ec->ec_restricted_access_option != NULL)
|
|
|
2c83a8 |
+ log_warning("Event '%s' does not support restricted access but has the option", ec_get_name(ec));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ return false;
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ if (ec->ec_restricted_access_option == NULL)
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ log_debug("Event '%s' supports restricted access but is missing the option", ec_get_name(ec));
|
|
|
2c83a8 |
+ return false;
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ event_option_t *eo = get_event_option_from_list(ec->ec_restricted_access_option, ec->options);
|
|
|
2c83a8 |
+ if (eo == NULL)
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ log_warning("Event '%s' supports restricted access but the option is not defined", ec_get_name(ec));
|
|
|
2c83a8 |
+ return false;
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ if (eo->eo_type != OPTION_TYPE_BOOL)
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ log_warning("Restricted option '%s' of Event '%s' is not of 'bool' type",
|
|
|
2c83a8 |
+ ec->ec_restricted_access_option, ec_get_name(ec));
|
|
|
2c83a8 |
+ return false;
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ return eo->eo_value != NULL && string_to_bool(eo->eo_value);
|
|
|
2c83a8 |
+}
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
void free_event_option(event_option_t *p)
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
if (!p)
|
|
|
2c83a8 |
@@ -112,6 +145,7 @@ void free_event_config(event_config_t *p)
|
|
|
2c83a8 |
free(p->ec_exclude_items_by_default);
|
|
|
2c83a8 |
free(p->ec_include_items_by_default);
|
|
|
2c83a8 |
free(p->ec_exclude_items_always);
|
|
|
2c83a8 |
+ free(p->ec_restricted_access_option);
|
|
|
2c83a8 |
g_list_free_full(p->ec_imported_event_names, free);
|
|
|
2c83a8 |
g_list_free_full(p->options, (GDestroyNotify)free_event_option);
|
|
|
2c83a8 |
|
|
|
2c83a8 |
diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c
|
|
|
2c83a8 |
index a15f1e1..a5e3d3e 100644
|
|
|
2c83a8 |
--- a/src/lib/event_xml_parser.c
|
|
|
2c83a8 |
+++ b/src/lib/event_xml_parser.c
|
|
|
2c83a8 |
@@ -33,6 +33,8 @@
|
|
|
2c83a8 |
#define MINIMAL_RATING_ELEMENT "minimal-rating"
|
|
|
2c83a8 |
#define GUI_REVIEW_ELEMENTS "gui-review-elements"
|
|
|
2c83a8 |
#define SENDING_SENSITIVE_DATA_ELEMENT "sending-sensitive-data"
|
|
|
2c83a8 |
+#define SUPPORTS_RESTRICTED_ACCESS_ELEMENT "support-restricted-access"
|
|
|
2c83a8 |
+#define RESTRICTED_ACCESS_OPTION_ATTR "optionname"
|
|
|
2c83a8 |
|
|
|
2c83a8 |
#define REQUIRES_ELEMENT "requires-items"
|
|
|
2c83a8 |
#define EXCL_BY_DEFAULT_ELEMENT "exclude-items-by-default"
|
|
|
2c83a8 |
@@ -234,6 +236,20 @@ static void start_element(GMarkupParseContext *context,
|
|
|
2c83a8 |
free(parse_data->attribute_lang);
|
|
|
2c83a8 |
parse_data->attribute_lang = get_element_lang(parse_data, attribute_names, attribute_values);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
+ else
|
|
|
2c83a8 |
+ if (strcmp(element_name, SUPPORTS_RESTRICTED_ACCESS_ELEMENT) == 0)
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ if (( attribute_names[0] != NULL
|
|
|
2c83a8 |
+ && strcmp(attribute_names[0], RESTRICTED_ACCESS_OPTION_ATTR) != 0)
|
|
|
2c83a8 |
+ || attribute_names[1] != NULL)
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ error_msg("XML event configuration error: '%s' element misses attribute '%s'",
|
|
|
2c83a8 |
+ SUPPORTS_RESTRICTED_ACCESS_ELEMENT, RESTRICTED_ACCESS_OPTION_ATTR);
|
|
|
2c83a8 |
+ return;
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ parse_data->event_config.values->ec_restricted_access_option = xstrdup(attribute_values[0]);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
|
|
|
2c83a8 |
// Called for close tags </foo>
|
|
|
2c83a8 |
@@ -489,6 +505,10 @@ static void text(GMarkupParseContext *context,
|
|
|
2c83a8 |
{
|
|
|
2c83a8 |
ui->ec_sending_sensitive_data = string_to_bool(text_copy);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
+ else if (strcmp(inner_element, SUPPORTS_RESTRICTED_ACCESS_ELEMENT) == 0)
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ ui->ec_supports_restricted_access = string_to_bool(text_copy);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
free(text_copy);
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
|
2c83a8 |
index 825a870..9aa3a07 100644
|
|
|
2c83a8 |
--- a/tests/Makefile.am
|
|
|
2c83a8 |
+++ b/tests/Makefile.am
|
|
|
2c83a8 |
@@ -46,7 +46,8 @@ TESTSUITE_AT = \
|
|
|
2c83a8 |
dump_dir.at \
|
|
|
2c83a8 |
global_config.at \
|
|
|
2c83a8 |
iso_date.at \
|
|
|
2c83a8 |
- uriparser.at
|
|
|
2c83a8 |
+ uriparser.at \
|
|
|
2c83a8 |
+ event_config.at
|
|
|
2c83a8 |
|
|
|
2c83a8 |
TESTSUITE_AT_IN = \
|
|
|
2c83a8 |
bugzilla_plugin.at
|
|
|
2c83a8 |
diff --git a/tests/conf/event_implicit_no_support_restricted.xml b/tests/conf/event_implicit_no_support_restricted.xml
|
|
|
2c83a8 |
new file mode 100644
|
|
|
2c83a8 |
index 0000000..eb37be8
|
|
|
2c83a8 |
--- /dev/null
|
|
|
2c83a8 |
+++ b/tests/conf/event_implicit_no_support_restricted.xml
|
|
|
2c83a8 |
@@ -0,0 +1,13 @@
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+<event>
|
|
|
2c83a8 |
+ <name>Bugzilla</name>
|
|
|
2c83a8 |
+ <description>Report to Bugzilla bug tracker</description>
|
|
|
2c83a8 |
+ <long-description>Report to Bugzilla bug tracker in long description</long-description>
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ <options>
|
|
|
2c83a8 |
+ <option type="text" name="Bugzilla_BugzillaURL">
|
|
|
2c83a8 |
+ <label>Bugzilla URL</label>
|
|
|
2c83a8 |
+ <note-html>Bugzilla HTML note</note-html>
|
|
|
2c83a8 |
+ </option>
|
|
|
2c83a8 |
+ </options>
|
|
|
2c83a8 |
+</event>
|
|
|
2c83a8 |
diff --git a/tests/conf/event_no_support_restricted.xml b/tests/conf/event_no_support_restricted.xml
|
|
|
2c83a8 |
new file mode 100644
|
|
|
2c83a8 |
index 0000000..b2c83b1
|
|
|
2c83a8 |
--- /dev/null
|
|
|
2c83a8 |
+++ b/tests/conf/event_no_support_restricted.xml
|
|
|
2c83a8 |
@@ -0,0 +1,15 @@
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+<event>
|
|
|
2c83a8 |
+ <name>Bugzilla</name>
|
|
|
2c83a8 |
+ <description>Report to Bugzilla bug tracker</description>
|
|
|
2c83a8 |
+ <long-description>Report to Bugzilla bug tracker in long description</long-description>
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ <support-restricted-access>no</support-restricted-access>
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ <options>
|
|
|
2c83a8 |
+ <option type="text" name="Bugzilla_BugzillaURL">
|
|
|
2c83a8 |
+ <label>Bugzilla URL</label>
|
|
|
2c83a8 |
+ <note-html>Bugzilla HTML note</note-html>
|
|
|
2c83a8 |
+ </option>
|
|
|
2c83a8 |
+ </options>
|
|
|
2c83a8 |
+</event>
|
|
|
2c83a8 |
diff --git a/tests/conf/event_support_restricted_no_option.xml b/tests/conf/event_support_restricted_no_option.xml
|
|
|
2c83a8 |
new file mode 100644
|
|
|
2c83a8 |
index 0000000..b70e64b
|
|
|
2c83a8 |
--- /dev/null
|
|
|
2c83a8 |
+++ b/tests/conf/event_support_restricted_no_option.xml
|
|
|
2c83a8 |
@@ -0,0 +1,15 @@
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+<event>
|
|
|
2c83a8 |
+ <name>Bugzilla</name>
|
|
|
2c83a8 |
+ <description>Report to Bugzilla bug tracker</description>
|
|
|
2c83a8 |
+ <long-description>Report to Bugzilla bug tracker in long description</long-description>
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ <support-restricted-access>yes</support-restricted-access>
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ <options>
|
|
|
2c83a8 |
+ <option type="text" name="Bugzilla_BugzillaURL">
|
|
|
2c83a8 |
+ <label>Bugzilla URL</label>
|
|
|
2c83a8 |
+ <note-html>Bugzilla HTML note</note-html>
|
|
|
2c83a8 |
+ </option>
|
|
|
2c83a8 |
+ </options>
|
|
|
2c83a8 |
+</event>
|
|
|
2c83a8 |
diff --git a/tests/conf/event_support_restricted_with_option.xml b/tests/conf/event_support_restricted_with_option.xml
|
|
|
2c83a8 |
new file mode 100644
|
|
|
2c83a8 |
index 0000000..ce5a1f9
|
|
|
2c83a8 |
--- /dev/null
|
|
|
2c83a8 |
+++ b/tests/conf/event_support_restricted_with_option.xml
|
|
|
2c83a8 |
@@ -0,0 +1,15 @@
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+<event>
|
|
|
2c83a8 |
+ <name>Bugzilla</name>
|
|
|
2c83a8 |
+ <description>Report to Bugzilla bug tracker</description>
|
|
|
2c83a8 |
+ <long-description>Report to Bugzilla bug tracker in long description</long-description>
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ <support-restricted-access optionname="Bugzilla_RestrictedAccess">yes</support-restricted-access>
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ <options>
|
|
|
2c83a8 |
+ <option type="bool" name="Bugzilla_RestrictedAccess">
|
|
|
2c83a8 |
+ <label>Bugzilla URL</label>
|
|
|
2c83a8 |
+ <default-value>no</default-value>
|
|
|
2c83a8 |
+ </option>
|
|
|
2c83a8 |
+ </options>
|
|
|
2c83a8 |
+</event>
|
|
|
2c83a8 |
diff --git a/tests/event_config.at b/tests/event_config.at
|
|
|
2c83a8 |
new file mode 100644
|
|
|
2c83a8 |
index 0000000..5baf000
|
|
|
2c83a8 |
--- /dev/null
|
|
|
2c83a8 |
+++ b/tests/event_config.at
|
|
|
2c83a8 |
@@ -0,0 +1,60 @@
|
|
|
2c83a8 |
+# -*- Autotest -*-
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+AT_BANNER([Event config])
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+## ----------------- ##
|
|
|
2c83a8 |
+## restricted_access ##
|
|
|
2c83a8 |
+## ----------------- ##
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+AT_TESTFUN([restricted_access],
|
|
|
2c83a8 |
+[[
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+#include "testsuite.h"
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+TS_MAIN
|
|
|
2c83a8 |
+{
|
|
|
2c83a8 |
+ event_config_t *ect = new_event_config("restricted_access");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ect->ec_supports_restricted_access);
|
|
|
2c83a8 |
+ TS_ASSERT_PTR_IS_NULL(ect->ec_restricted_access_option);
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ ect->ec_supports_restricted_access = true;
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_PTR_IS_NULL(ect->ec_restricted_access_option);
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ ect->ec_restricted_access_option = xstrdup("PrivateTicket");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ event_option_t *eot = new_event_option();
|
|
|
2c83a8 |
+ eot->eo_name = xstrdup("PrivateTicket");
|
|
|
2c83a8 |
+ eot->eo_value = NULL;
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ ect->options = g_list_prepend(ect->options, eot);
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ eot->eo_type = OPTION_TYPE_BOOL;
|
|
|
2c83a8 |
+ eot->eo_value = xstrdup("no");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ free(eot->eo_value);
|
|
|
2c83a8 |
+ eot->eo_value = xstrdup("yes");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_TRUE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ eot->eo_type = OPTION_TYPE_NUMBER;
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ ect->ec_supports_restricted_access = false;
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(ec_restricted_access_enabled(ect));
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ free_event_config(ect);
|
|
|
2c83a8 |
+}
|
|
|
2c83a8 |
+TS_RETURN_MAIN
|
|
|
2c83a8 |
+]])
|
|
|
2c83a8 |
diff --git a/tests/testsuite.at b/tests/testsuite.at
|
|
|
2c83a8 |
index c8269b1..392c3db 100644
|
|
|
2c83a8 |
--- a/tests/testsuite.at
|
|
|
2c83a8 |
+++ b/tests/testsuite.at
|
|
|
2c83a8 |
@@ -22,3 +22,4 @@ m4_include([global_config.at])
|
|
|
2c83a8 |
m4_include([iso_date.at])
|
|
|
2c83a8 |
m4_include([uriparser.at])
|
|
|
2c83a8 |
m4_include([bugzilla_plugin.at])
|
|
|
2c83a8 |
+m4_include([event_config.at])
|
|
|
2c83a8 |
diff --git a/tests/xml_definition.at b/tests/xml_definition.at
|
|
|
2c83a8 |
index 29043f8..7d2140f 100644
|
|
|
2c83a8 |
--- a/tests/xml_definition.at
|
|
|
2c83a8 |
+++ b/tests/xml_definition.at
|
|
|
2c83a8 |
@@ -137,3 +137,54 @@ int main(void)
|
|
|
2c83a8 |
return EXIT_SUCCESS;
|
|
|
2c83a8 |
}
|
|
|
2c83a8 |
]])
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+## ----------------- ##
|
|
|
2c83a8 |
+## restricted_access ##
|
|
|
2c83a8 |
+## ----------------- ##
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+AT_TESTFUN([restricted_access],
|
|
|
2c83a8 |
+[[
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+#include "testsuite.h"
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+TS_MAIN
|
|
|
2c83a8 |
+{
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ event_config_t *event_config = new_event_config("event_test_definition");
|
|
|
2c83a8 |
+ load_event_description_from_file(event_config, "../../conf/event_no_support_restricted.xml");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(event_config->ec_supports_restricted_access);
|
|
|
2c83a8 |
+ TS_ASSERT_PTR_IS_NULL(event_config->ec_restricted_access_option);
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ free_event_config(event_config);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ event_config_t *event_config = new_event_config("event_test_definition");
|
|
|
2c83a8 |
+ load_event_description_from_file(event_config, "../../conf/event_implicit_no_support_restricted.xml");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_FALSE(event_config->ec_supports_restricted_access);
|
|
|
2c83a8 |
+ TS_ASSERT_PTR_IS_NULL(event_config->ec_restricted_access_option);
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ free_event_config(event_config);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ event_config_t *event_config = new_event_config("event_test_definition");
|
|
|
2c83a8 |
+ load_event_description_from_file(event_config, "../../conf/event_support_restricted_no_option.xml");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_TRUE(event_config->ec_supports_restricted_access);
|
|
|
2c83a8 |
+ TS_ASSERT_PTR_IS_NULL(event_config->ec_restricted_access_option);
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ free_event_config(event_config);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+ {
|
|
|
2c83a8 |
+ event_config_t *event_config = new_event_config("event_test_definition");
|
|
|
2c83a8 |
+ load_event_description_from_file(event_config, "../../conf/event_support_restricted_with_option.xml");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ TS_ASSERT_TRUE(event_config->ec_supports_restricted_access);
|
|
|
2c83a8 |
+ TS_ASSERT_STRING_EQ(event_config->ec_restricted_access_option, "Bugzilla_RestrictedAccess", "Loaded from configuration");
|
|
|
2c83a8 |
+
|
|
|
2c83a8 |
+ free_event_config(event_config);
|
|
|
2c83a8 |
+ }
|
|
|
2c83a8 |
+}
|
|
|
2c83a8 |
+TS_RETURN_MAIN
|
|
|
2c83a8 |
+]])
|
|
|
2c83a8 |
--
|
|
|
2c83a8 |
1.8.3.1
|
|
|
2c83a8 |
|