added: privileges (user, groups, permissions)
(not finished yet) classes: User, Group, Users, Groups, UGContainer changed: Dir class into Dirs git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@467 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
118
core/groups.cpp
Executable file
118
core/groups.cpp
Executable file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* This file is a part of CMSLU -- Content Management System like Unix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "groups.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Groups::Groups()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void Groups::Clear()
|
||||
{
|
||||
table.Clear();
|
||||
}
|
||||
|
||||
|
||||
void Groups::ReadGroups()
|
||||
{
|
||||
Clear();
|
||||
|
||||
db.GetGroups(table);
|
||||
}
|
||||
|
||||
|
||||
Group * Groups::GetGroup(long group_id)
|
||||
{
|
||||
Table::Iterator i = table.FindId(group_id);
|
||||
|
||||
if( i == table.End() )
|
||||
return 0;
|
||||
|
||||
return &(*i);
|
||||
}
|
||||
|
||||
|
||||
Group * Groups::GetGroup(const std::string & name)
|
||||
{
|
||||
Table::Iterator i = table.FindName(name);
|
||||
|
||||
if( i == table.End() )
|
||||
return 0;
|
||||
|
||||
return &(*i);
|
||||
}
|
||||
|
||||
|
||||
long Groups::GetGroupId(const std::string & name)
|
||||
{
|
||||
Group * pgroup = GetGroup(name);
|
||||
|
||||
if( !pgroup )
|
||||
return -1;
|
||||
|
||||
return pgroup->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Groups::Iterator Groups::Begin()
|
||||
{
|
||||
return table.Begin();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Groups::Iterator Groups::End()
|
||||
{
|
||||
return table.End();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Groups::SizeType Groups::Size()
|
||||
{
|
||||
return table.Size();
|
||||
}
|
||||
|
||||
|
||||
Group & Groups::operator[](Groups::SizeType pos)
|
||||
{
|
||||
return table[pos];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user