[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated (b142cb6 -> 2545fa5)
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated (b142cb6 -> 2545fa5) |
Date: |
Thu, 17 Sep 2020 15:29:38 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a change to branch master
in repository anastasis.
from b142cb6 modified redux.*.json
new 8a3872f modified reducer to return UserAttributesAddedState
new 2545fa5 modified reducer
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/lib/anastasis_api_backup_redux.c | 172 ++++++++++++++++++++++++++++++++++-
1 file changed, 168 insertions(+), 4 deletions(-)
diff --git a/src/lib/anastasis_api_backup_redux.c
b/src/lib/anastasis_api_backup_redux.c
index 65455fb..d6331d1 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -240,13 +240,14 @@ select_continent (const json_t *state,
"backup-state",
json_string ("ReduxContinentSelectedState"));
- json_object_set_new (new_state,
- "countries",
- countries);
- // optional:
json_object_set_new (new_state,
"selected_continent",
continent);
+
+ json_object_set_new (new_state,
+ "countries",
+ countries);
+
cb (cb_cls,
ANASTASIS_EC_NONE,
new_state);
@@ -319,7 +320,150 @@ enter_user_attributes (const json_t *state,
ANASTASIS_ActionCallback cb,
void *cb_cls)
{
+ json_t *new_state;
+ json_t *attributes = json_object_get (arguments, "identity");
+
+ if (NULL == state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ if (NULL == attributes)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ new_state = json_deep_copy (state);
+ if (NULL == new_state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+
+ json_object_set (new_state,
+ "backup-state",
+ json_string ("ReduxUserAttributesAddedState"));
+
+ json_object_set_new (new_state,
+ "identity_attributes",
+ attributes);
+
+ cb (cb_cls,
+ ANASTASIS_EC_NONE,
+ new_state);
+ json_decref (new_state);
+}
+
+
+static void
+edit_user_attributes (const json_t *state,
+ const json_t *arguments,
+ ANASTASIS_ActionCallback cb,
+ void *cb_cls)
+{
+ json_t *new_state;
+ json_t *attributes = json_object_get (arguments, "identity");
+
+ if (NULL == state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ if (NULL == attributes)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+
+ new_state = json_deep_copy (state);
+ if (NULL == new_state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+
+
+ json_object_set_new (new_state,
+ "identity_attributes",
+ attributes);
+
+ cb (cb_cls,
+ ANASTASIS_EC_NONE,
+ new_state);
+ json_decref (new_state);
+}
+
+
+static void
+change_country (const json_t *state,
+ const json_t *arguments,
+ ANASTASIS_ActionCallback cb,
+ void *cb_cls)
+{
+ json_t *new_state;
+ json_t *root;
+ json_t *country = json_object_get (arguments, "country_code");
+
+ if (NULL == state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ if (NULL == country)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ if (GNUNET_SYSERR ==
+ redux_id_attr_init (json_string_value (country)))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ new_state = json_deep_copy (state);
+ if (NULL == new_state)
+ {
+ GNUNET_break (0);
+ cb (cb_cls,
+ ANASTASIS_EC_INVALID, // FIXME: Define correct error code
+ NULL);
+ }
+ root = json_object_get (redux_id_attr, "required_attributes");
+
+
+ json_object_set (new_state,
+ "backup-state",
+ json_string ("ReduxCountrySelectedState"));
+
+ json_object_set_new (new_state,
+ "selected_country",
+ country);
+
+ json_object_set_new (new_state,
+ "required_attributes",
+ root);
+
+ cb (cb_cls,
+ ANASTASIS_EC_NONE,
+ new_state);
+ json_decref (new_state);
}
@@ -384,16 +528,36 @@ ANASTASIS_backup_action (const json_t *state,
"entering_user_attributes",
&enter_user_attributes
},
+ {
+ "ReduxCountrySelectedState",
+ "changing_country",
+ &change_country
+ },
{
"ReduxUserAttributesAddedState",
"adding_authentication",
&add_authentication
},
+ {
+ "ReduxUserAttributesAddedState",
+ "editing_user_attributes",
+ &edit_user_attributes
+ },
+ {
+ "ReduxUserAttributesAddedState",
+ "changing_country",
+ &change_country
+ },
{
"ReduxAuthenticationAddedState",
"adding_policy",
&add_policy
},
+ {
+ "ReduxAuthenticationAddedState",
+ "editing_user_attributes",
+ &edit_user_attributes
+ },
{ NULL, NULL, NULL }
};
const char *s = json_string_value (json_object_get (state,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (b142cb6 -> 2545fa5),
gnunet <=