ItemContent::user_name(EzcEnv & env) changed to ItemContent::user(morm::ModelWrapper ** model_wrapper) and we return a User class

ItemContent::group_name(EzcEnv & env) changed to ItemContent::group(morm::ModelWrapper ** model_wrapper) and we return a Group class
added ItemContent::display_user_name(EzcEnv & env)
some functions in templates/item.cpp moved to Item
This commit is contained in:
2021-06-19 23:48:12 +02:00
parent d8c1a81bcb
commit e7c7324058
20 changed files with 318 additions and 88 deletions

View File

@@ -34,6 +34,7 @@
#include "user.h"
#include "core/misc.h"
#include "templates/templates.h"
namespace Winix
@@ -51,23 +52,23 @@ User::User()
void User::fields()
{
field(L"id", id, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::primary_key);
field(L"login", name); // IMPROVEME set the same name, either 'login' or 'name'
field(L"super_user", super_user);
field(L"id", id, morm::FT::no_insertable | morm::FT::no_updatable | morm::FT::primary_key);
field(L"login", name); // IMPROVEME set the same name, either 'login' or 'name'
field(L"super_user", super_user); // IMPROVEME rename to is_super_user
field(L"has_pass", has_pass);
field(L"pass_type", pass_type);
field(L"password", password);
field(L"pass_encrypted", pass_encrypted, morm::FT::binary);
field(L"pass_hash_salted", pass_hash_salted);
field(L"has_pass", has_pass);
field(L"pass_type", pass_type);
field(L"password", L"", password);
field(L"pass_encrypted", L"", pass_encrypted, morm::FT::binary);
field(L"pass_hash_salted", pass_hash_salted); // IMPROVEME rename to pass_is_hash_salted or is_pass_hash_salted
field(L"email", email);
field(L"notify", notify);
field(L"env", env);
field(L"aenv", aenv);
field(L"status", status);
field(L"locale_id", locale_id);
field(L"time_zone_id", time_zone_id);
field(L"email", email);
field(L"notify", notify);
field(L"env", env);
field(L"aenv", aenv); // IMPROVEME rename to admin_env
field(L"status", status);
field(L"locale_id", locale_id);
field(L"time_zone_id", time_zone_id);
}
@@ -177,6 +178,15 @@ bool User::do_migration_to_1()
void User::display_name(EzcEnv & env)
{
std::wstring * dname = aenv.get_wstr(L"display_name");
if( dname && !IsWhite(*dname, true) )
env.out << *dname;
else
env.out << name;
}