- updated to the new pikotools api (child spaces were removed)

some plugins need to be fixed yet: ticket, gallery, group, menu
- added current user to default models as "user"
- renamed in User: super_user -> is_super_user, env -> admin_env, pass_hash_salted -> is_pass_hash_salted
- now Users class has a WinixModel as a base class
  some plugin calls have to be fixed yet
- added UserWrapper model with a pointer to User class
- removed from ItemContent: methods for accessing 'meta' and 'admin_meta', now ezc can iterate through Space classes
- fixed in env winix function: if there is "changeuser" parameter then we should only switch the user (not save anything)
This commit is contained in:
2021-06-27 23:31:50 +02:00
parent 472490c239
commit 1d18b7fa12
59 changed files with 1419 additions and 1607 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,7 +65,7 @@ public:
Iterator End();
SizeType Size();
bool Empty();
Iterator PushBack(const Type & type); // can return End() if the user already exists
Iterator PushBack(const Type & type, const std::wstring & name); // can return End() if the user already exists
void Clear();
bool Is(long id);
@@ -78,17 +78,20 @@ public:
// main table
Table table;
private:
// don't copy these objects
UGContainer(const UGContainer<Type> &);
UGContainer<Type> & operator=(const UGContainer<Type> &);
void AddIndexes(Iterator iter);
void AddIndexes(Iterator iter, const std::wstring & name);
void RebuildIndexes();
// main table
Table table;
// table.size() has O(n) complexity
size_t table_size;
@@ -163,16 +166,16 @@ bool UGContainer<Type>::Empty()
template<class Type>
typename UGContainer<Type>::Iterator UGContainer<Type>::PushBack(const Type & type)
typename UGContainer<Type>::Iterator UGContainer<Type>::PushBack(const Type & type, const std::wstring & name)
{
if( Is(type.id) || Is(type.name) )
if( Is(type.id) || Is(name) )
return End();
table.push_back(type);
table_size += 1;
Iterator i = --table.end();
log << log3 << "UGCont: added, id: " << type.id << ", name: " << type.name << logend;
AddIndexes(i);
log << log3 << "UGCont: added, id: " << type.id << ", name: " << name << logend;
AddIndexes(i, name);
return i;
}
@@ -242,12 +245,12 @@ return i->second;
template<class Type>
void UGContainer<Type>::AddIndexes(UGContainer<Type>::Iterator iter)
void UGContainer<Type>::AddIndexes(UGContainer<Type>::Iterator iter, const std::wstring & name)
{
table_id.insert( std::make_pair(iter->id, iter) );
table_name.insert( std::make_pair(iter->name, iter) );
table_name.insert( std::make_pair(name, iter) );
log << log4 << "UGCont: added indexes to: id: " << iter->id << ", name: " << iter->name << logend;
log << log4 << "UGCont: added indexes to: id: " << iter->id << ", name: " << name << logend;
}
@@ -286,14 +289,15 @@ bool UGContainer<Type>::Remove(long id)
{
if( n->second == i->second )
{
log << log4 << "UGCont: removed index_name to: id: " << i->second->id << ", name: " << n->first << logend;
table_name.erase(n);
log << log4 << "UGCont: removed index_id to: id: " << i->second->id << ", name: " << i->second->name << logend;
break;
}
}
log << log4 << "UGCont: removed index_name to: id: " << i->second->id << ", name: " << i->second->name << logend;
log << log3 << "UGCont: removed: id: " << i->second->id << ", name: " << i->second->name << logend;
log << log4 << "UGCont: removed index_id to: id: " << i->second->id << logend;
log << log3 << "UGCont: removed: id: " << i->second->id << logend;
table.erase(i->second);
table_id.erase(i);
result = true;