incron
0.5.10
|
User table class. More...
#include <usertable.h>
Public Member Functions | |
UserTable (EventDispatcher *pEd, const std::string &rUser, bool fSysTable) | |
Constructor. | |
virtual | ~UserTable () |
Destructor. | |
void | Load () |
Loads the table. | |
void | Dispose () |
Removes all entries from the table. | |
void | OnEvent (InotifyEvent &rEvt) |
Processes an inotify event. | |
bool | MayAccess (const std::string &rPath, bool fNoFollow) const |
Checks whether the user may access a file. | |
bool | IsSystem () const |
Checks whether it is a system table. | |
Inotify * | GetInotify () |
Returns the related inotify object. | |
void | RunAsUser (char *const *argv) const |
Runs a program as the table's user. | |
Static Public Member Functions | |
static void | FinishDone () |
Cleans-up all zombie child processes and enables disabled watches. | |
static bool | CheckUser (const char *user) |
Checks whether an user exists and has permission to use incron. |
User table class.
This class processes inotify events for an user. It creates child processes which do appropriate actions as defined in the user table file.
UserTable::UserTable | ( | EventDispatcher * | pEd, |
const std::string & | rUser, | ||
bool | fSysTable | ||
) |
Constructor.
[in] | pEd | event dispatcher |
[in] | rUser | user name |
[in] | fSysTable | system table yes/no |
UserTable::~UserTable | ( | ) | [virtual] |
Destructor.
static bool UserTable::CheckUser | ( | const char * | user | ) | [inline, static] |
Checks whether an user exists and has permission to use incron.
It searches for the given user name in the user database. If it failes it returns 'false'. Otherwise it checks permission files for this user (see InCronTab::CheckUser()).
[in] | user | user name |
void UserTable::Dispose | ( | ) |
Removes all entries from the table.
All entries are unregistered from the event dispatcher and their watches are destroyed.
void UserTable::FinishDone | ( | ) | [static] |
Cleans-up all zombie child processes and enables disabled watches.
Inotify* UserTable::GetInotify | ( | ) | [inline] |
Returns the related inotify object.
bool UserTable::IsSystem | ( | ) | const |
Checks whether it is a system table.
void UserTable::Load | ( | ) |
Loads the table.
All loaded entries have their inotify watches and are registered for event dispatching. If loading fails the table remains empty.
bool UserTable::MayAccess | ( | const std::string & | rPath, |
bool | fNoFollow | ||
) | const |
Checks whether the user may access a file.
Any access right (RWX) is sufficient.
[in] | rPath | absolute file path |
[in] | fNoFollow | don't follow a symbolic link |
void UserTable::OnEvent | ( | InotifyEvent & | rEvt | ) |
Processes an inotify event.
[in] | rEvt | inotify event |
void UserTable::RunAsUser | ( | char *const * | argv | ) | const |
Runs a program as the table's user.