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:
81
core/dirs.h
Executable file
81
core/dirs.h
Executable file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfiledirs
|
||||
#define headerfiledirs
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "item.h"
|
||||
#include "error.h"
|
||||
#include "log.h"
|
||||
#include "db.h"
|
||||
#include "dircontainer.h"
|
||||
|
||||
|
||||
|
||||
class Dirs
|
||||
{
|
||||
|
||||
private:
|
||||
public: // !! temporarily
|
||||
|
||||
|
||||
// id = -1;
|
||||
Item root;
|
||||
|
||||
|
||||
DirContainer dir_table;
|
||||
|
||||
|
||||
// parent (or -1), item
|
||||
//typedef std::multimap<long, Item> DirTable;
|
||||
//DirTable dir_table;
|
||||
|
||||
|
||||
bool ExtractName(const char * & s, std::string & name);
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
void Clear();
|
||||
void ReadDirs();
|
||||
|
||||
// without any exceptions
|
||||
// these methods return false in a case the path or name (with a specific parent) are invalid
|
||||
// we do not support '..' in a path (for security reason)
|
||||
|
||||
bool IsDir(long id);
|
||||
|
||||
bool GetDir(const std::string & path, Item ** item);
|
||||
bool GetDir(const std::string & name, long parent, Item ** item);
|
||||
|
||||
bool GetDirId(const std::string & path, long * id);
|
||||
bool GetDirId(const std::string & name, long parent, long * id);
|
||||
|
||||
bool GetDirChilds(long parent, std::vector<Item> & childs_table); // only returns dir-children
|
||||
|
||||
bool MakePath(long id, std::string & path);
|
||||
|
||||
|
||||
// with an Error exception
|
||||
// if the path or name are invalid these methods throw an exception
|
||||
Item * GetDir(const std::string & path);
|
||||
Item * GetDir(const std::string & name, long parent);
|
||||
long GetDirId(const std::string & path);
|
||||
long GetDirId(const std::string & name, long parent);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user