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

@@ -201,24 +201,26 @@ static EzcGen ezc_generator;
//}
void item_can_read(Info & i)
{
i.res = system->HasReadAccess(*cur->request->last_item);
}
// changed to item.has_read_access
//void item_can_read(Info & i)
//{
// i.res = system->HasReadAccess(*cur->request->last_item);
//}
void item_can_write(Info & i)
{
i.res = system->HasWriteAccess(*cur->request->last_item);
}
// changed to item.has_write_access
//void item_can_write(Info & i)
//{
// i.res = system->HasWriteAccess(*cur->request->last_item);
//}
void item_can_remove(Info & i)
{
// !! tutaj trzeba bedzie cos innego zrobic
// zwlaszcza jak dojdzie sticky bit
i.res = system->HasWriteAccess(*cur->request->dir_tab.back());
}
// changed to item.can_be_removed
//void item_can_remove(Info & i)
//{
// // !! tutaj trzeba bedzie cos innego zrobic
// // zwlaszcza jak dojdzie sticky bit
// i.res = system->HasWriteAccess(*cur->request->dir_tab.back());
//}
//void item_user(Info & i)

View File

@@ -142,25 +142,12 @@ void print_date_nice(Info & i, const pt::Date & date)
// cannot be a const reference at the moment (pt::Space is used)
void print_user_name(Info & i, User & user)
{
std::wstring * dname = user.aenv.get_wstr(L"display_name");
if( dname && !IsWhite(*dname, true) )
i.out << *dname;
else
i.out << user.name;
}
// IMPROVEME move me to User class
// DEPRECATED, we have ItemContent::display_user_name and User::display_name
void print_user_name(Info & i, User * puser, const std::wstring & guest_name)
{
if( puser )
{
print_user_name(i, *puser);
puser->display_name(i);
}
else
{
@@ -176,6 +163,7 @@ void print_user_name(Info & i, User * puser, const std::wstring & guest_name)
} // namespace TemplatesFunctions
} // namespace Winix

View File

@@ -74,14 +74,6 @@ void print_hour_min(Info & i, time_t time);
void print_date_nice(Info & i, const pt::Date & date);
/*
print a user name -- it is trying to use 'display_name' from user's admin env
if it not find it or if the 'display_name' is all white (consists of all white characters)
then the login name is printed
*/
void print_user_name(Info & i, User & user);
/*
puser can be null -- in such a case guest_name is used

View File

@@ -452,9 +452,9 @@ void Templates::CreateFunctions()
//ezc_functions.Insert("item_has_static_file", item_has_static_file);
// ezc_functions.Insert("item_has_thumb", item_has_thumb);
ezc_functions.Insert("item_can_read", item_can_read);
ezc_functions.Insert("item_can_write", item_can_write);
ezc_functions.Insert("item_can_remove", item_can_remove);
// ezc_functions.Insert("item_can_read", item_can_read);
// ezc_functions.Insert("item_can_write", item_can_write);
// ezc_functions.Insert("item_can_remove", item_can_remove);
//ezc_functions.Insert("item_user", item_user);
ezc_functions.Insert("item_modification_user", item_modification_user);
ezc_functions.Insert("item_users_different", item_users_different);

View File

@@ -342,9 +342,9 @@ namespace TemplatesFunctions
//void item_filetype_is_image(Info & i);
//void item_has_static_file(Info & i);
//void item_has_thumb(Info & i);
void item_can_read(Info & i);
void item_can_write(Info & i);
void item_can_remove(Info & i);
// void item_can_read(Info & i);
// void item_can_write(Info & i);
// void item_can_remove(Info & i);
//void item_user(Info & i);
void item_modification_user(Info & i);
void item_users_different(Info & i);