8 #include "unisecuregen.h"
10 #include "wvstringlist.h"
14 #include "wvlinkerhack.h"
27 UniSecureGen::UniSecureGen(WvStringParm moniker,
UniPermGen *_perms)
38 IUniConfGen *_perms = wvcreate<IUniConfGen>(permmon);
60 cred.user = _cred.user;
62 WvStringTable::Iter i(_cred.groups);
63 for (i.rewind(); i.next(); )
64 cred.groups.add(
new WvString(*i),
true);
68 void UniSecureGen::setcredentials(WvStringParm user,
const WvStringList &groups)
72 WvStringList::Iter i(groups);
73 for (i.rewind(); i.next(); )
74 cred.groups.add(
new WvString(*i),
true);
94 if (findperm(key, UniPermGen::READ))
100 return WvString::null;
106 if (findperm(key.
removelast(), UniPermGen::EXEC))
114 if (findperm(key, UniPermGen::WRITE))
121 if (findperm(key, UniPermGen::EXEC))
146 {
return it->
next(); }
149 {
return it->
key(); }
155 return gen->
get(realkey);
166 if (findperm(key, UniPermGen::EXEC))
182 if (findperm(key, UniPermGen::EXEC))
189 void UniSecureGen::gencallback(
const UniConfKey &key, WvStringParm value)
191 if (findperm(key, UniPermGen::READ))
196 bool UniSecureGen::findperm(
const UniConfKey &key, UniPermGen::Type type)
201 return perms->getperm(key, cred, type);
205 bool UniSecureGen::drilldown(
const UniConfKey &key)
213 if (!perms->getperm(check, cred, UniPermGen::EXEC))
void setinner(IUniConfGen *inner)
Rebinds the inner generator and prepares its callback.
WvString wvtcl_getword(WvBuf &buf, const WvStringMask &splitchars=WVTCL_SPLITCHARS, bool do_unescape=true)
Get a single tcl word from an input buffer, and return the rest of the buffer untouched.
UniConfKey removefirst(int n=1) const
Returns the path formed by removing the first n segments of this path.
virtual void commit()
Commits any changes.
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
UniConfKey removelast(int n=1) const
Returns the path formed by removing the last n segments of this path.
virtual UniConfKey key() const
Returns the current key.
virtual bool haschildren(const UniConfKey &key)
Returns true if a key has children.
void prepend(const UniConfKey &other)
Prepends a path to this path.
virtual Iter * recursiveiterator(const UniConfKey &key)
Like iterator(), but the returned iterator is recursive, that is, it will return children of the imme...
virtual Iter * recursiveiterator(const UniConfKey &key)
Like iterator(), but the returned iterator is recursive, that is, it will return children of the imme...
virtual UniConfKey key() const =0
Returns the current key.
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
WvString is an implementation of a simple and efficient printable-string class.
An abstract data container that backs a UniConf tree.
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
UniPermGen wraps a tree encoding Unix-style permissions, and provides an API for setting and checking...
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
A type-safe version of WvMonikerBase that lets you provide create functions for object types other th...
virtual bool next()
Seeks to the next element in the sequence.
bool isempty() const
Returns true if this path has zero segments (also known as root).
void delta(const UniConfKey &key, WvStringParm value)
Call this when a key's value or children have possibly changed.
UniConfKey first(int n=1) const
Returns the path formed by the n first segments of this path.
UniSecureGen wraps a given generator and checks permissions (using a Unix-style scheme) before respon...
The const in place raw memory buffer type.
virtual void rewind()=0
Rewinds the iterator.
virtual WvString value() const
Returns the value of the current key.
virtual void rewind()
Rewinds the iterator.
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
virtual bool next()=0
Seeks to the next element in the sequence.
virtual bool exists(const UniConfKey &key)
Without fetching its value, returns true if a key exists.
virtual bool refresh()
Refreshes information about a key recursively.
This is a WvList of WvStrings, and is a really handy way to parse strings.
virtual void commit()
Commits any changes.
virtual bool haschildren(const UniConfKey &key)
Returns true if a key has children.
virtual bool exists(const UniConfKey &key)
Without fetching its value, returns true if a key exists.
void append(const UniConfKey &other)
Appends a path to this path.
virtual bool refresh()
Refreshes information about a key recursively.
A UniConfGen that delegates all requests to an inner generator.
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
An abstract iterator over keys and values in a generator.