From e52351fc50deb62f8c739923fbcdbfe1f9c9e71d Mon Sep 17 00:00:00 2001 From: Ari Lazier Date: Thu, 20 Oct 2016 13:07:45 -0700 Subject: [PATCH] add support for logging out --- src/js_sync.hpp | 19 +++++++++++++++---- src/object-store | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/js_sync.hpp b/src/js_sync.hpp index 2ea518f3..990b04d8 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -80,6 +80,11 @@ public: {"all", {wrap, nullptr}}, }; + static void logout(ContextType, ObjectType, size_t, const ValueType[], ReturnValue &); + + MethodMap const methods = { + {"logout", wrap} + }; }; template @@ -109,10 +114,11 @@ template void UserClass::create_user(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) { validate_argument_count(argc, 3, 4); - SharedUser *user = new SharedUser(SyncManager::shared().get_user(Value::validated_to_string(ctx, arguments[1]), - Value::validated_to_string(ctx, arguments[2]), - (std::string)Value::validated_to_string(ctx, arguments[0]), - Value::validated_to_boolean(ctx, arguments[3]))); + SharedUser *user = new SharedUser(SyncManager::shared().get_user( + Value::validated_to_string(ctx, arguments[1]), + Value::validated_to_string(ctx, arguments[2]), + (std::string)Value::validated_to_string(ctx, arguments[0]), + Value::validated_to_boolean(ctx, arguments[3]))); return_value.set(create_object>(ctx, user)); } @@ -125,6 +131,11 @@ void UserClass::all_users(ContextType ctx, ObjectType object, ReturnValue &re return_value.set(Object::create_array(ctx, user_vector)); } +template +void UserClass::logout(ContextType ctx, ObjectType object, size_t, const ValueType[], ReturnValue &) { + get_internal>(object)->get()->log_out(); +} + template class SyncClass : public ClassDefinition { using GlobalContextType = typename T::GlobalContext; diff --git a/src/object-store b/src/object-store index 1cf28ec0..e4a0ff94 160000 --- a/src/object-store +++ b/src/object-store @@ -1 +1 @@ -Subproject commit 1cf28ec004b20353c175feb669c8d84943282035 +Subproject commit e4a0ff9493c1559fae7ec64a42fa87dc52be8fd2