unipermgen.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
#ifndef __UNIPERMGEN_H
00008
#define __UNIPERMGEN_H
00009
00010
#include "unifiltergen.h"
00011
#include "wvstringtable.h"
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 class UniPermGen :
public UniFilterGen
00030 {
00031
00032
public:
00033
UniPermGen(
UniConfGen *_gen);
00034
UniPermGen(
WvStringParm moniker);
00035
00036 enum Level {
USER = 0,
GROUP,
WORLD };
00037
static WvString level2str(Level l);
00038
00039 enum Type {
READ = 0,
WRITE,
EXEC };
00040
static WvString type2str(Type t);
00041
00042 struct Credentials
00043 {
00044 WvString user;
00045 mutable WvStringTable groups;
00046
00047
00048 Credentials() :
groups(7) { }
00049 };
00050
00051
00052
void setowner(
const UniConfKey &path,
WvStringParm owner);
00053
WvString getowner(
const UniConfKey &path);
00054
00055
00056
void setgroup(
const UniConfKey &path,
WvStringParm group);
00057
WvString getgroup(
const UniConfKey &path);
00058
00059
00060
00061
00062
00063 bool getread(
const UniConfKey &path,
const Credentials &cred)
00064 {
return getperm(path, cred,
READ); }
00065 bool getwrite(
const UniConfKey &path,
const Credentials &cred)
00066 {
return getperm(path, cred,
WRITE); }
00067 bool getexec(
const UniConfKey &path,
const Credentials &cred)
00068 {
return getperm(path, cred,
EXEC); }
00069
00070
bool getperm(
const UniConfKey &path,
const Credentials &cred, Type type);
00071
00072 void setread(
const UniConfKey &path, Level level,
bool read)
00073 {
setperm(path, level,
READ, read); }
00074 void setwrite(
const UniConfKey &path, Level level,
bool write)
00075 {
setperm(path, level,
WRITE, write); }
00076 void setexec(
const UniConfKey &path, Level level,
bool exec)
00077 {
setperm(path, level,
EXEC, exec); }
00078
00079
void setperm(
const UniConfKey &path, Level level, Type type,
bool val);
00080
00081
00082
00083
00084
00085
void chmod(
const UniConfKey &path,
unsigned int owner,
unsigned int group,
00086
unsigned int world);
00087
void chmod(
const UniConfKey &path,
unsigned int mode);
00088
00089
private:
00090
00091
bool getoneperm(
const UniConfKey &path, Level level, Type type);
00092 };
00093
00094
00095
#endif // __UNIPERMGEN_H
Generated on Tue Oct 5 01:09:19 2004 for WvStreams by
1.3.7