add support for logging out
This commit is contained in:
parent
dfc10a5a42
commit
e52351fc50
|
@ -80,6 +80,11 @@ public:
|
||||||
{"all", {wrap<all_users>, nullptr}},
|
{"all", {wrap<all_users>, nullptr}},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void logout(ContextType, ObjectType, size_t, const ValueType[], ReturnValue &);
|
||||||
|
|
||||||
|
MethodMap<T> const methods = {
|
||||||
|
{"logout", wrap<logout>}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -109,10 +114,11 @@ template<typename T>
|
||||||
void UserClass<T>::create_user(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
void UserClass<T>::create_user(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[], ReturnValue &return_value) {
|
||||||
validate_argument_count(argc, 3, 4);
|
validate_argument_count(argc, 3, 4);
|
||||||
|
|
||||||
SharedUser *user = new SharedUser(SyncManager::shared().get_user(Value::validated_to_string(ctx, arguments[1]),
|
SharedUser *user = new SharedUser(SyncManager::shared().get_user(
|
||||||
Value::validated_to_string(ctx, arguments[2]),
|
Value::validated_to_string(ctx, arguments[1]),
|
||||||
(std::string)Value::validated_to_string(ctx, arguments[0]),
|
Value::validated_to_string(ctx, arguments[2]),
|
||||||
Value::validated_to_boolean(ctx, arguments[3])));
|
(std::string)Value::validated_to_string(ctx, arguments[0]),
|
||||||
|
Value::validated_to_boolean(ctx, arguments[3])));
|
||||||
return_value.set(create_object<T, UserClass<T>>(ctx, user));
|
return_value.set(create_object<T, UserClass<T>>(ctx, user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,6 +131,11 @@ void UserClass<T>::all_users(ContextType ctx, ObjectType object, ReturnValue &re
|
||||||
return_value.set(Object::create_array(ctx, user_vector));
|
return_value.set(Object::create_array(ctx, user_vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void UserClass<T>::logout(ContextType ctx, ObjectType object, size_t, const ValueType[], ReturnValue &) {
|
||||||
|
get_internal<T, UserClass<T>>(object)->get()->log_out();
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class SyncClass : public ClassDefinition<T, void *> {
|
class SyncClass : public ClassDefinition<T, void *> {
|
||||||
using GlobalContextType = typename T::GlobalContext;
|
using GlobalContextType = typename T::GlobalContext;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1cf28ec004b20353c175feb669c8d84943282035
|
Subproject commit e4a0ff9493c1559fae7ec64a42fa87dc52be8fd2
|
Loading…
Reference in New Issue