diff options
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | docs/reference/gdata-docs.xml | 1 | ||||
-rw-r--r-- | docs/reference/gdata-sections.txt | 28 | ||||
-rw-r--r-- | gdata/gdata.h | 1 | ||||
-rw-r--r-- | gdata/gdata.symbols | 2 | ||||
-rw-r--r-- | gdata/services/calendar/gdata-calendar-access-rule.c | 322 | ||||
-rw-r--r-- | gdata/services/calendar/gdata-calendar-access-rule.h | 125 | ||||
-rw-r--r-- | gdata/services/calendar/gdata-calendar-calendar.c | 60 | ||||
-rw-r--r-- | gdata/services/calendar/gdata-calendar-calendar.h | 46 | ||||
-rw-r--r-- | gdata/tests/calendar.c | 51 | ||||
-rw-r--r-- | gdata/tests/traces/calendar/access-rule-get | 108 | ||||
-rw-r--r-- | gdata/tests/traces/calendar/global-authentication | 16 | ||||
-rw-r--r-- | gdata/tests/traces/calendar/setup-temp-calendar | 18 | ||||
-rw-r--r-- | gdata/tests/traces/calendar/setup-temp-calendar-acls | 94 |
14 files changed, 663 insertions, 214 deletions
diff --git a/Makefile.am b/Makefile.am index de9a099d..15ada4c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -268,7 +268,9 @@ gdatacalendarinclude_HEADERS = \ gdata/services/calendar/gdata-calendar-calendar.h \ gdata/services/calendar/gdata-calendar-event.h \ gdata/services/calendar/gdata-calendar-query.h \ - gdata/services/calendar/gdata-calendar-feed.h + gdata/services/calendar/gdata-calendar-feed.h \ + gdata/services/calendar/gdata-calendar-access-rule.h \ + $(NULL) gdatacontactsincludedir = $(gdataincludedir)/services/contacts gdatacontactsinclude_HEADERS = \ @@ -410,6 +412,7 @@ gdata_sources = \ gdata/services/calendar/gdata-calendar-event.c \ gdata/services/calendar/gdata-calendar-query.c \ gdata/services/calendar/gdata-calendar-feed.c \ + gdata/services/calendar/gdata-calendar-access-rule.c \ \ gdata/services/contacts/gdata-contacts-service.c \ gdata/services/contacts/gdata-contacts-contact.c \ diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml index 917e72a8..4f7ede08 100644 --- a/docs/reference/gdata-docs.xml +++ b/docs/reference/gdata-docs.xml @@ -141,6 +141,7 @@ <xi:include href="xml/gdata-calendar-query.xml"/> <xi:include href="xml/gdata-calendar-calendar.xml"/> <xi:include href="xml/gdata-calendar-event.xml"/> + <xi:include href="xml/gdata-calendar-access-rule.xml"/> </chapter> <chapter> diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt index 813b4ee2..92e68b2b 100644 --- a/docs/reference/gdata-sections.txt +++ b/docs/reference/gdata-sections.txt @@ -528,11 +528,6 @@ GDataCalendarQueryPrivate <SECTION> <FILE>gdata-calendar-calendar</FILE> <TITLE>GDataCalendarCalendar</TITLE> -GDATA_CALENDAR_ACCESS_ROLE_READ -GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY -GDATA_CALENDAR_ACCESS_ROLE_EDITOR -GDATA_CALENDAR_ACCESS_ROLE_OWNER -GDATA_CALENDAR_ACCESS_ROLE_ROOT GDataCalendarCalendar GDataCalendarCalendarClass gdata_calendar_calendar_new @@ -2815,3 +2810,26 @@ GDATA_TYPE_YOUTUBE_FEED <SUBSECTION Private> GDataYouTubeFeedPrivate </SECTION> + +<SECTION> +<FILE>gdata-calendar-access-rule</FILE> +<TITLE>GDataCalendarAccessRule</TITLE> +GDATA_CALENDAR_ACCESS_ROLE_READ +GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY +GDATA_CALENDAR_ACCESS_ROLE_EDITOR +GDATA_CALENDAR_ACCESS_ROLE_OWNER +GDATA_CALENDAR_ACCESS_ROLE_ROOT +GDataCalendarAccessRule +GDataCalendarAccessRuleClass +gdata_calendar_access_rule_new +<SUBSECTION Standard> +gdata_calendar_access_rule_get_type +GDATA_CALENDAR_ACCESS_RULE +GDATA_CALENDAR_ACCESS_RULE_CLASS +GDATA_CALENDAR_ACCESS_RULE_GET_CLASS +GDATA_IS_CALENDAR_ACCESS_RULE +GDATA_IS_CALENDAR_ACCESS_RULE_CLASS +GDATA_TYPE_CALENDAR_ACCESS_RULE +<SUBSECTION Private> +GDataCalendarAccessRulePrivate +</SECTION> diff --git a/gdata/gdata.h b/gdata/gdata.h index e74dd06c..f259b26f 100644 --- a/gdata/gdata.h +++ b/gdata/gdata.h @@ -107,6 +107,7 @@ #include <gdata/services/calendar/gdata-calendar-calendar.h> #include <gdata/services/calendar/gdata-calendar-event.h> #include <gdata/services/calendar/gdata-calendar-query.h> +#include <gdata/services/calendar/gdata-calendar-access-rule.h> /* Google PicasaWeb */ #include <gdata/services/picasaweb/gdata-picasaweb-service.h> diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols index ffb308bc..30c4a300 100644 --- a/gdata/gdata.symbols +++ b/gdata/gdata.symbols @@ -1114,3 +1114,5 @@ gdata_oauth2_authorizer_get_timeout gdata_oauth2_authorizer_set_timeout gdata_oauth2_authorizer_get_proxy_resolver gdata_oauth2_authorizer_set_proxy_resolver +gdata_calendar_access_rule_get_type +gdata_calendar_access_rule_new diff --git a/gdata/services/calendar/gdata-calendar-access-rule.c b/gdata/services/calendar/gdata-calendar-access-rule.c new file mode 100644 index 00000000..5e46f487 --- /dev/null +++ b/gdata/services/calendar/gdata-calendar-access-rule.c @@ -0,0 +1,322 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* + * GData Client + * Copyright (C) Philip Withnall 2015 <philip@tecnocode.co.uk> + * + * GData Client is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * GData Client is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GData Client. If not, see <http://www.gnu.org/licenses/>. + */ + +/** + * SECTION:gdata-calendar-access-rule + * @short_description: GData Calendar access rule object + * @stability: Stable + * @include: gdata/services/calendar/gdata-access-rule.h + * + * #GDataCalendarAccessRule is a subclass of #GDataAccessRule to represent a TODO generic access rule from an access control list (ACL). + * It is returned by the ACL methods implemented in the #GDataAccessHandler interface. + * + * Access rules should be inserted to the %GDATA_LINK_ACCESS_CONTROL_LIST URI of the feed or entry they should be applied to. This will return a + * %GDATA_SERVICE_ERROR_CONFLICT error if a rule already exists on that feed or entry for that scope type and value. + * + * TODO + * <example> + * <title>Adding a Rule to the Access Control List for an Entry</title> + * <programlisting> + * GDataService *service; + * GDataEntry *entry; + * GDataFeed *acl_feed; + * GDataAccessRule *rule, *new_rule; + * GError *error = NULL; + * + * /<!-- -->* Retrieve a GDataEntry which will have a new rule inserted into its ACL. *<!-- -->/ + * service = build_my_service (); + * entry = get_the_entry (service); + * + * /<!-- -->* Create and insert a new access rule for example@gmail.com which grants them _no_ permissions on the entry. + * * In a real application, the GDataEntry subclass would define its own access roles which are more useful. For example, + * * GDataDocumentsEntry defines access roles for users who can read (but not write) a Google Document, and users who + * * can also write to the document. *<!-- -->/ + * rule = gdata_access_rule_new (NULL); + * gdata_access_rule_set_role (rule, GDATA_ACCESS_ROLE_NONE); /<!-- -->* or, for example, GDATA_DOCUMENTS_ACCESS_ROLE_READER *<!-- -->/ + * gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "example@gmail.com"); /<!-- -->* e-mail address of the user the ACL applies to *<!-- -->/ + * + * acl_link = gdata_entry_look_up_link (entry, GDATA_LINK_ACCESS_CONTROL_LIST); + * new_rule = GDATA_ACCESS_RULE (gdata_service_insert_entry (GDATA_SERVICE (service), gdata_link_get_uri (acl_link), GDATA_ENTRY (rule), + * NULL, &error)); + * g_object_unref (acl_link); + * + * g_object_unref (rule); + * g_object_unref (entry); + * g_object_unref (service); + * + * if (error != NULL) { + * g_error ("Error inserting access rule: %s", error->message); + * g_error_free (error); + * return; + * } + * + * /<!-- -->* Potentially do something with the new_rule here, such as store its ID for later use. *<!-- -->/ + * + * g_object_unref (new_rule); + * </programlisting> + * </example> + * + * Since: UNRELEASED + */ + +#include <config.h> +#include <glib.h> +#include <glib/gi18n-lib.h> +#include <string.h> + +#include "gdata-access-rule.h" +#include "gdata-parser.h" +#include "gdata-types.h" +#include "gdata-private.h" +#include "gdata-calendar-access-rule.h" + +static gboolean +parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, + GError **error); +static gboolean +post_parse_json (GDataParsable *parsable, gpointer user_data, GError **error); +static void +get_json (GDataParsable *parsable, JsonBuilder *builder); +static const gchar * +get_content_type (void); + +G_DEFINE_TYPE (GDataCalendarAccessRule, gdata_calendar_access_rule, + GDATA_TYPE_ACCESS_RULE) + +static void +gdata_calendar_access_rule_class_init (GDataCalendarAccessRuleClass *klass) +{ + GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); + GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); + + parsable_class->parse_json = parse_json; + parsable_class->post_parse_json = post_parse_json; + parsable_class->get_json = get_json; + parsable_class->get_content_type = get_content_type; + + entry_class->kind_term = "calendar#aclRule"; + + /* TODO: Add a self link for deletions? */ +} + +static void +gdata_calendar_access_rule_init (GDataCalendarAccessRule *self) +{ + /* Nothing to do here. */ +} + +/* TODO: references */ +const struct { + const gchar *v3; + const gchar *v2; +} role_pairs[] = { + { "none", "none" }, + { "freeBusyReader", "http://schemas.google.com/gCal/2005#freebusy" }, + { "reader", "http://schemas.google.com/gCal/2005#read" }, + { "writer", "http://schemas.google.com/gCal/2005#editor" }, + { "owner", "http://schemas.google.com/gCal/2005#owner" }, +}; + +static const gchar * +role_v3_to_v2 (const gchar *v3_role) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (role_pairs); i++) { + if (g_strcmp0 (v3_role, role_pairs[i].v3) == 0) { + return role_pairs[i].v2; + } + } + + /* Fallback. */ + return v3_role; +} + +static const gchar * +role_v2_to_v3 (const gchar *v2_role) +{ + guint i; + + for (i = 0; i < G_N_ELEMENTS (role_pairs); i++) { + if (g_strcmp0 (v2_role, role_pairs[i].v2) == 0) { + return role_pairs[i].v3; + } + } + + /* Fallback. */ + return v2_role; +} + +static const gchar * +scope_type_v3_to_v2 (const gchar *v3_scope_type) +{ + /* Surprisingly, they have not changed from v2 to v3. */ + return v3_scope_type; +} + +static const gchar * +scope_type_v2_to_v3 (const gchar *v2_scope_type) +{ + /* Surprisingly, they have not changed from v2 to v3. */ + return v2_scope_type; +} + +static gboolean +parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error) +{ + gboolean success; + + if (g_strcmp0 (json_reader_get_member_name (reader), "role") == 0) { + gchar *role = NULL; /* owned */ + + g_assert (gdata_parser_string_from_json_member (reader, "role", + P_REQUIRED | + P_NON_EMPTY, + &role, &success, + error)); + + if (!success) { + return FALSE; + } + + gdata_access_rule_set_role (GDATA_ACCESS_RULE (parsable), + role_v3_to_v2 (role)); + g_free (role); + + return TRUE; + } else if (g_strcmp0 (json_reader_get_member_name (reader), + "scope") == 0) { + const gchar *scope_type; + const gchar *scope_value; + + /* Check this is an object. */ + if (!json_reader_is_object (reader)) { + return gdata_parser_error_required_json_content_missing (reader, + error); + } + + json_reader_read_member (reader, "type"); + scope_type = json_reader_get_string_value (reader); + json_reader_end_member (reader); + + json_reader_read_member (reader, "value"); + scope_value = json_reader_get_string_value (reader); + json_reader_end_member (reader); + + /* Scope type is required. */ + if (scope_type == NULL) { + return gdata_parser_error_required_json_content_missing (reader, + error); + } + + gdata_access_rule_set_scope (GDATA_ACCESS_RULE (parsable), + scope_type_v3_to_v2 (scope_type), + scope_value); + + return TRUE; + } + + return GDATA_PARSABLE_CLASS (gdata_calendar_access_rule_parent_class)->parse_json (parsable, reader, user_data, error); +} + +static gboolean +post_parse_json (GDataParsable *parsable, gpointer user_data, GError **error) +{ + /* Do _not_ chain up. */ + return TRUE; +} + +static void +get_json (GDataParsable *parsable, JsonBuilder *builder) +{ + GDataAccessRule *access_rule; + const gchar *id, *etag, *role, *scope_type, *scope_value; + + access_rule = GDATA_ACCESS_RULE (parsable); + + id = gdata_entry_get_id (GDATA_ENTRY (parsable)); + if (id != NULL) { + json_builder_set_member_name (builder, "id"); + json_builder_add_string_value (builder, id); + } + + json_builder_set_member_name (builder, "kind"); + json_builder_add_string_value (builder, "calendar#aclRule"); + + /* Add the ETag, if available. */ + etag = gdata_entry_get_etag (GDATA_ENTRY (parsable)); + if (etag != NULL) { + json_builder_set_member_name (builder, "etag"); + json_builder_add_string_value (builder, etag); + } + + role = gdata_access_rule_get_role (access_rule); + if (role != NULL) { + json_builder_set_member_name (builder, "role"); + json_builder_add_string_value (builder, role_v2_to_v3 (role)); + } + + gdata_access_rule_get_scope (access_rule, &scope_type, &scope_value); + if (scope_type != NULL || scope_value != NULL) { + json_builder_set_member_name (builder, "scope"); + json_builder_begin_object (builder); + + if (scope_type != NULL) { + json_builder_set_member_name (builder, "type"); + json_builder_add_string_value (builder, + scope_type_v2_to_v3 (scope_type)); + } + + if (scope_value != NULL) { + json_builder_set_member_name (builder, "value"); + json_builder_add_string_value (builder, scope_value); + } + + json_builder_end_object (builder); + } +} + +static const gchar * +get_content_type (void) +{ + return "application/json"; +} + +/** + * gdata_calendar_access_rule_new: + * @id: the access rule's ID, or %NULL + * + * Creates a new #GDataCalendarAccessRule with the given ID and default + * properties. + * + * Return value: (transfer full): a new #GDataCalendarAccessRule; unref with + * g_object_unref() + * + * Since: UNRELEASED + */ +GDataCalendarAccessRule * +gdata_calendar_access_rule_new (const gchar *id) +{ + GObject *retval = NULL; /* owned */ + + retval = g_object_new (GDATA_TYPE_CALENDAR_ACCESS_RULE, + "id", id, + NULL); + return GDATA_CALENDAR_ACCESS_RULE (retval); +} diff --git a/gdata/services/calendar/gdata-calendar-access-rule.h b/gdata/services/calendar/gdata-calendar-access-rule.h new file mode 100644 index 00000000..d1d202cb --- /dev/null +++ b/gdata/services/calendar/gdata-calendar-access-rule.h @@ -0,0 +1,125 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* + * GData Client + * Copyright (C) Philip Withnall 2015 <philip@tecnocode.co.uk> + * + * GData Client is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * GData Client is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GData Client. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GDATA_CALENDAR_ACCESS_RULE_H +#define GDATA_CALENDAR_ACCESS_RULE_H + +#include <glib.h> +#include <glib-object.h> + +#include <gdata/gdata-access-rule.h> + +G_BEGIN_DECLS + +/** + * GDATA_CALENDAR_ACCESS_ROLE_READ: + * + * The users specified by the #GDataCalendarAccessRule have read-only access to + * the calendar. + * + * Since: 0.7.0 + */ +#define GDATA_CALENDAR_ACCESS_ROLE_READ "http://schemas.google.com/gCal/2005#read" + +/** + * GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY: + * + * The users specified by the #GDataCalendarAccessRule can only see the + * free/busy information on the calendar; not event details. + * + * Since: 0.7.0 + */ +#define GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY "http://schemas.google.com/gCal/2005#freebusy" + +/** + * GDATA_CALENDAR_ACCESS_ROLE_EDITOR: + * + * The users specified by the #GDataCalendarAccessRule have full edit access to + * the calendar, except they can’t change the calendar’s access rules. + * + * Since: 0.7.0 + */ +#define GDATA_CALENDAR_ACCESS_ROLE_EDITOR "http://schemas.google.com/gCal/2005#editor" + +/** + * GDATA_CALENDAR_ACCESS_ROLE_OWNER: + * + * The users specified by the #GDataCalendarAccessRule have full owner access + * to the calendar. + * + * Since: 0.7.0 + */ +#define GDATA_CALENDAR_ACCESS_ROLE_OWNER "http://schemas.google.com/gCal/2005#owner" + +/** + * GDATA_CALENDAR_ACCESS_ROLE_ROOT: + * + * The users specified by the #GDataCalendarAccessRule have full administrator + * access to the calendar server. This is only available in Google Apps For + * Your Domain. + * + * Since: 0.7.0 + */ +#define GDATA_CALENDAR_ACCESS_ROLE_ROOT "http://schemas.google.com/gCal/2005#root" + +#define GDATA_TYPE_CALENDAR_ACCESS_RULE (gdata_calendar_access_rule_get_type ()) +#define GDATA_CALENDAR_ACCESS_RULE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_CALENDAR_ACCESS_RULE, GDataCalendarAccessRule)) +#define GDATA_CALENDAR_ACCESS_RULE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_CALENDAR_ACCESS_RULE, GDataCalendarAccessRuleClass)) +#define GDATA_IS_CALENDAR_ACCESS_RULE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_CALENDAR_ACCESS_RULE)) +#define GDATA_IS_CALENDAR_ACCESS_RULE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_CALENDAR_ACCESS_RULE)) +#define GDATA_CALENDAR_ACCESS_RULE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_CALENDAR_ACCESS_RULE, GDataCalendarAccessRuleClass)) + +/** + * GDataCalendarAccessRule: + * + * All the fields in the #GDataCalendarAccessRule structure are private and + * should never be accessed directly. + * + * Since: UNRELEASED + */ +typedef struct { + GDataAccessRule parent; +} GDataCalendarAccessRule; + +/** + * GDataCalendarAccessRuleClass: + * + * All the fields in the #GDataCalendarAccessRuleClass structure are private + * and should never be accessed directly. + * + * Since: UNRELEASED + */ +typedef struct { + /*< private >*/ + GDataAccessRuleClass parent; + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved0) (void); + void (*_g_reserved1) (void); +} GDataCalendarAccessRuleClass; + +GType gdata_calendar_access_rule_get_type (void) G_GNUC_CONST; + +GDataCalendarAccessRule * +gdata_calendar_access_rule_new (const gchar *id) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC; + +G_END_DECLS + +#endif /* !GDATA_CALENDAR_ACCESS_RULE_H */ diff --git a/gdata/services/calendar/gdata-calendar-calendar.c b/gdata/services/calendar/gdata-calendar-calendar.c index 9d7204b3..31cc922d 100644 --- a/gdata/services/calendar/gdata-calendar-calendar.c +++ b/gdata/services/calendar/gdata-calendar-calendar.c @@ -86,6 +86,7 @@ #include "gdata-types.h" #include "gdata-access-handler.h" #include "gdata-calendar-service.h" +#include "gdata-calendar-access-rule.h" static void gdata_calendar_calendar_access_handler_init (GDataAccessHandlerIface *iface); static void gdata_calendar_calendar_finalize (GObject *object); @@ -252,11 +253,56 @@ get_authorization_domain (GDataAccessHandler *self) return gdata_calendar_service_get_primary_authorization_domain (); } +static GDataFeed * +get_rules (GDataAccessHandler *self, + GDataService *service, + GCancellable *cancellable, + GDataQueryProgressCallback progress_callback, + gpointer progress_user_data, + GError **error) +{ + GDataAccessHandlerIface *iface; + GDataAuthorizationDomain *domain = NULL; + GDataFeed *feed; + GDataLink *_link; + SoupMessage *message; + + _link = gdata_entry_look_up_link (GDATA_ENTRY (self), + GDATA_LINK_ACCESS_CONTROL_LIST); + g_assert (_link != NULL); + + iface = GDATA_ACCESS_HANDLER_GET_IFACE (self); + if (iface->get_authorization_domain != NULL) { + domain = iface->get_authorization_domain (self); + } + + message = _gdata_service_query (service, domain, + gdata_link_get_uri (_link), NULL, + cancellable, error); + if (message == NULL) { + return NULL; + } + + g_assert (message->response_body->data != NULL); + + feed = _gdata_feed_new_from_json (GDATA_TYPE_FEED, + message->response_body->data, + message->response_body->length, + GDATA_TYPE_CALENDAR_ACCESS_RULE, + progress_callback, progress_user_data, + error); + + g_object_unref (message); + + return feed; +} + static void gdata_calendar_calendar_access_handler_init (GDataAccessHandlerIface *iface) { iface->is_owner_rule = is_owner_rule; iface->get_authorization_domain = get_authorization_domain; + iface->get_rules = get_rules; } static void @@ -443,15 +489,25 @@ parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GEr const gchar *id; gchar *uri; - /* Calendar entries don’t contain their own selfLink, so we have - * to add one manually. */ id = json_reader_get_string_value (reader); if (id != NULL && *id != '\0') { + /* Calendar entries don’t contain their own selfLink, + * so we have to add one manually. */ uri = g_strconcat ("https://www.googleapis.com/calendar/v3/calendars/", id, NULL); _link = gdata_link_new (uri, GDATA_LINK_SELF); gdata_entry_add_link (GDATA_ENTRY (parsable), _link); g_object_unref (_link); g_free (uri); + + /* Similarly for the ACL link. */ + uri = g_strconcat ("https://www.googleapis.com" + "/calendar/v3/calendars/", id, + "/acl", NULL); + _link = gdata_link_new (uri, + GDATA_LINK_ACCESS_CONTROL_LIST); + gdata_entry_add_link (GDATA_ENTRY (parsable), _link); + g_object_unref (_link); + g_free (uri); } return GDATA_PARSABLE_CLASS (gdata_calendar_calendar_parent_class)->parse_json (parsable, reader, user_data, error); diff --git a/gdata/services/calendar/gdata-calendar-calendar.h b/gdata/services/calendar/gdata-calendar-calendar.h index 37a368ff..01106e2d 100644 --- a/gdata/services/calendar/gdata-calendar-calendar.h +++ b/gdata/services/calendar/gdata-calendar-calendar.h @@ -28,52 +28,6 @@ G_BEGIN_DECLS -/** - * GDATA_CALENDAR_ACCESS_ROLE_READ: - * - * The users specified by the #GDataAccessRule have read-only access to the calendar. - * - * Since: 0.7.0 - **/ -#define GDATA_CALENDAR_ACCESS_ROLE_READ "http://schemas.google.com/gCal/2005#read" - -/** - * GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY: - * - * The users specified by the #GDataAccessRule can only see the free/busy information on the calendar; not event details. - * - * Since: 0.7.0 - **/ -#define GDATA_CALENDAR_ACCESS_ROLE_FREE_BUSY "http://schemas.google.com/gCal/2005#freebusy" - -/** - * GDATA_CALENDAR_ACCESS_ROLE_EDITOR: - * - * The users specified by the #GDataAccessRule have full edit access to the calendar, except they can't change the calendar's access rules. - * - * Since: 0.7.0 - **/ -#define GDATA_CALENDAR_ACCESS_ROLE_EDITOR "http://schemas.google.com/gCal/2005#editor" - -/** - * GDATA_CALENDAR_ACCESS_ROLE_OWNER: - * - * The users specified by the #GDataAccessRule have full owner access to the calendar. - * - * Since: 0.7.0 - **/ -#define GDATA_CALENDAR_ACCESS_ROLE_OWNER "http://schemas.google.com/gCal/2005#owner" - -/** - * GDATA_CALENDAR_ACCESS_ROLE_ROOT: - * - * The users specified by the #GDataAccessRule have full administrator access to the calendar server. - * This is only available in Google Apps For Your Domain. - * - * Since: 0.7.0 - **/ -#define GDATA_CALENDAR_ACCESS_ROLE_ROOT "http://schemas.google.com/gCal/2005#root" - #define GDATA_TYPE_CALENDAR_CALENDAR (gdata_calendar_calendar_get_type ()) #define GDATA_CALENDAR_CALENDAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_CALENDAR_CALENDAR, GDataCalendarCalendar)) #define GDATA_CALENDAR_CALENDAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_CALENDAR_CALENDAR, GDataCalendarCalendarClass)) diff --git a/gdata/tests/calendar.c b/gdata/tests/calendar.c index 892c4aaf..e2de99f9 100644 --- a/gdata/tests/calendar.c +++ b/gdata/tests/calendar.c @@ -938,7 +938,7 @@ test_access_rule_properties (void) GDataAccessRule *rule; const gchar *scope_type, *scope_value; - rule = gdata_access_rule_new (NULL); + rule = gdata_calendar_access_rule_new (NULL); gdata_access_rule_set_role (rule, GDATA_CALENDAR_ACCESS_ROLE_EDITOR); g_assert_cmpstr (gdata_access_rule_get_role (rule), ==, GDATA_CALENDAR_ACCESS_ROLE_EDITOR); @@ -954,22 +954,20 @@ test_access_rule_json (void) { GDataAccessRule *rule; - rule = gdata_access_rule_new (NULL); + rule = gdata_calendar_access_rule_new (NULL); gdata_access_rule_set_role (rule, GDATA_CALENDAR_ACCESS_ROLE_EDITOR); gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "darcy@gmail.com"); /* Check the JSON */ - gdata_test_assert_json (rule, - "<?xml version='1.0' encoding='UTF-8'?>" - "<entry xmlns='http://www.w3.org/2005/Atom' " - "xmlns:gd='http://schemas.google.com/g/2005' " - "xmlns:gAcl='http://schemas.google.com/acl/2007'>" - "<title type='text'>http://schemas.google.com/gCal/2005#editor</title>" - "<category term='http://schemas.google.com/acl/2007#accessRule' scheme='http://schemas.google.com/g/2005#kind'/>" - "<gAcl:role value='http://schemas.google.com/gCal/2005#editor'/>" - "<gAcl:scope type='user' value='darcy@gmail.com'/>" - "</entry>"); + gdata_test_assert_json (rule, "{" + "'kind': 'calendar#aclRule'," + "'role': 'writer'," + "'scope': {" + "'type': 'user'," + "'value': 'darcy@gmail.com'" + "}" + "}"); } static void @@ -1088,6 +1086,7 @@ set_up_temp_calendar_acls (TempCalendarAclsData *data, gconstpointer service) { GDataAccessRule *rule; GDataLink *_link; + GError *error = NULL; /* Set up a calendar */ set_up_temp_calendar ((TempCalendarData*) data, service); @@ -1095,7 +1094,7 @@ set_up_temp_calendar_acls (TempCalendarAclsData *data, gconstpointer service) gdata_test_mock_server_start_trace (mock_server, "setup-temp-calendar-acls"); /* Add an access rule to the calendar */ - rule = gdata_access_rule_new (NULL); + rule = gdata_calendar_access_rule_new (NULL); gdata_access_rule_set_role (rule, GDATA_CALENDAR_ACCESS_ROLE_EDITOR); gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "darcy@gmail.com"); @@ -1106,8 +1105,10 @@ set_up_temp_calendar_acls (TempCalendarAclsData *data, gconstpointer service) data->rule = GDATA_ACCESS_RULE (gdata_service_insert_entry (GDATA_SERVICE (service), gdata_calendar_service_get_primary_authorization_domain (), - gdata_link_get_uri (_link), GDATA_ENTRY (rule), NULL, NULL)); - g_assert (GDATA_IS_ACCESS_RULE (data->rule)); + gdata_link_get_uri (_link), GDATA_ENTRY (rule), NULL, + &error)); + g_assert_no_error (error); + g_assert (GDATA_IS_CALENDAR_ACCESS_RULE (data->rule)); g_object_unref (rule); @@ -1173,7 +1174,7 @@ test_access_rule_insert (TempCalendarAclsData *data, gconstpointer service) gdata_test_mock_server_start_trace (mock_server, "access-rule-insert"); - rule = gdata_access_rule_new (NULL); + rule = gdata_calendar_access_rule_new (NULL); gdata_access_rule_set_role (rule, GDATA_CALENDAR_ACCESS_ROLE_EDITOR); gdata_access_rule_set_scope (rule, GDATA_ACCESS_SCOPE_USER, "darcy@gmail.com"); @@ -1367,7 +1368,8 @@ main (int argc, char *argv[]) authorizer = create_global_authorizer (); service = GDATA_SERVICE (gdata_calendar_service_new (authorizer)); - +#if 0 +TODO g_test_add_func ("/calendar/authentication", test_authentication); g_test_add ("/calendar/query/all_calendars", QueryCalendarsData, service, set_up_query_calendars, test_query_all_calendars, @@ -1401,9 +1403,7 @@ main (int argc, char *argv[]) tear_down_insert_event_async); g_test_add ("/calendar/event/insert/async/cancellation", GDataAsyncTestData, service, set_up_insert_event_async, test_event_insert_async_cancellation, tear_down_insert_event_async); - -#if 0 -TODO +#endif g_test_add ("/calendar/access-rule/get", TempCalendarAclsData, service, set_up_temp_calendar_acls, test_access_rule_get, tear_down_temp_calendar_acls); g_test_add ("/calendar/access-rule/insert", TempCalendarAclsData, service, set_up_temp_calendar_acls_no_insertion, @@ -1412,8 +1412,9 @@ TODO tear_down_temp_calendar_acls); g_test_add ("/calendar/access-rule/delete", TempCalendarAclsData, service, set_up_temp_calendar_acls, test_access_rule_delete, tear_down_temp_calendar_acls); -#endif +#if 0 +TODO g_test_add_func ("/calendar/event/json", test_event_json); g_test_add_func ("/calendar/event/json/dates", test_event_json_dates); g_test_add_func ("/calendar/event/json/recurrence", test_event_json_recurrence); @@ -1422,15 +1423,15 @@ TODO test_calendar_event_parser_minimal); g_test_add_func ("/calendar/calendar/escaping", test_calendar_escaping); - -#if 0 -TODO +#endif g_test_add_func ("/calendar/access-rule/properties", test_access_rule_properties); g_test_add_func ("/calendar/access-rule/json", test_access_rule_json); -#endif +#if 0 +TODO g_test_add_func ("/calendar/query/uri", test_query_uri); g_test_add_func ("/calendar/query/etag", test_query_etag); +#endif retval = g_test_run (); diff --git a/gdata/tests/traces/calendar/access-rule-get b/gdata/tests/traces/calendar/access-rule-get index 990a4f2c..aff0317a 100644 --- a/gdata/tests/traces/calendar/access-rule-get +++ b/gdata/tests/traces/calendar/access-rule-get @@ -1,67 +1,65 @@ -> GET /calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full HTTP/1.1 -> Soup-Debug-Timestamp: 1375202815 -> Soup-Debug: SoupSession 1 (0x65a2e0), SoupMessage 107 (0x7fffe003f550), SoupSocket 99 (0x7750d0) -> Host: www.google.com -> Authorization: GoogleLogin auth=DQAAANUAAACtQA4YYe986jGVKTRKjvf_LQKCUZ-IrhGFxQuS1Zfjc3yd5y6Y5AHV3CUuKKT-NheGlvH_Hh7TOXLccehoG2zbN5TDNxZ-TDfe29rhXBteyCMVj5DvD7eNA2g8k8tM1sbnqitPfsPs-kbfR6iXisr9Yp_3Vt3LqvpmmxJI6AKoXpC08YhV24rZiqJZMMHhxxFr_TeYYtgiPL9vOqjnfhJJI6rGgNQ6eYvVaKo7TzLgbhWkg6Sikn3hbkowxi8_rA9_Bvwwxs77T15OWlsObAigagTJyjsQoAUGISPhESplZQ -> GData-Version: 2 -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive - -< HTTP/1.1 302 Moved Temporarily -< Soup-Debug-Timestamp: 1375202815 -< Soup-Debug: SoupMessage 107 (0x7fffe003f550) -< Update-Client-Auth: DQAAANYAAACtQA4YYe986jGVKTRKjvf_lzf1dm9Ue8N3SJp2J6o695WrE5nMbNLIXgO1GwYSOH0dinvA7V6dAhAIAEim2gLMsmbC2ddMnDUzaVKIGr3_JWCh97kMTIAR1M2IeSsu02b7EZA-X4HjICLw-x5pMnXhR8i08nLbVHSLT_No8fvB518lPWszfELKmW9TYG0-BAxXFzn9IKi_SmDnEv70WeTVk9AKBXEZK8GgbVvG2jwg9IxQwwSgxxH2Am-wKlw1Xh28Ocyi9bXsxw2zvbHLluu_emFBzQJ8Ds6aIurEQIryfg -< Set-Cookie: DO_NOT_CACHE_RESPONSE=true;Expires=Tue, 30-Jul-2013 16:46:57 GMT -< Set-Cookie: S=calendar=G_6kLMPUbpzgPxnXiSrtUw;Expires=Mon, 12-Aug-2013 11:38:22 GMT;Secure -< Expires: Tue, 30 Jul 2013 16:46:56 GMT -< Date: Tue, 30 Jul 2013 16:46:56 GMT -< Location: https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full?gsessionid=G_6kLMPUbpzgPxnXiSrtUw -< Content-Type: text/html; charset=UTF-8 -< Cache-control: private, max-age=0 -< X-Content-Type-Options: nosniff -< X-Frame-Options: SAMEORIGIN -< X-XSS-Protection: 1; mode=block -< Server: GSE -< Transfer-Encoding: chunked -< -< <HTML> -< <HEAD> -< <TITLE>Moved Temporarily</TITLE> -< </HEAD> -< <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> -< <H1>Moved Temporarily</H1> -< The document has moved <A HREF="https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full?gsessionid=G_6kLMPUbpzgPxnXiSrtUw">here</A>. -< </BODY> -< </HTML> - -> GET /calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full?gsessionid=G_6kLMPUbpzgPxnXiSrtUw HTTP/1.1 -> Soup-Debug-Timestamp: 1375202815 -> Soup-Debug: SoupSession 1 (0x65a2e0), SoupMessage 107 (0x7fffe003f550), SoupSocket 99 (0x7750d0), restarted -> Host: www.google.com -> Authorization: GoogleLogin auth=DQAAANUAAACtQA4YYe986jGVKTRKjvf_LQKCUZ-IrhGFxQuS1Zfjc3yd5y6Y5AHV3CUuKKT-NheGlvH_Hh7TOXLccehoG2zbN5TDNxZ-TDfe29rhXBteyCMVj5DvD7eNA2g8k8tM1sbnqitPfsPs-kbfR6iXisr9Yp_3Vt3LqvpmmxJI6AKoXpC08YhV24rZiqJZMMHhxxFr_TeYYtgiPL9vOqjnfhJJI6rGgNQ6eYvVaKo7TzLgbhWkg6Sikn3hbkowxi8_rA9_Bvwwxs77T15OWlsObAigagTJyjsQoAUGISPhESplZQ +> GET /calendar/v3/calendars/639ohpeq637el4v0ct3gdcms54@group.calendar.google.com/acl HTTP/1.1 +> Soup-Debug-Timestamp: 1431695659 +> Soup-Debug: SoupSession 1 (0x1562260), SoupMessage 3 (0x17ebc70), SoupSocket 2 (0x7efddc003780) +> Host: www.googleapis.com +> Authorization: Bearer ya29.dAFjwh3j5bnolAkoumk7nKv5Et2BPEF4uLxyUsDhp788Hs7E6P4W865ZrKn7PAcfe4X40GjC0xx3Wg > GData-Version: 2 > Accept-Encoding: gzip, deflate +> User-Agent: libgdata/0.17.2 - gzip > Connection: Keep-Alive < HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1375202816 -< Soup-Debug: SoupMessage 107 (0x7fffe003f550) -< Update-Client-Auth: DQAAANYAAACtQA4YYe986jGVKTRKjvf_q4NwI2V8UT-SSEMjiblkY8jTSCIGQJCo_ZFavemirrG0G2jzg3jjEVC3CQauPSZoNTFtDCw6Eu1-1S6nOyDK2J9zwLcpKLPHGuWk8fzL5JjKgN0Z0HbdhVtGaldMU2XCoc4_I0dsAZNFNzMl12pQ2IhlOpKYk_syrjXgbEIFWB07e6wSu6Mp1XswtWQL95nokCfWJkTHf4YGsR2zpy2736UplfLIVHDJLz7fiJzKG-5nUmoz2a5jdwopbkQ6flW44tTL7okPm_2Y6nqlPi74Mg -< Set-Cookie: DO_NOT_CACHE_RESPONSE=true;Expires=Tue, 30-Jul-2013 16:46:57 GMT -< Set-Cookie: S=calendar=GSG2J1yGIV1MRxedFUw0tg;Expires=Thu, 08-Aug-2013 23:52:29 GMT;Secure -< Expires: Tue, 30 Jul 2013 16:46:56 GMT -< Date: Tue, 30 Jul 2013 16:46:56 GMT -< Content-Type: application/atom+xml; charset=UTF-8; type=feed -< Cache-control: private, max-age=0, must-revalidate, no-transform -< Vary: Accept, X-GData-Authorization, GData-Version -< GData-Version: 2.6 -< ETag: W/"CE8FRH47eCp7JGA9WhFWEk0." -< Last-Modified: Tue, 30 Jul 2013 16:46:55 GMT +< Soup-Debug-Timestamp: 1431695659 +< Soup-Debug: SoupMessage 3 (0x17ebc70) +< Expires: Fri, 15 May 2015 13:14:19 GMT +< Date: Fri, 15 May 2015 13:14:19 GMT +< Cache-Control: private, max-age=0, must-revalidate, no-transform +< Vary: Origin +< Vary: X-Origin +< Content-Type: application/json; charset=UTF-8 +< Content-Encoding: gzip < X-Content-Type-Options: nosniff < X-Frame-Options: SAMEORIGIN < X-XSS-Protection: 1; mode=block < Server: GSE +< Alternate-Protocol: 443:quic,p=1 < Transfer-Encoding: chunked < -< <?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:app='http://www.w3.org/2007/app' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gd='http://schemas.google.com/g/2005' xmlns:gAcl='http://schemas.google.com/acl/2007' gd:etag='W/"CE8FRH47eCp7JGA9WhFWEk0."' gd:kind='calendar#aclFeed'><id>http://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full</id><updated>2013-07-30T16:46:55.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/><title>Temp Test Calendar's access control list</title><link rel='http://schemas.google.com/acl/2007#controlledObject' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/private/full'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full'/><link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full'/><link rel='self' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full'/><generator version='1.0' uri='http://www.google.com/calendar'>Google Calendar</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><entry gd:etag='W/"CE8FRH47eCp7JGA9WhFWEk0."' gd:kind='calendar#acl'><id>http://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/user%3Adarcy%40gmail.com</id><updated>2013-07-30T16:46:55.000Z</updated><app:edited>2013-07-30T16:46:55.000Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/><title>editor</title><content/><link rel='self' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Adarcy%40gmail.com'/><link rel='edit' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Adarcy%40gmail.com'/><author><name>Temp Test Calendar</name><email>i4jqlr6fcg9obf3qucemmcm1m0@group.calendar.google.com</email></author><gAcl:role value='http://schemas.google.com/gCal/2005#editor'/><gAcl:scope type='user' value='darcy@gmail.com'/></entry><entry gd:etag='W/"CE8FRH47eCp7JGA9WhFWEk0."' gd:kind='calendar#acl'><id>http://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/user%3Alibgdata.test%40googlemail.com</id><updated>2013-07-30T16:46:55.000Z</updated><app:edited>2013-07-30T16:46:55.000Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/><title>owner</title><content/><link rel='self' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Alibgdata.test%40googlemail.com'/><link rel='edit' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Alibgdata.test%40googlemail.com'/><author><name>Temp Test Calendar</name><email>i4jqlr6fcg9obf3qucemmcm1m0@group.calendar.google.com</email></author><gAcl:role value='http://schemas.google.com/gCal/2005#owner'/><gAcl:scope type='user' value='libgdata.test@googlemail.com'/></entry><entry gd:etag='W/"CE8FRH47eCp7JGA9WhFWEk0."' gd:kind='calendar#acl'><id>http://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/user%3Ai4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com</id><updated>2013-07-30T16:46:55.000Z</updated><app:edited>2013-07-30T16:46:55.000Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/><title>owner</title><content/><link rel='self' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Ai4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com'/><link rel='edit' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Ai4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com'/><author><name>Temp Test Calendar</name><email>i4jqlr6fcg9obf3qucemmcm1m0@group.calendar.google.com</email></author><gAcl:role value='http://schemas.google.com/gCal/2005#owner'/><gAcl:scope type='user' value='i4jqlr6fcg9obf3qucemmcm1m0@group.calendar.google.com'/></entry></feed> +< { +< "kind": "calendar#acl", +< "etag": "\"1431695659021000\"", +< "nextSyncToken": "00001431695659021000", +< "items": [ +< { +< "kind": "calendar#aclRule", +< "etag": "\"00001431695659021000\"", +< "id": "user:darcy@gmail.com", +< "scope": { +< "type": "user", +< "value": "darcy@gmail.com" +< }, +< "role": "writer" +< }, +< { +< "kind": "calendar#aclRule", +< "etag": "\"00001431695656063000\"", +< "id": "user:libgdata.test@googlemail.com", +< "scope": { +< "type": "user", +< "value": "libgdata.test@googlemail.com" +< }, +< "role": "owner" +< }, +< { +< "kind": "calendar#aclRule", +< "etag": "\"00000000000000000000\"", +< "id": "user:639ohpeq637el4v0ct3gdcms54@group.calendar.google.com", +< "scope": { +< "type": "user", +< "value": "639ohpeq637el4v0ct3gdcms54@group.calendar.google.com" +< }, +< "role": "owner" +< } +< ] +< } diff --git a/gdata/tests/traces/calendar/global-authentication b/gdata/tests/traces/calendar/global-authentication index be4dd660..a2e0683e 100644 --- a/gdata/tests/traces/calendar/global-authentication +++ b/gdata/tests/traces/calendar/global-authentication @@ -1,22 +1,22 @@ > POST /o/oauth2/token HTTP/1.1 -> Soup-Debug-Timestamp: 1430949580 -> Soup-Debug: SoupSession 1 (0xc32110), SoupMessage 1 (0xffb8b0), SoupSocket 1 (0x7fe1540036b0) +> Soup-Debug-Timestamp: 1431695653 +> Soup-Debug: SoupSession 1 (0x1562130), SoupMessage 1 (0x17eb8b0), SoupSocket 1 (0x7efddc0036b0) > Host: accounts.google.com > Content-Type: application/x-www-form-urlencoded > Accept-Encoding: gzip, deflate > User-Agent: libgdata/0.17.2 - gzip > Connection: Keep-Alive > -> client_id=352818697630-nqu2cmt5quqd6lr17ouoqmb684u84l1f.apps.googleusercontent.com&client_secret=-fA4pHQJxR3zJ-FyAMPQsikg&code=4%2FB4IYd9knVDIDdLZdrhuCBbjmotzgYNLb1QqstmPrxbA.UuDy7Em42q8doiIBeO6P2m8efXtWmgI&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&grant_type=authorization_code +> client_id=352818697630-nqu2cmt5quqd6lr17ouoqmb684u84l1f.apps.googleusercontent.com&client_secret=-fA4pHQJxR3zJ-FyAMPQsikg&code=4%2FTrFY0VbJzBRhT4r_kkyl39xFF15qserv8dER-e182eU.AjD_rrH7m_EUoiIBeO6P2m9a02uvmgI&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&grant_type=authorization_code < HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1430949580 -< Soup-Debug: SoupMessage 1 (0xffb8b0) +< Soup-Debug-Timestamp: 1431695654 +< Soup-Debug: SoupMessage 1 (0x17eb8b0) < Content-Type: application/json; charset=utf-8 < Cache-Control: no-cache, no-store, max-age=0, must-revalidate < Pragma: no-cache < Expires: Fri, 01 Jan 1990 00:00:00 GMT -< Date: Wed, 06 May 2015 21:59:40 GMT +< Date: Fri, 15 May 2015 13:14:14 GMT < Content-Disposition: attachment; filename="json.txt"; filename*=UTF-8''json.txt < Content-Encoding: gzip < X-Content-Type-Options: nosniff @@ -27,9 +27,9 @@ < Transfer-Encoding: chunked < < { -< "access_token" : "ya29.awGy-MEL7oZEh875MiCaHZKx6KNZcPN1FIFpJB2r_OlDKat0j_JfenP1BZb1Skk2cO5F6VaQkUo7wg", +< "access_token" : "ya29.dAFjwh3j5bnolAkoumk7nKv5Et2BPEF4uLxyUsDhp788Hs7E6P4W865ZrKn7PAcfe4X40GjC0xx3Wg", < "token_type" : "Bearer", < "expires_in" : 3600, -< "refresh_token" : "1/WCwwRyT6fkH315Vd62L8HwTu67pjEG0DJ5H4xGlr8bQMEudVrK5jSpoR30zcRFq6" +< "refresh_token" : "1/NnqQoUbp8ZRdraXhZV_VxmYC72GtHl65vwf1h6OZ8ik" < } diff --git a/gdata/tests/traces/calendar/setup-temp-calendar b/gdata/tests/traces/calendar/setup-temp-calendar index 5a210210..1a8692bc 100644 --- a/gdata/tests/traces/calendar/setup-temp-calendar +++ b/gdata/tests/traces/calendar/setup-temp-calendar @@ -1,8 +1,8 @@ > POST /calendar/v3/calendars HTTP/1.1 -> Soup-Debug-Timestamp: 1430949585 -> Soup-Debug: SoupSession 1 (0xc32240), SoupMessage 5 (0xffba90), SoupSocket 3 (0xbf11a0) +> Soup-Debug-Timestamp: 1431695654 +> Soup-Debug: SoupSession 1 (0x1562260), SoupMessage 1 (0x17eba90), SoupSocket 1 (0x15319e0) > Host: www.googleapis.com -> Authorization: Bearer ya29.awGy-MEL7oZEh875MiCaHZKx6KNZcPN1FIFpJB2r_OlDKat0j_JfenP1BZb1Skk2cO5F6VaQkUo7wg +> Authorization: Bearer ya29.dAFjwh3j5bnolAkoumk7nKv5Et2BPEF4uLxyUsDhp788Hs7E6P4W865ZrKn7PAcfe4X40GjC0xx3Wg > GData-Version: 2 > Content-Type: application/json > Accept-Encoding: gzip, deflate @@ -12,13 +12,13 @@ > {"kind":"calendar#calendar","summary":"Temp Test Calendar","hidden":false,"backgroundColor":"#7a367a","selected":false} < HTTP/1.1 200 OK -< Soup-Debug-Timestamp: 1430949588 -< Soup-Debug: SoupMessage 5 (0xffba90) +< Soup-Debug-Timestamp: 1431695658 +< Soup-Debug: SoupMessage 1 (0x17eba90) < Cache-Control: no-cache, no-store, max-age=0, must-revalidate < Pragma: no-cache < Expires: Fri, 01 Jan 1990 00:00:00 GMT -< Date: Wed, 06 May 2015 21:59:48 GMT -< ETag: "pc4WsFKtK0DPTzlsquzpd-pobYU/76RTQy6ui7dW5fjosFBgA2nn3xs" +< Date: Fri, 15 May 2015 13:14:18 GMT +< ETag: "pc4WsFKtK0DPTzlsquzpd-pobYU/B8kMcoqCaCSDiRNkCnla7CydlBw" < Vary: Origin < Vary: X-Origin < Content-Type: application/json; charset=UTF-8 @@ -32,8 +32,8 @@ < < { < "kind": "calendar#calendar", -< "etag": "\"pc4WsFKtK0DPTzlsquzpd-pobYU/76RTQy6ui7dW5fjosFBgA2nn3xs\"", -< "id": "ndihjbq6agrl249fjqgd535qmk@group.calendar.google.com", +< "etag": "\"pc4WsFKtK0DPTzlsquzpd-pobYU/B8kMcoqCaCSDiRNkCnla7CydlBw\"", +< "id": "639ohpeq637el4v0ct3gdcms54@group.calendar.google.com", < "summary": "Temp Test Calendar" < } diff --git a/gdata/tests/traces/calendar/setup-temp-calendar-acls b/gdata/tests/traces/calendar/setup-temp-calendar-acls index 56c3b8c3..e0256a8f 100644 --- a/gdata/tests/traces/calendar/setup-temp-calendar-acls +++ b/gdata/tests/traces/calendar/setup-temp-calendar-acls @@ -1,75 +1,43 @@ -> POST /calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full HTTP/1.1 -> Soup-Debug-Timestamp: 1375202836 -> Soup-Debug: SoupSession 1 (0x65a2e0), SoupMessage 120 (0x7fffe40158e0), SoupSocket 110 (0x7fffe0040af0) -> Host: www.google.com -> Authorization: GoogleLogin auth=DQAAANUAAACtQA4YYe986jGVKTRKjvf_LQKCUZ-IrhGFxQuS1Zfjc3yd5y6Y5AHV3CUuKKT-NheGlvH_Hh7TOXLccehoG2zbN5TDNxZ-TDfe29rhXBteyCMVj5DvD7eNA2g8k8tM1sbnqitPfsPs-kbfR6iXisr9Yp_3Vt3LqvpmmxJI6AKoXpC08YhV24rZiqJZMMHhxxFr_TeYYtgiPL9vOqjnfhJJI6rGgNQ6eYvVaKo7TzLgbhWkg6Sikn3hbkowxi8_rA9_Bvwwxs77T15OWlsObAigagTJyjsQoAUGISPhESplZQ +> POST /calendar/v3/calendars/639ohpeq637el4v0ct3gdcms54@group.calendar.google.com/acl HTTP/1.1 +> Soup-Debug-Timestamp: 1431695658 +> Soup-Debug: SoupSession 1 (0x1562260), SoupMessage 2 (0x17ebc70), SoupSocket 2 (0x7efddc003780) +> Host: www.googleapis.com +> Authorization: Bearer ya29.dAFjwh3j5bnolAkoumk7nKv5Et2BPEF4uLxyUsDhp788Hs7E6P4W865ZrKn7PAcfe4X40GjC0xx3Wg > GData-Version: 2 -> Content-Type: application/atom+xml +> Content-Type: application/json > Accept-Encoding: gzip, deflate +> User-Agent: libgdata/0.17.2 - gzip > Connection: Keep-Alive > -> <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gAcl='http://schemas.google.com/acl/2007' xmlns:gd='http://schemas.google.com/g/2005'><title type='text'>http://schemas.google.com/gCal/2005#editor</title><category term='http://schemas.google.com/acl/2007#accessRule' scheme='http://schemas.google.com/g/2005#kind'/><gAcl:role value='http://schemas.google.com/gCal/2005#editor'/><gAcl:scope type='user' value='darcy@gmail.com'/></entry> +> {"kind":"calendar#aclRule","role":"writer","scope":{"type":"user","value":"darcy@gmail.com"}} -< HTTP/1.1 302 Moved Temporarily -< Soup-Debug-Timestamp: 1375202836 -< Soup-Debug: SoupMessage 120 (0x7fffe40158e0) -< Update-Client-Auth: DQAAANYAAACtQA4YYe986jGVKTRKjvf_lzf1dm9Ue8N3SJp2J6o695WrE5nMbNLIXgO1GwYSOH0dinvA7V6dAhAIAEim2gLMsmbC2ddMnDUzaVKIGr3_JWCh97kMTIAR1M2IeSsu02b7EZA-X4HjICLw-x5pMnXhR8i08nLbVHSLT_No8fvB518lPWszfELKmW9TYG0-BAxXFzn9IKi_SmDnEv70WeTVk9AKBXEZK8GgbVvG2jwg9IxQwwSgxxH2Am-wKlw1Xh28Ocyi9bXsxw2zvbHLluu_emFBzQJ8Ds6aIurEQIryfg -< Set-Cookie: DO_NOT_CACHE_RESPONSE=true;Expires=Tue, 30-Jul-2013 16:47:17 GMT -< Set-Cookie: S=calendar=ZeDIKMUxNaJdSQptI64v2w;Expires=Wed, 07-Aug-2013 20:50:45 GMT;Secure -< Expires: Tue, 30 Jul 2013 16:47:16 GMT -< Date: Tue, 30 Jul 2013 16:47:16 GMT -< Location: https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full?gsessionid=ZeDIKMUxNaJdSQptI64v2w -< Content-Type: text/html; charset=UTF-8 -< Cache-control: private, max-age=0 +< HTTP/1.1 200 OK +< Soup-Debug-Timestamp: 1431695659 +< Soup-Debug: SoupMessage 2 (0x17ebc70) +< Cache-Control: no-cache, no-store, max-age=0, must-revalidate +< Pragma: no-cache +< Expires: Fri, 01 Jan 1990 00:00:00 GMT +< Date: Fri, 15 May 2015 13:14:19 GMT +< ETag: "00001431695659021000" +< Vary: Origin +< Vary: X-Origin +< Content-Type: application/json; charset=UTF-8 +< Content-Encoding: gzip < X-Content-Type-Options: nosniff < X-Frame-Options: SAMEORIGIN < X-XSS-Protection: 1; mode=block < Server: GSE +< Alternate-Protocol: 443:quic,p=1 < Transfer-Encoding: chunked < -< <HTML> -< <HEAD> -< <TITLE>Moved Temporarily</TITLE> -< </HEAD> -< <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> -< <H1>Moved Temporarily</H1> -< The document has moved <A HREF="https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full?gsessionid=ZeDIKMUxNaJdSQptI64v2w">here</A>. -< </BODY> -< </HTML> - -> POST /calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full?gsessionid=ZeDIKMUxNaJdSQptI64v2w HTTP/1.1 -> Soup-Debug-Timestamp: 1375202836 -> Soup-Debug: SoupSession 1 (0x65a2e0), SoupMessage 120 (0x7fffe40158e0), SoupSocket 111 (0x7fffe0040970), restarted -> Host: www.google.com -> Authorization: GoogleLogin auth=DQAAANUAAACtQA4YYe986jGVKTRKjvf_LQKCUZ-IrhGFxQuS1Zfjc3yd5y6Y5AHV3CUuKKT-NheGlvH_Hh7TOXLccehoG2zbN5TDNxZ-TDfe29rhXBteyCMVj5DvD7eNA2g8k8tM1sbnqitPfsPs-kbfR6iXisr9Yp_3Vt3LqvpmmxJI6AKoXpC08YhV24rZiqJZMMHhxxFr_TeYYtgiPL9vOqjnfhJJI6rGgNQ6eYvVaKo7TzLgbhWkg6Sikn3hbkowxi8_rA9_Bvwwxs77T15OWlsObAigagTJyjsQoAUGISPhESplZQ -> GData-Version: 2 -> Content-Type: application/atom+xml -> Accept-Encoding: gzip, deflate -> Connection: Keep-Alive -> Content-Length: 473 -> -> <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:gAcl='http://schemas.google.com/acl/2007' xmlns:gd='http://schemas.google.com/g/2005'><title type='text'>http://schemas.google.com/gCal/2005#editor</title><category term='http://schemas.google.com/acl/2007#accessRule' scheme='http://schemas.google.com/g/2005#kind'/><gAcl:role value='http://schemas.google.com/gCal/2005#editor'/><gAcl:scope type='user' value='darcy@gmail.com'/></entry> - -< HTTP/1.1 201 Created -< Soup-Debug-Timestamp: 1375202837 -< Soup-Debug: SoupMessage 120 (0x7fffe40158e0) -< Update-Client-Auth: DQAAANYAAACtQA4YYe986jGVKTRKjvf_q4NwI2V8UT-SSEMjiblkY8jTSCIGQJCo_ZFavemirrG0G2jzg3jjEVC3CQauPSZoNTFtDCw6Eu1-1S6nOyDK2J9zwLcpKLPHGuWk8fzL5JjKgN0Z0HbdhVtGaldMU2XCoc4_I0dsAZNFNzMl12pQ2IhlOpKYk_syrjXgbEIFWB07e6wSu6Mp1XswtWQL95nokCfWJkTHf4YGsR2zpy2736UplfLIVHDJLz7fiJzKG-5nUmoz2a5jdwopbkQ6flW44tTL7okPm_2Y6nqlPi74Mg -< Set-Cookie: DO_NOT_CACHE_RESPONSE=true;Expires=Tue, 30-Jul-2013 16:47:18 GMT -< Set-Cookie: S=calendar=xDRPVc8CWeuqjiBdPj6K4A;Expires=Mon, 12-Aug-2013 17:58:51 GMT;Secure -< Expires: Tue, 30 Jul 2013 16:47:17 GMT -< Date: Tue, 30 Jul 2013 16:47:17 GMT -< Content-Type: application/atom+xml; charset=UTF-8; type=entry -< Cache-control: private, max-age=0, must-revalidate, no-transform -< Vary: Accept, X-GData-Authorization, GData-Version -< GData-Version: 2.6 -< ETag: W/"CE8HRn46eip7JGA9WhFWEk0." -< Location: https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Adarcy%40gmail.com -< Content-Location: https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Adarcy%40gmail.com -< X-Content-Type-Options: nosniff -< X-Frame-Options: SAMEORIGIN -< X-XSS-Protection: 1; mode=block -< Server: GSE -< Transfer-Encoding: chunked -< -< <?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom' xmlns:app='http://www.w3.org/2007/app' xmlns:gd='http://schemas.google.com/g/2005' xmlns:gAcl='http://schemas.google.com/acl/2007' gd:etag='W/"CE8HRn46eip7JGA9WhFWEk0."' gd:kind='calendar#acl'><id>http://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/user%3Adarcy%40gmail.com</id><published>2013-07-30T16:47:17.012Z</published><updated>2013-07-30T16:47:17.000Z</updated><app:edited>2013-07-30T16:47:17.012Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/acl/2007#accessRule'/><title>editor</title><content/><link rel='self' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Adarcy%40gmail.com'/><link rel='edit' type='application/atom+xml' href='https://www.google.com/calendar/feeds/i4jqlr6fcg9obf3qucemmcm1m0%40group.calendar.google.com/acl/full/user%3Adarcy%40gmail.com'/><author><name>Temp Test Calendar</name><email>i4jqlr6fcg9obf3qucemmcm1m0@group.calendar.google.com</email></author><gAcl:role value='http://schemas.google.com/gCal/2005#editor'/><gAcl:scope type='user' value='darcy@gmail.com'/></entry> +< { +< "kind": "calendar#aclRule", +< "etag": "\"00001431695659021000\"", +< "id": "user:darcy@gmail.com", +< "scope": { +< "type": "user", +< "value": "darcy@gmail.com" +< }, +< "role": "writer" +< } |